34 #ifndef __VECTOR_HPP__
35 #define __VECTOR_HPP__
43 namespace openfluid {
namespace core {
56 bool allocate(
unsigned long Size);
77 Vector(
unsigned long Size);
82 Vector(
unsigned long Size, T InitValue);
87 Vector(T* Data,
unsigned long Size);
98 unsigned long getSize()
const {
return m_Size; };
104 unsigned long size()
const {
return getSize(); };
114 void setData(T* Data,
unsigned long Size);
119 T getElement(
unsigned long Index)
const;
124 inline T
at(
unsigned long Index)
const {
return getElement(Index); };
129 inline T
get(
unsigned long Index)
const {
return getElement(Index); };
135 void setElement(
unsigned long Index, T Element);
140 inline void set(
unsigned long Index, T Element) { setElement(Index,Element); };
146 T& operator[](
unsigned long Index);
156 void fill(
const T& Val);
218 for (i=0;i<m_Size;i++) m_Data[i] = InitValue;
235 std::copy(Data, Data + Size, m_Data);
246 if (m_Data != NULL) clear();
259 m_Data =
new T[Size];
260 if (m_Data != NULL) m_Size = Size;
282 if (m_Data != NULL) std::copy(Data, Data + Size, m_Data);
294 return m_Data[Index];
305 m_Data[Index] = Element;
317 return m_Data[Index];
327 if (
this == &A)
return *
this;
356 std::fill(m_Data, m_Data + m_Size,Val);
379 for (
unsigned long i = 0; i < Source.
m_Size;i++)
void fill(const T &Val)
Definition: Vector.hpp:354
void setData(T *Data, unsigned long Size)
Definition: Vector.hpp:276
unsigned long size() const
Definition: Vector.hpp:104
unsigned long getSize() const
Definition: Vector.hpp:98
void setElement(unsigned long Index, T Element)
Definition: Vector.hpp:302
static void copy(const Vector &Source, Vector &Dest)
Definition: Vector.hpp:375
void clear()
Definition: Vector.hpp:365
~Vector()
Definition: Vector.hpp:244
Vector< T > & operator=(const Vector &A)
Definition: Vector.hpp:324
Definition: FrameworkException.hpp:49
T & operator[](unsigned long Index)
Definition: Vector.hpp:314
bool allocate(unsigned long Size)
Definition: Vector.hpp:254
void init()
Definition: Vector.hpp:342
T * m_Data
Definition: Vector.hpp:53
T getElement(unsigned long Index) const
Definition: Vector.hpp:291
void set(unsigned long Index, T Element)
Definition: Vector.hpp:140
T at(unsigned long Index) const
Definition: Vector.hpp:124
unsigned long m_Size
Definition: Vector.hpp:54
Vector()
Definition: Vector.hpp:170
T * getData() const
Definition: Vector.hpp:109
Definition: Vector.hpp:50
#define DLLEXPORT
Definition: dllexport.hpp:51