40 #ifndef __OPENFLUID_CORE_VECTOR_HPP__
41 #define __OPENFLUID_CORE_VECTOR_HPP__
49 namespace openfluid {
namespace core {
71 bool allocate(
unsigned long Size);
93 Vector(
unsigned long Size);
98 Vector(
unsigned long Size, T InitValue);
103 Vector(T* Data,
unsigned long Size);
122 {
return getSize(); };
127 T*
data()
const {
return m_Data; };
132 void setData(T* Data,
unsigned long Size);
137 T getElement(
unsigned long Index)
const;
142 inline T
at(
unsigned long Index)
const {
return getElement(Index); };
147 inline T
get(
unsigned long Index)
const {
return getElement(Index); };
153 void setElement(
unsigned long Index, T Element);
158 inline void set(
unsigned long Index, T Element) { setElement(Index,Element); };
164 T& operator[](
unsigned long Index);
174 void fill(
const T& Val);
187 {
return &m_Data[0]; }
194 {
return &m_Data[0]; }
201 {
return &m_Data[m_Size]; }
208 {
return &m_Data[m_Size]; }
270 for (i=0;i<m_Size;i++) m_Data[i] = InitValue;
287 std::copy(Data, Data + Size, m_Data);
298 if (m_Data != NULL) clear();
312 m_Data =
new T[Size];
335 std::copy(Data, Data + Size, m_Data);
349 return m_Data[Index];
362 m_Data[Index] = Element;
376 return m_Data[Index];
387 if (
this == &A)
return *
this;
417 std::fill(m_Data, m_Data + m_Size,Val);
442 for (
unsigned long i = 0; i < Source.
m_Size;i++)
Definition: Vector.hpp:56
void init()
Definition: Vector.hpp:403
unsigned long getSize() const
Definition: Vector.hpp:114
~Vector()
Definition: Vector.hpp:296
iterator begin()
Definition: Vector.hpp:186
T * m_Data
Definition: Vector.hpp:67
void fill(const T &Val)
Definition: Vector.hpp:415
T * iterator
Definition: Vector.hpp:60
void clear()
Definition: Vector.hpp:426
const_iterator begin() const
Definition: Vector.hpp:193
Vector< T > & operator=(const Vector &A)
Definition: Vector.hpp:385
unsigned long size() const
Definition: Vector.hpp:121
bool allocate(unsigned long Size)
Definition: Vector.hpp:307
const_iterator end() const
Definition: Vector.hpp:207
T getElement(unsigned long Index) const
Definition: Vector.hpp:344
Definition: FrameworkException.hpp:50
static void copy(const Vector &Source, Vector &Dest)
Definition: Vector.hpp:438
T * data() const
Definition: Vector.hpp:127
T & operator[](unsigned long Index)
Definition: Vector.hpp:371
Vector()
Definition: Vector.hpp:218
void set(unsigned long Index, T Element)
Definition: Vector.hpp:158
void setData(T *Data, unsigned long Size)
Definition: Vector.hpp:328
T at(unsigned long Index) const
Definition: Vector.hpp:142
void setElement(unsigned long Index, T Element)
Definition: Vector.hpp:358
#define OPENFLUID_API
Definition: dllexport.hpp:87
const T * const_iterator
Definition: Vector.hpp:62
iterator end()
Definition: Vector.hpp:200
unsigned long m_Size
Definition: Vector.hpp:69