Go to the documentation of this file.
5 #ifndef CNOID_UTIL_POLYMORPHIC_POINTER_ARRAY_H
6 #define CNOID_UTIL_POLYMORPHIC_POINTER_ARRAY_H
20 template<
class ObjectType,
class Po
interType>
23 typedef std::vector<PointerType> Container;
35 template <
class RhsObjectType,
class RhsPo
interType>
42 template <
class RhsObjectType,
class RhsPo
interType>
44 for(std::size_t i=0; i < rhs.
size(); ++i){
45 PointerType p = cnoid::dynamic_pointer_cast<ObjectType>(rhs[i]);
54 return elements == rhs.elements;
58 return elements != rhs.elements;
62 return elements.empty();
66 elements.reserve(
size);
70 elements.resize(
size);
74 return elements.size();
78 return elements.begin();
82 return elements.begin();
86 return elements.end();
90 return elements.end();
94 return elements.back();
97 const PointerType&
back()
const {
98 return elements.back();
102 return elements.front();
106 return elements.front();
122 elements.push_back(pointer);
130 return elements.erase(pos);
134 elements.swap(x.elements);
bool operator==(const PolymorphicPointerArray &rhs) const
Definition: PolymorphicPointerArray.h:53
std::size_t size() const
Definition: PolymorphicPointerArray.h:73
const PointerType & front() const
Definition: PolymorphicPointerArray.h:105
iterator erase(iterator pos)
Definition: PolymorphicPointerArray.h:129
void push_back(const PointerType &pointer)
Definition: PolymorphicPointerArray.h:121
virtual ~PolymorphicPointerArrayBase()
Definition: PolymorphicPointerArray.h:16
virtual ~PolymorphicPointerArray()
Definition: PolymorphicPointerArray.h:40
Container::const_reference const_reference
Definition: PolymorphicPointerArray.h:31
void clear()
Definition: PolymorphicPointerArray.h:117
PolymorphicPointerArray & operator<<(const PolymorphicPointerArray< RhsObjectType, RhsPointerType > &rhs)
Definition: PolymorphicPointerArray.h:43
PointerType & operator[](std::size_t i)
Definition: PolymorphicPointerArray.h:109
const PointerType & back() const
Definition: PolymorphicPointerArray.h:97
iterator begin()
Definition: PolymorphicPointerArray.h:77
PointerType & back()
Definition: PolymorphicPointerArray.h:93
bool operator!=(const PolymorphicPointerArray &rhs) const
Definition: PolymorphicPointerArray.h:57
iterator end()
Definition: PolymorphicPointerArray.h:85
PolymorphicPointerArrayBase Base
Definition: PolymorphicPointerArray.h:27
Definition: PolymorphicPointerArray.h:21
void resize(size_t size)
Definition: PolymorphicPointerArray.h:69
PolymorphicPointerArray()
Definition: PolymorphicPointerArray.h:33
Definition: PolymorphicPointerArray.h:13
bool empty() const
Definition: PolymorphicPointerArray.h:61
void pop_back()
Definition: PolymorphicPointerArray.h:125
Definition: AbstractSceneLoader.h:11
void swap(PolymorphicPointerArray &x)
Definition: PolymorphicPointerArray.h:133
void reserve(size_t size)
Definition: PolymorphicPointerArray.h:65
const_iterator begin() const
Definition: PolymorphicPointerArray.h:81
const_iterator end() const
Definition: PolymorphicPointerArray.h:89
PointerType & front()
Definition: PolymorphicPointerArray.h:101
Container::const_iterator const_iterator
Definition: PolymorphicPointerArray.h:29
Container::iterator iterator
Definition: PolymorphicPointerArray.h:28
const PointerType & operator[](std::size_t i) const
Definition: PolymorphicPointerArray.h:113
Container::reference reference
Definition: PolymorphicPointerArray.h:30
PolymorphicPointerArray(const PolymorphicPointerArray< RhsObjectType, RhsPointerType > &rhs)
Definition: PolymorphicPointerArray.h:36