1 #ifndef CORE_WeakPointersList_CPP
2 #define CORE_WeakPointersList_CPP
29 for (
int i=0;i<n;i++) mVector[i]=boost::dynamic_pointer_cast<T>(cpy[i]);
36 for (
int i=0;i<n;i++) mVector[i]=boost::dynamic_pointer_cast<T>(cpy[i]);
41 int n=(int) mVector.size();
42 for (
int i=0;i<n;i++) {
43 boost::shared_ptr<T> v=mVector[i].lock();
44 if( (v==obj))
return true;
50 for (
int i=0;i<mVector.size();i++) {
51 boost::shared_ptr<T> v=mVector[i].lock();
52 if( (v) && (v.get()==&obj))
return true;
58 for (
int i=0;i<mVector.size();i++) {
59 boost::shared_ptr<T> v=mVector[i].lock();
60 if( (v) && (v.get()==&obj))
return true;
70 boost::shared_ptr<T> temp;
71 for (
int i=n-1;i>=0;i--) {
72 temp=mVector[i].lock();
85 boost::shared_ptr<T> temp;
86 for (
int i=n-1;i>=0;i--) {
87 temp=mVector[i].lock();
88 if ((temp)&&(temp.get()==&obj)) {
99 boost::weak_ptr<T> temp;
100 for (
int i=n-1;i>=0;i--) {
101 temp=mVector[i].lock();
102 if ((temp)&&(temp.get()==*obj)) {
113 if (index>=size())
return false;
114 if (index<0)
return false;
115 typename vector<boost::weak_ptr<T> >::iterator p=mVector.begin()+index;
122 boost::weak_ptr<T> temp=mVector[i];
123 mVector[i]=mVector[j];
130 if (((
int)mVector.size())==index) add(obj);
133 if (index<0)
return false;
134 typename vector<boost::shared_ptr<T> >::iterator p=mVector.begin()+i;
135 if (i>size())
return false;
136 boost::weak_ptr<T> wobj=obj;
137 mVector.insert(p,wobj);
149 boost::weak_ptr<T> wobj=obj;
156 int n=mVector.size();
157 for (
int i=0;i<n/2;i++) {
158 boost::weak_ptr<T> &temp=mVector[i];
159 mVector[i]=mVector[k];
168 int oldSize=getSize();
171 int newSize=getSize();
172 for (
int i=oldSize;i<newSize;i++) set(i,boost::dynamic_pointer_cast<T>(array[i]));
int getSize() const
return the size of the array
Definition: CORE_WeakPointersList.h:215
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
tBoolean insert(int i, const boost::shared_ptr< T > &obj)
insert the pointer at index i the old element i become the element i+1
Definition: CORE_WeakPointersList.hpp:129
#define tBoolean
Definition: types.h:35
CORE_WeakPointersList()
internal constructor
Definition: CORE_WeakPointersList.hpp:7
tBoolean exists(const boost::shared_ptr< T > &obj) const
exists
Definition: CORE_WeakPointersList.hpp:40
void permute(const int &i, const int &j)
permute
Definition: CORE_WeakPointersList.hpp:121
tBoolean set(int i, const boost::shared_ptr< T > &obj)
set the pointer at the index i
Definition: CORE_WeakPointersList.hpp:143
virtual ~CORE_WeakPointersList()
destroy an array of T*
Definition: CORE_WeakPointersList.hpp:19
void reverse()
reverse the vector
Definition: CORE_WeakPointersList.hpp:154
int getSize() const
return the size of the array
Definition: CORE_SharedPointersList.h:250
class CORE_WeakPointersList is a list of weak shared pointers
Definition: CORE_WeakPointersList.h:11
int size() const
return the size of the array
Definition: CORE_WeakPointersList.h:212
abstract base class for most classes.
Definition: CORE_Object.h:30
tBoolean remove()
remove the last pointer
Definition: CORE_WeakPointersList.h:159
void copy(const CORE_WeakPointersList< Q > &cpy)
copy the weak pointers list cpy
Definition: CORE_WeakPointersList.hpp:26
tBoolean removeAtIndex(const int &i)
remove the pointer at index i
Definition: CORE_WeakPointersList.hpp:112
void merge(const CORE_WeakPointersList< Q > &array)
merge the array in this
Definition: CORE_WeakPointersList.hpp:167