12#ifndef WSFCOMPONENTLIST_HPP
13#define WSFCOMPONENTLIST_HPP
15#include "wsf_export.h"
59 void DeleteAllComponents();
63 unsigned int GetComponentCount(
int aRole)
const;
99 if (componentPtr !=
nullptr)
174 if (component.second->QueryInterfaceT(aPtr))
210 T* componentPtr(
nullptr);
211 mIter->second->QueryInterfaceT(componentPtr);
218 T* componentPtr(
nullptr);
219 if (!
mIter->second->QueryInterfaceT(componentPtr))
221 throw std::out_of_range(
"Dereference of nullptr");
246 RoleIterator(ComponentList::const_iterator aIter, ComponentList::const_iterator aEndIter)
272 ComponentList::const_iterator
mIter;
284 : mComponentList(&aComponentList)
292 return RoleIterator<T>(mComponentList->mComponentsByName.end(), mComponentList->mComponentsByName.end());
316 virtual void ComponentAdded(
WsfComponent* aComponentPtr);
317 virtual void ComponentDeleted(
WsfComponent* aComponentPtr);
319 bool AddComponentP(
WsfComponent* aComponentPtr,
bool aDoNotify);
323 void DeleteAllP(
bool aDoNotify);
325 bool DeleteComponentP(
WsfStringId aName,
int aRole,
bool aDoNotify);
333 WsfComponent* GetComponentEntryByRoleP(
int aRole,
unsigned int aEntry)
const;
335 bool RemoveComponentP(
WsfStringId aName,
int aRole,
bool aDelete,
bool aDoNotify);
341template<
class COMPONENT_TYPE>
365 Iterator(
const ComponentList::const_iterator& aSrc)
387 ComponentList::const_iterator mIterator;
399 , mParentOfComponentsPtr(nullptr)
411 , mParentOfComponentsPtr(nullptr)
453 mParentOfComponentsPtr = aComponentParentPtr;
494 std::vector<ComponentType*> components;
497 components.push_back(
static_cast<ComponentType*
>(component.second));
502 std::stable_sort(components.begin(), components.end(), compare);
519 bool myCommand{
false};
542 return aList.
Begin();
554 return aList.
Begin();
WsfComponentListT< T >::Iterator end(const WsfComponentListT< T > &aList)
Definition WsfComponentList.hpp:546
WsfComponentListT< T >::Iterator begin(const WsfComponentListT< T > &aList)
Definition WsfComponentList.hpp:540
WsfComponentListT< WsfPlatformComponent > WsfPlatformComponentList
A convenience definition for the frequently used component list containing platform components.
Definition WsfComponentList.hpp:537
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponentList.hpp:363
ComponentType * operator->() const
Return the pointer to the component.
Definition WsfComponentList.hpp:384
bool operator!=(const Iterator &aRhs) const
Test for operator inequality.
Definition WsfComponentList.hpp:378
Iterator & operator++()
Prefix increment.
Definition WsfComponentList.hpp:371
ComponentType * operator*() const
Return the pointer to the component.
Definition WsfComponentList.hpp:381
Iterator(const ComponentList::const_iterator &aSrc)
Definition WsfComponentList.hpp:365
A component list that stores only components of a specified type.
Definition WsfComponentList.hpp:343
WsfComponentListT(const WsfComponentListT &aSrc)
Definition WsfComponentList.hpp:409
typename WsfComponentT< Comm >::ParentType ParentType
Definition WsfComponentList.hpp:346
void SetParentOfComponents(ParentType *aComponentParentPtr)
Definition WsfComponentList.hpp:451
WsfComponentT< Comm > ComponentType
Definition WsfComponentList.hpp:345
std::vector< ComponentType * > GetComponentsByInitializationOrder() const
Return a vector of components in the order in which they should be initialized.
Definition WsfComponentList.hpp:492
Iterator Begin() const
Return an iterator for the beginning of the component list.
Definition WsfComponentList.hpp:392
bool ProcessComponentInput(UtInput &aInput)
Definition WsfComponentList.hpp:517
ParentType * GetParentOfComponents() const
Definition WsfComponentList.hpp:442
bool RemoveComponent(ComponentType *aComponentPtr)
Definition WsfComponentList.hpp:506
ComponentType * FindComponent(WsfStringId aName) const
Definition WsfComponentList.hpp:474
ComponentType * FindComponentByRole(int aRole) const
Definition WsfComponentList.hpp:481
Iterator End() const
Return an iterator for the end of the component list.
Definition WsfComponentList.hpp:395
ComponentType * GetComponentEntryByRole(int aRole, unsigned int aEntry) const
Definition WsfComponentList.hpp:486
bool AddComponent(ComponentType *aComponentPtr)
Definition WsfComponentList.hpp:464
~WsfComponentListT() override
Definition WsfComponentList.hpp:417
WsfComponentListT()
Definition WsfComponentList.hpp:397
WsfComponentListT(WsfComponentListT &&)=default
WsfComponentListT & operator=(WsfComponentListT &&aRhs)
Definition WsfComponentList.hpp:430
ComponentType * FindComponent(WsfStringId aName, int aRole) const
Definition WsfComponentList.hpp:476
WsfComponentListT & operator=(const WsfComponentListT &aRhs)
Definition WsfComponentList.hpp:419
Definition WsfComponentList.hpp:197
RoleIterator(const WsfComponentList &aComponentList)
Definition WsfComponentList.hpp:199
bool operator==(const RoleIterator &aOther) const
Compares two iterators for equality.
Definition WsfComponentList.hpp:227
RoleIterator & operator=(const RoleIterator &aRhs)=default
ComponentList::const_iterator mIter
Definition WsfComponentList.hpp:272
ComponentList::const_iterator mEndIter
Definition WsfComponentList.hpp:273
RoleIterator(ComponentList::const_iterator aIter, ComponentList::const_iterator aEndIter)
Definition WsfComponentList.hpp:246
T * operator*() const
Return the pointer to the component.
Definition WsfComponentList.hpp:208
RoleIterator & operator++()
Prefix increment.
Definition WsfComponentList.hpp:233
RoleIterator(const RoleIterator &)=default
T * operator->() const
Return the pointer to the component.
Definition WsfComponentList.hpp:216
bool operator!=(const RoleIterator &aOther) const
Compares two iterators for inequality.
Definition WsfComponentList.hpp:230
int mRole
Definition WsfComponentList.hpp:271
void AdvanceP()
Definition WsfComponentList.hpp:258
bool AtEnd() const
Return true if positioned at the end of the list.
Definition WsfComponentList.hpp:240
Definition WsfComponentList.hpp:281
RoleIterator< T > end()
Definition WsfComponentList.hpp:290
RoleIterator< T > begin()
Definition WsfComponentList.hpp:288
RoleRange(const WsfComponentList &aComponentList)
Definition WsfComponentList.hpp:283
Definition WsfComponentList.hpp:43
bool HasComponents() const
Returns true if the component list has at least one component.
Definition WsfComponentList.hpp:57
std::vector< NameAndComponent > ComponentList
Definition WsfComponentList.hpp:46
bool DeleteComponent(WsfStringId aName, int aRole)
Definition WsfComponentList.cpp:62
bool DeleteComponent()
Definition WsfComponentList.hpp:95
WsfComponentList(WsfComponentList &&)=default
WsfComponent * GetComponentEntryByRoleP(int aRole, unsigned int aEntry) const
Definition WsfComponentList.cpp:235
T * GetComponentEntry(unsigned int aEntry) const
Definition WsfComponentList.hpp:154
T * GetComponent(WsfStringId aName) const
Definition WsfComponentList.hpp:127
RoleRange< T > GetComponentRange()
Definition WsfComponentList.hpp:310
WsfComponentList()
Definition WsfComponentList.cpp:15
ComponentList mComponentsByName
Definition WsfComponentList.hpp:337
bool DeleteComponent(WsfStringId aName)
Definition WsfComponentList.hpp:80
unsigned int GetComponentCount(int aRole) const
Definition WsfComponentList.cpp:71
T * GetComponent() const
Definition WsfComponentList.hpp:116
std::pair< WsfStringId, WsfComponent * > NameAndComponent
Definition WsfComponentList.hpp:45
WsfComponent * FindComponentP(WsfStringId aName, int aRole) const
Definition WsfComponentList.cpp:204
WsfComponentList & operator=(const WsfComponentList &aRhs)
Definition WsfComponentList.cpp:30
bool AddComponentP(WsfComponent *aComponentPtr, bool aDoNotify)
Definition WsfComponentList.cpp:147
unsigned int GetComponentCount() const
Definition WsfComponentList.hpp:138
void CopyAllP(const WsfComponentList &aSrc, bool aDoNotify)
Base class implementation of copying a component list.
Definition WsfComponentList.cpp:101
void DeleteAllP(bool aDoNotify)
Base class implementation of deleting all components in the list.
Definition WsfComponentList.cpp:117
bool RemoveComponentP(WsfStringId aName, int aRole, bool aDelete, bool aDoNotify)
Definition WsfComponentList.cpp:253
virtual void ComponentAdded(WsfComponent *aComponentPtr)
Definition WsfComponentList.cpp:89
WsfComponent * FindComponentByRoleP(int aRole) const
Definition WsfComponentList.cpp:222
bool FindByRole(T *&aPtr) const
Definition WsfComponentList.hpp:170
Definition WsfComponent.hpp:119
void SetComponentParent(ParentType *aParentPtr)
Definition WsfComponent.hpp:159
Definition WsfComponent.hpp:39
virtual const int * GetComponentRoles() const =0
virtual WsfStringId GetComponentName() const =0
virtual int GetComponentInitializationOrder() const
Definition WsfComponent.hpp:79
virtual bool ProcessInput(UtInput &aInput)
Definition WsfComponent.cpp:100
Definition WsfComponentRoles.hpp:60