/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#include <tango/client/GroupAttrReplyList.h>

namespace Tango
{

//=============================================================================
// class GroupAttrReplyList
//=============================================================================
GroupAttrReplyList::GroupAttrReplyList() :
    std::vector<GroupAttrReply>(0)
{
    //-noop impl
}

GroupAttrReplyList::~GroupAttrReplyList() = default;

GroupAttrReplyList::GroupAttrReplyList(const GroupAttrReplyList &) = default;
GroupAttrReplyList &GroupAttrReplyList::operator=(const GroupAttrReplyList &) = default;

GroupAttrReplyList::GroupAttrReplyList(GroupAttrReplyList &&) = default;
GroupAttrReplyList &GroupAttrReplyList::operator=(GroupAttrReplyList &&) = default;

/**
 * Check if an error has occurred
 *
 * Returns a boolean set to true if the read_attribute executed on the group has failed
 * for any device member of the hierarchy. Otherwise, returns false
 *
 * @return The error flag
 */
bool GroupAttrReplyList::has_failed() const
{
    return has_failed_m;
}

//- reset the error list
/**
 * Reset the object
 *
 * This methods empty the inherited vector and reset the error flag
 */
void GroupAttrReplyList::reset()
{
    clear();
    has_failed_m = false;
}

///@privatesection
//- push_back overload
void GroupAttrReplyList::push_back(const GroupAttrReply &ar)
{
    if(ar.has_failed())
    {
        has_failed_m = true;
    }
    Inherited::push_back(ar);
}

} // namespace Tango
