#include <ContainerImplementations.h>
Inherits DigitalSpaces::ListType.
A component implementor will not generally use this function, but rather one of the derived classes (or template instances). For the sake of simplicity, so far only DIObjectBaseList1Impl is used, since each returned object can be dss_cast as appropriate.
Example usage:
DigitalSpaces::DIObjectBaseList1Impl objectList; pSomeInterface->GetListOfObjects( &objectList ); std::vector<DigitalSpaces::DIObjectBase>& listOfObjects = objectList.GetList(); for( std::vector< DigitalSpaces::DIObjectBase >::const_iterator itCur = listOfObjects.begin(); itCur != listOfObjects.end(); ++itCur ) { DigitalSpaces::DInterfaceThatIsUseful* pUsefulInterface = DigitalSpaces::dss_cast< DigitalSpaces::DInterfaceThatIsUseful >(*itCur); pUsefulInterface->DoSomething(); }
Public Types | |
| typedef DIList1< ListType, ListItemType > | self_type |
| Convenient typedef, used for the DImplementation convenience macro. | |
Public Member Functions | |
| DIList1 () | |
| Default contructor. | |
| DIList1 (const DIList1 &src) | |
| Copy constructor. | |
| DIList1 (const std::list< ListItemType * > srcList) | |
| Construct the object, copying the items from the provided STL list. | |
| DIList1 (const std::vector< ListItemType * > srcVector) | |
| Convenience constructor allowing initialization with a STL vector instead of a list. | |
| ~DIList1 () | |
| Generic Destructor. | |
| std::list< ListItemType * > & | GetList () |
| Returns a direct reference to the implementations collection. | |
Interface Functions | |
These functions are those required by the implemented interface. | |
| void | Restart () |
| ListItemType *const | GetCurrent () |
| bool | Advance () |
| bool | AtEnd () |
| bool | Empty () |
| unsigned int | Size () |
| ListItemType *const | GetCurrentAndAdvance () |
| void | PushBack (ListItemType *item) |
| void | Clear () |
Protected Attributes | |
| std::list< ListItemType * > | m_list |
| The collection this implementation is wrapping. | |
| std::list< ListItemType * > ::iterator | m_iterator |
| Storage for "current". | |
| typedef DIList1<ListType,ListItemType> DigitalSpaces::DIList1< ListType, ListItemType >::self_type |
Convenient typedef, used for the DImplementation convenience macro.
| DigitalSpaces::DIList1< ListType, ListItemType >::DIList1 | ( | ) | [inline] |
Default contructor.
Initializes an empty list.
| DigitalSpaces::DIList1< ListType, ListItemType >::DIList1 | ( | const DIList1< ListType, ListItemType > & | src | ) | [inline] |
Copy constructor.
Copys the list contents, however it puts "Current" at the beginning of the copied list.
| DigitalSpaces::DIList1< ListType, ListItemType >::DIList1 | ( | const std::list< ListItemType * > | srcList | ) | [inline] |
Construct the object, copying the items from the provided STL list.
"Current" will be set to the start of the new list.
| DigitalSpaces::DIList1< ListType, ListItemType >::DIList1 | ( | const std::vector< ListItemType * > | srcVector | ) | [inline] |
Convenience constructor allowing initialization with a STL vector instead of a list.
"Current" will be set to the start of the new list.
| DigitalSpaces::DIList1< ListType, ListItemType >::~DIList1 | ( | ) | [inline] |
Generic Destructor.
No work is performed in this implementation.
| void DigitalSpaces::DIList1< ListType, ListItemType >::Restart | ( | ) | [inline] |
Resets "current" to the first item.
Referenced by DigitalSpaces::GetFactoriesWithInterface().
| ListItemType* const DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrent | ( | ) | [inline] |
Gets the "current" entry.
Referenced by DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrentAndAdvance(), DigitalSpaces::GetFactoriesWithInterface(), and DigitalSpaces::GetSingleFactoryWithInterface().
| bool DigitalSpaces::DIList1< ListType, ListItemType >::Advance | ( | ) | [inline] |
Advances "current".
Referenced by DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrentAndAdvance(), and DigitalSpaces::GetFactoriesWithInterface().
| bool DigitalSpaces::DIList1< ListType, ListItemType >::AtEnd | ( | ) | [inline] |
Check if "current" is past the end of the list.
This will be the same as checking if Advance has returned false. If true, GetCurrent returns undefined answers.
Referenced by DigitalSpaces::GetFactoriesWithInterface().
| bool DigitalSpaces::DIList1< ListType, ListItemType >::Empty | ( | ) | [inline] |
Check if the list is empty.
Depending on the implementation, this may be faster then calling Size and comparing to zero, particularly in cases where the list is not empty.
| unsigned int DigitalSpaces::DIList1< ListType, ListItemType >::Size | ( | ) | [inline] |
Returns the length of the list.
| ListItemType* const DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrentAndAdvance | ( | ) | [inline] |
Calls GetCurrent then Advance, returning the value from GetCurrent.
This is a convenience function.
| void DigitalSpaces::DIList1< ListType, ListItemType >::PushBack | ( | ListItemType * | item | ) | [inline] |
Appends an object to the list.
| void DigitalSpaces::DIList1< ListType, ListItemType >::Clear | ( | ) | [inline] |
Removes all items from the list.
| std::list<ListItemType*>& DigitalSpaces::DIList1< ListType, ListItemType >::GetList | ( | ) | [inline] |
Returns a direct reference to the implementations collection.
This allows you to use STL functions to work with the list, rather then the more unwieldy interface functions.
std::list<ListItemType*> DigitalSpaces::DIList1< ListType, ListItemType >::m_list [protected] |
The collection this implementation is wrapping.
Referenced by DigitalSpaces::DIList1< ListType, ListItemType >::Advance(), DigitalSpaces::DIList1< ListType, ListItemType >::AtEnd(), DigitalSpaces::DIList1< ListType, ListItemType >::Clear(), DigitalSpaces::DIList1< ListType, ListItemType >::DIList1(), DigitalSpaces::DIList1< ListType, ListItemType >::Empty(), DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrent(), DigitalSpaces::DIList1< ListType, ListItemType >::GetList(), DigitalSpaces::DIList1< ListType, ListItemType >::PushBack(), DigitalSpaces::DIList1< ListType, ListItemType >::Restart(), and DigitalSpaces::DIList1< ListType, ListItemType >::Size().
std::list<ListItemType*>::iterator DigitalSpaces::DIList1< ListType, ListItemType >::m_iterator [protected] |
Storage for "current".
Referenced by DigitalSpaces::DIList1< ListType, ListItemType >::Advance(), DigitalSpaces::DIList1< ListType, ListItemType >::AtEnd(), DigitalSpaces::DIList1< ListType, ListItemType >::Clear(), DigitalSpaces::DIList1< ListType, ListItemType >::DIList1(), DigitalSpaces::DIList1< ListType, ListItemType >::GetCurrent(), DigitalSpaces::DIList1< ListType, ListItemType >::PushBack(), and DigitalSpaces::DIList1< ListType, ListItemType >::Restart().
1.5.6