1 #ifndef CORE_SharedPointersArray_CPP 2 #define CORE_SharedPointersArray_CPP 37 boost::shared_ptr<T> *pValues=
mValues;
38 const boost::shared_ptr<T> *cValues=&cpy[0];
40 *pValues=boost::dynamic_pointer_cast<T>(*cValues);
54 boost::shared_ptr<T> *newValues=
null;
56 newValues=
new boost::shared_ptr<T>[
mCapacity];
57 }
catch (std::exception e) {
58 cout << e.what()<<
"\n";
60 "CORE_SharedPointersArray<T>::resize(cap)",
61 "not enought memory to allocate new array");
66 const boost::shared_ptr<T> *cValues=&(*this)[0];
68 *newValues=boost::dynamic_pointer_cast<T>(*cValues);
87 boost::shared_ptr<T> *newValues=
null;
89 newValues =
new boost::shared_ptr<T>[
mCapacity];
90 }
catch (std::exception e) {
91 cout << e.what()<<
"\n";
92 throw CORE_Exception(
"common/core",
"CORE_SharedPointersArray<T>::resize(cap)",
93 "not enought memory to allocate new array");
97 const boost::shared_ptr<T> *cValues=&(*this)[0];
99 *newValues=boost::dynamic_pointer_cast<T>(*cValues);
126 boost::shared_ptr<T> *pValues=&(*this)[
mSize];
127 const boost::shared_ptr<T> *cValues=
null;
129 cValues=&(*this)[
mSize-1];
144 if (
mSize==0)
return false;
146 boost::shared_ptr<T> *pValues=&(*this)[i];
151 if ((*pValues).get()==obj) {
168 if ((i<0) || (i>=
mSize))
return false;
171 boost::shared_ptr<T> *pValues=&(*this)[i];
173 const boost::shared_ptr<T> *cValues=
null;
197 if (
mSize==0)
return false;
198 const boost::shared_ptr<T> *pValues=&(*this)[0];
200 if ((*pValues).get()==obj)
return true;
void copy(const CORE_SharedPointersArray< Q > &cpy)
New copy constructor of a shared pointers list.
Definition: CORE_SharedPointersArray.hpp:33
tBoolean removeAtIndex(const tUIndex &i)
remove the pointer at index i
Definition: CORE_SharedPointersArray.hpp:166
tUIndex mSize
Definition: CORE_SharedPointersArray.h:16
void resize(const tUIndex &cap)
resize the array
Definition: CORE_SharedPointersArray.hpp:47
void insert(const tUIndex &i, boost::shared_ptr< T > obj)
insert the pointer at index i the old element i become the element i+1
Definition: CORE_SharedPointersArray.hpp:122
tBoolean remove()
remove the last pointer
Definition: CORE_SharedPointersArray.h:217
void set(const tUIndex &i, boost::shared_ptr< T > obj)
set the pointer at the index i
Definition: CORE_SharedPointersArray.hpp:114
#define tBoolean
Definition: types.h:139
boost::shared_ptr< T > * mValues
Definition: CORE_SharedPointersArray.h:25
tFlag mCapacityFactor
Definition: CORE_SharedPointersArray.h:22
const tUIndex & getSize() const
return the size of the array
Definition: CORE_SharedPointersArray.h:254
#define null
Definition: types.h:144
virtual ~CORE_SharedPointersArray()
destroy an array of T*
Definition: CORE_SharedPointersArray.hpp:23
CORE_SharedPointersArray()
internal constructor of a shared pointers list
Definition: CORE_SharedPointersArray.hpp:8
tUIndex mCapacity
Definition: CORE_SharedPointersArray.h:19
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
void fit()
fit the capacity to size
Definition: CORE_SharedPointersArray.hpp:81
#define tUIndex
Definition: types.h:126
abstract base class for most classes.
Definition: CORE_Object.h:53
void setSize(const tUIndex &n)
set the size of the shared pointers list
Definition: CORE_SharedPointersArray.h:111
void add(boost::shared_ptr< T > obj)
add an element at the end
Definition: CORE_SharedPointersArray.h:167
tBoolean exists(const T &obj) const
exists
Definition: CORE_SharedPointersArray.hpp:192
class CORE_SharedPointersArray is a list of shared pointers
Definition: CORE_SharedPointersArray.h:12