1 #ifndef CORE_SharedPointersMatrix_H
2 #define CORE_SharedPointersMatrix_H
12 vector<CORE_SharedPointersList<T> > mVector;
38 inline boost::shared_ptr<CORE_SharedPointersMatrix<T> >
New() {
55 return mVector[(int)i];
63 return mVector[(int)i];
83 inline void setSize(
const int& n,
const int& p) {
85 for (
int i=0;i<n;i++) mVector[i].
setSize(p);
91 mVector[i].setSize(r);
97 const boost::shared_ptr<T>& obj) {
98 return mVector[i].set(j,obj);
105 const boost::shared_ptr<T>& obj) {
106 return mVector[i].insert(j,obj);
113 const boost::shared_ptr<T>& obj) {
128 int n=mVector.size();
129 if ((j>-1) && (j<n))
return mVector[i].removeAtIndex(j);
138 inline tBoolean remove(
const boost::shared_ptr<T>& obj) {
139 int n=mVector.size();
141 for (
int i=0;i<n;i++)
if (mVector[i].
remove(obj)) ret=
true;
151 int n=mVector.size();
153 for (
int i=0;i<n;i++)
if (mVector[i].
remove(obj)) ret=
true;
164 int n=mVector.size();
165 for (
int i=0;i<n;i++)
if (mVector[i].
remove(obj)) ret=
true;
193 inline const T*
get(
const int& i,
const int& j)
const {
199 return mVector[i][j].get();
206 inline T*
get(
const int& i,
const int& j) {
211 return mVector[i][j].get();
215 inline int rows()
const {
return mVector.size();};
218 inline int getRowSize(
const int& i)
const {
return mVector[i].size();};
221 inline int getSize()
const {
return mVector.size();};
227 int n=mVector.size();
228 for (
int i=0;i<n;i++)
if (mVector[i].
exists(obj))
return true;
234 int n=mVector.size();
235 for (
int i=0;i<n;i++)
if (mVector[i].
exists(obj))
return true;
242 int n=mVector.size();
243 for (
int i=0;i<n;i++)
if (mVector[i].
exists(obj))
return true;
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
tBoolean exists(const T &obj) const
exists
Definition: CORE_SharedPointersMatrix.h:233
int getRowSize(const int &i) const
return the size of row at index i
Definition: CORE_SharedPointersMatrix.h:218
tBoolean exists(const T *obj) const
exists
Definition: CORE_SharedPointersMatrix.h:241
void add(const int &i, const boost::shared_ptr< T > &obj)
add an element at the end
Definition: CORE_SharedPointersMatrix.h:112
tBoolean removeAtIndex(const int &i, const int &j)
remove the element at index i and j
Definition: CORE_SharedPointersMatrix.h:126
boost::shared_ptr< CORE_SharedPointersMatrix< T > > New()
create a shared pointer of CORE_SharedPointersMatrix
Definition: CORE_SharedPointersMatrix.h:38
#define tBoolean
Definition: types.h:35
tBoolean exists(const boost::shared_ptr< T > &obj) const
exists
Definition: CORE_SharedPointersMatrix.h:226
void clear()
clear the array
Definition: CORE_SharedPointersMatrix.h:180
void setSize(const int &n)
set the size of the matrix of shared pointers
Definition: CORE_SharedPointersMatrix.h:77
tBoolean set(const int &i, const int &j, const boost::shared_ptr< T > &obj)
set the pointer at the index i
Definition: CORE_SharedPointersMatrix.h:96
CORE_SharedPointersMatrix()
create the shared pointers matrix
Definition: CORE_SharedPointersMatrix.hpp:7
CORE_SharedPointersList< T > & operator[](const int &i)
get the share pointers list of line i
Definition: CORE_SharedPointersMatrix.h:60
void setSize(const int &n, const int &p)
set the size of an rectangular matrix
Definition: CORE_SharedPointersMatrix.h:83
void setRowSize(const int &i, const int &r)
set size of the row
Definition: CORE_SharedPointersMatrix.h:90
abstract base class for most classes.
Definition: CORE_Object.h:30
tBoolean insert(const int &i, const int &j, const boost::shared_ptr< T > &obj)
insert the pointer at index i the old element i become the element i+1
Definition: CORE_SharedPointersMatrix.h:104
int getSize() const
return the size of the array
Definition: CORE_SharedPointersMatrix.h:221
void removeLine(const int &i)
remove the line at index i
Definition: CORE_SharedPointersMatrix.h:172
class CORE_SharedPointersMatrix is a matrix of shared pointers Matrix is a vector of shared pointer o...
Definition: CORE_SharedPointersMatrix.h:9
const CORE_SharedPointersList< T > & operator[](const int &i) const
get the i-th line
Definition: CORE_SharedPointersMatrix.h:52
virtual ~CORE_SharedPointersMatrix()
destroy an array of T*
Definition: CORE_SharedPointersMatrix.hpp:18
void copy(const CORE_SharedPointersMatrix< Q > &cpy)
copy the shared pointers matrix cpy
Definition: CORE_SharedPointersMatrix.hpp:25
#define ASSERT_IN(a)
Definition: types.h:82
int rows() const
return the number of rows
Definition: CORE_SharedPointersMatrix.h:215
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106