29 tFlag mCapacityFactor;
79 inline boost::shared_ptr<CORE_Array<T> > getThis() {
80 boost::shared_ptr<CORE_Array<T> > p;
86 inline boost::shared_ptr<const CORE_Array<T> > getThis()
const {
87 boost::shared_ptr<const CORE_Array<T> > p;
98 static inline boost::shared_ptr<CORE_Array<T> >
New() {
146 for (
tArrayIndex i=0;i<mSize;i++) mCVector[i]=f[i];
165 for (
int i=0;i<mSize;i++) mCVector[i]+=f;
206 if (mSize==0)
throw CORE_Exception(
"common/core",
"CORE_Array::getLastElement()",
"no element in array");
208 return mCVector[n-1];
254 "CORE_Array::setStartIndex()",
255 "start index out of bounds");
257 long long int d=n-mStartIndex;
260 mCVector=&mVector[mStartIndex];
306 if ((mVector!=
null) && (mHasToBeDeleted))
delete[] mVector;
312 mHasToBeDeleted=hasToBeDeleted;
456 void add(
const T& obj);
488 if (n==0)
return false;
519 if (mCVector[i]==obj) {
541 return search(mCVector,mSize,value,order);
547 sort(mCVector,mSize,
">");
552 sort(mCVector,mSize,order);
585 return sqrt(
norm2());
TYPEDEF_SPTR(CORE_DoubleArray)
const T & getLastElement()
get last element Assert in (mSize>0)
Definition: CORE_Array.h:205
const T * getValues() const
get the values of the util vector
Definition: CORE_Array.h:377
const T * getCompleteValues(tArrayIndex &s) const
get the values of the complete vector
Definition: CORE_Array.h:396
void setCapacity(const tArrayIndex &c)
set the capacity of the vector
Definition: CORE_Array.hpp:84
T * getValues(tArrayIndex &s)
get the values of the util vector
Definition: CORE_Array.h:389
virtual void clear()
clear the array
Definition: CORE_Array.h:493
void getSharedPointer(boost::shared_ptr< CORE_Array< T > > &p)
return the shared pointer corresponding to the class with casting
Definition: CORE_Array.h:64
void set(const tArrayIndex &i, const T &obj)
set the object at the index i
Definition: CORE_Array.h:340
static boost::shared_ptr< CORE_Array< T > > New()
return a CORE_Array shared pointer
Definition: CORE_Array.h:98
T & operator()(const tArrayIndex &i)
Definition: CORE_Array.h:134
#define tArrayIndex
Definition: types.h:39
tBoolean getSupIndex(const T &v, tArrayIndex &index) const
get the sup index of value return false if no value less than v
Definition: CORE_Array.hpp:513
void setCapacityFactor(const tFlag &n)
set the capacity factor
Definition: CORE_Array.h:267
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
int search(const T &value, const tString &order)
search the value in values vector ordered in order
Definition: CORE_Array.h:540
T distance2(const CORE_Array< T > &y) const
return distance squared
Definition: CORE_Array.h:589
void addAfterIndex(const tArrayIndex &index, const T &v)
add an element after index
Definition: CORE_Array.hpp:665
T * getValues()
get the values of the util vector
Definition: CORE_Array.h:383
void setValue(const tArrayIndex &i, const T &obj)
set the object at the index i
Definition: CORE_Array.h:346
void setValues(const CORE_Array< T > *array)
copy a CORE_Array and convert it
Definition: CORE_Array.h:287
static boost::shared_ptr< CORE_Array< T > > New(const tArrayIndex &n)
return a CORE_Array shared pointer
Definition: CORE_Array.h:106
this class describes a list
Definition: CORE_List.h:12
void setValues(const CORE_Array< T > &array)
Definition: CORE_Array.h:281
T distance(const CORE_Array< T > &y) const
get the distance
Definition: CORE_Array.h:601
#define tBoolean
Definition: types.h:48
void setValuesByReference(const tArrayIndex &n, T *&array, const tBoolean &hasToBeDeleted)
set the the values by reference the values is destroyed at the end if hasToBeDeleted is true ...
Definition: CORE_Array.h:305
CORE_Array< tString > CORE_StringArray
Definition: CORE_Array.h:619
tBoolean exists(const T &obj) const
exists
Definition: CORE_Array.h:517
CORE_Array< double > CORE_DoubleArray
Definition: CORE_Array.h:610
T & operator+=(const T &f)
operator +=
Definition: CORE_Array.h:164
#define null
Definition: types.h:13
CORE_Array< tCharacter > CORE_CharacterArray
Definition: CORE_Array.h:611
T & operator-=(const T &f)
operator -=
Definition: CORE_Array.h:170
CORE_Array< tDoubleComplex > CORE_DoubleComplexArray
Definition: CORE_Array.h:616
void reverse()
reverse the vector
Definition: CORE_Array.hpp:589
void contractToLastElements(const tArrayIndex &n)
keep only the last n elements of the array and set its capacity also to n
Definition: CORE_Array.hpp:304
void append(const CORE_Array< T > &array)
merge the array in this
Definition: CORE_Array.h:465
tArrayIndex insertInOrder(const T &obj, const tBoolean &evenIfEqual)
insert the object in increasing order
Definition: CORE_Array.hpp:353
tBoolean removeAtIndex(const tArrayIndex &i)
Definition: CORE_Array.hpp:291
void add(const T &obj)
add an element at the end re-allocate the array if capacity too small
Definition: CORE_Array.hpp:165
CORE_Array< tFlag > CORE_FlagArray
Definition: CORE_Array.h:617
T & operator=(const CORE_Array< T > &f)
operator =
Definition: CORE_Array.h:145
T norm2() const
get the norm
Definition: CORE_Array.h:573
T & operator[](const tArrayIndex &i)
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_Array.h:130
void copy(const CORE_Array< T > *src)
void copy
Definition: CORE_Array.h:237
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
static tBoolean search(const T *values, const tArrayIndex &n, const T &value, const tString &order, tArrayIndex &index)
search the value in values array ordered in order
Definition: CORE_Array.hpp:780
T norm() const
get the norm squared
Definition: CORE_Array.h:584
CORE_Array< tReal > CORE_RealArray
Definition: CORE_Array.h:614
CORE_Array< tBoolean > CORE_BooleanArray
Definition: CORE_Array.h:613
T * getCompleteValues(tArrayIndex &s)
get the values of the complete vector
Definition: CORE_Array.h:403
virtual ~CORE_Array()
destroy an array of T*
Definition: CORE_Array.hpp:65
this class describes an array
Definition: CORE_Array.h:18
tArrayIndex insert(const tArrayIndex &i, const T &obj)
insert the object at index i re-allocate the array if capacity too small
Definition: CORE_Array.hpp:324
CORE_Array< tRelativeInteger > CORE_RelativeIntegerArray
Definition: CORE_Array.h:621
const T & operator()(const tArrayIndex &i) const
Definition: CORE_Array.h:138
tBoolean getInfIndex(const T &v, tArrayIndex &index) const
get the inf index of value return false if no value less than v
Definition: CORE_Array.hpp:441
void setSize(const tArrayIndex &n)
set the size of the array
Definition: CORE_Array.hpp:149
void getSharedPointer(SP::CORE_Object &p)
get the shared pointer of this class into p
Definition: CORE_Object.h:65
void sort()
sort the array in an increasing order
Definition: CORE_Array.h:546
tArrayIndex insert(const T &obj)
insert the object in increasing order
Definition: CORE_Array.h:449
T & operator*=(const T &f)
operator *=
Definition: CORE_Array.h:158
void copy(const CORE_Array< T > &src)
void copy
Definition: CORE_Array.hpp:72
CORE_Array()
build an array of T*
Definition: CORE_Array.hpp:32
CORE_Array< tInteger > CORE_IntegerArray
Definition: CORE_Array.h:620
tString toString() const
turn the array into string
Definition: CORE_Array.hpp:651
void setValues(const CORE_Array< T > &array, const tArrayIndex &fromIndex)
Definition: CORE_Array.hpp:214
CORE_Array< int > CORE_IntArray
Definition: CORE_Array.h:612
void getSharedPointer(boost::shared_ptr< const CORE_Array< T > > &p) const
return the shared pointer corresponding to the class whith casting
Definition: CORE_Array.h:71
void initValues(const T &v)
init all values to v
Definition: CORE_Array.h:351
const T * getValues(tArrayIndex &s) const
get the values of the util vector
Definition: CORE_Array.h:371
const T & operator[](const tArrayIndex &i) const
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_Array.h:121
#define tString
Definition: types.h:49
T & operator/=(const T &f)
operator /=
Definition: CORE_Array.h:152
void sort(const tString &order)
sort the array
Definition: CORE_Array.h:551
void merge(const CORE_Array< T > &array)
merge the array in this
Definition: CORE_Array.hpp:604
void setValues(const tArrayIndex &n, const T *array)
copy an array of T
Definition: CORE_Array.h:298
CORE_Array< tShort > CORE_ShortArray
Definition: CORE_Array.h:618
const tArrayIndex & getStartIndex() const
get start index
Definition: CORE_Array.h:217
const tFlag & getCapacityFactor() const
get the capacity factor
Definition: CORE_Array.h:213
void resize()
resize the array to the util size
Definition: CORE_Array.hpp:115
const tArrayIndex & getSize() const
return the size of the array
Definition: CORE_Array.h:223
CORE_Array< tComplex > CORE_ComplexArray
Definition: CORE_Array.h:615
void setValues(const tString &str)
Definition: CORE_Array.h:334
const tArrayIndex & getCapacity() const
return the memory allocation size of the array
Definition: CORE_Array.h:226
void addAfterIndices(const CORE_Array< tArrayIndex > &indices, CORE_SharedPointersList< CORE_Array< T > > &values)
add alements after indices
Definition: CORE_Array.hpp:675
TYPEDEF_SVPTR(CORE_BooleanArray)
void setStartIndex(const tArrayIndex &n)
set the start index of the array adjust the size of the array such that the last element of the array...
Definition: CORE_Array.h:252
tBoolean getIndex(const T &v, tArrayIndex &index) const
get the index of value return false if no value in index
Definition: CORE_Array.hpp:404
CORE_Array< tLong > CORE_LongArray
Definition: CORE_Array.h:622
const tArrayIndex & size() const
return the size of the array
Definition: CORE_Array.h:220
void setValues(const vector< T > &array)
Definition: CORE_Array.h:323
#define ASSERT_IN(a)
Definition: types.h:96
const T & getValue(const tArrayIndex &i) const
get the value at index i Assert in (i>-1) Assert in (i
Definition: CORE_Array.h:197
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14