1 #ifndef CORE_SharedPointersList_CPP
2 #define CORE_SharedPointersList_CPP
29 for (
int i=0;i<n;i++) mVector[i]=boost::dynamic_pointer_cast<T>(cpy[i]);
35 for (
int i=0;i<n;i++) {
36 if ((*
this)[i]==obj)
return true;
42 for (
unsigned int i=0;i<mVector.size();i++)
43 if (mVector[i].
get()==&obj)
return true;
48 for (
unsigned int i=0;i<mVector.size();i++)
49 if (mVector[i].
get()==obj)
return true;
56 typename vector<boost::shared_ptr<T> >::iterator p;
60 p=find(mVector.begin(),mVector.end(),obj);
61 found=(p!=mVector.end());
72 int n=(int) mVector.size();
74 for (
int i=n-1;i>=0;i--) {
75 if (mVector[i].
get()==&obj) {
86 for (
int i=n-1;i>=0;i--) {
87 if (mVector[i].
get()==obj) {
98 if (index>=size())
return false;
99 if (index<0)
return false;
100 typename vector<boost::shared_ptr<T> >::iterator p=mVector.begin()+index;
107 boost::shared_ptr<T> temp=mVector[i];
108 mVector[i]=mVector[j];
115 if (((
int)mVector.size())==index) add(obj);
118 if (index<0)
return false;
119 typename vector<boost::shared_ptr<T> >::iterator p=mVector.begin()+i;
120 if (i>size())
return false;
121 mVector.insert(p,obj);
139 int n=mVector.size();
140 for (
int i=0;i<n/2;i++) {
141 boost::shared_ptr<T> &temp=mVector[i];
142 mVector[i]=mVector[k];
151 int oldSize=getSize();
154 int newSize=getSize();
156 for (
int i=oldSize;i<newSize;i++) set(i,boost::dynamic_pointer_cast<T>(array[k++]));
163 for (
int i=0;i<n;i++) vs[i]=
get(i);
169 for (
int i=0;i<n;i++) vs[i]=
get(i);
void copy(const CORE_SharedPointersList< Q > &cpy)
New copy constructor of a shared pointers list.
Definition: CORE_SharedPointersList.hpp:26
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
#define tBoolean
Definition: types.h:35
tBoolean insert(const int &i, boost::shared_ptr< T > obj)
insert the pointer at index i the old element i become the element i+1
Definition: CORE_SharedPointersList.hpp:114
void merge(const CORE_SharedPointersList< Q > &array)
merge the array in this
Definition: CORE_SharedPointersList.hpp:150
virtual ~CORE_SharedPointersList()
destroy an array of T*
Definition: CORE_SharedPointersList.hpp:19
void reverse()
reverse the vector
Definition: CORE_SharedPointersList.hpp:137
void getValues(vector< T * > &vs)
get values
Definition: CORE_SharedPointersList.hpp:160
void permute(const int &i, const int &j)
permute
Definition: CORE_SharedPointersList.hpp:106
CORE_SharedPointersList()
internal constructor of a shared pointers list
Definition: CORE_SharedPointersList.hpp:7
tBoolean removeAtIndex(const int &i)
remove the pointer at index i
Definition: CORE_SharedPointersList.hpp:97
tBoolean remove()
remove the last pointer
Definition: CORE_SharedPointersList.h:201
int getSize() const
return the size of the array
Definition: CORE_SharedPointersList.h:250
int size() const
return the size of the array
Definition: CORE_SharedPointersList.h:247
abstract base class for most classes.
Definition: CORE_Object.h:30
tBoolean set(const int &i, const boost::shared_ptr< T > &obj)
set the pointer at the index i
Definition: CORE_SharedPointersList.hpp:127
tBoolean exists(const boost::shared_ptr< T > &obj) const
exists
Definition: CORE_SharedPointersList.hpp:33