18 #ifndef __itkVariableLengthVector_h
19 #define __itkVariableLengthVector_h
75 template<
typename TValue >
103 bool LetArrayManageMemory =
false);
112 bool LetArrayManageMemory =
false);
123 template<
typename T >
141 void Fill(TValue
const & v);
144 template<
typename T >
148 if (
m_Data == static_cast< void * >( const_cast< T * >
194 void SetSize(
unsigned int sz,
bool destroyExistingData =
true);
207 void SetData(TValue *data,
bool LetArrayManageMemory =
false);
218 void SetData(TValue *data,
unsigned int sz,
bool LetArrayManageMemory =
false);
243 template<
typename T >
258 result[i] = ( *this )[i] +
static_cast< ValueType >( v[i] );
270 template<
typename T >
285 result[i] = ( *this )[i] -
static_cast< ValueType >( v[i] );
294 template<
typename T >
310 template<
typename T >
319 / static_cast< RealValueType >( s ) );
331 result[i] =
m_Data[i] + s;
343 result[i] =
m_Data[i] - s;
399 template<
typename T >
400 inline Self &
operator-=
429 template<
typename T >
430 inline Self &
operator+=
455 template<
typename T >
470 template<
typename T >
477 / static_cast< RealValueType >( s ) );
507 template<
typename TValue,
typename T >
512 return v.operator*(scalar);
516 template<
typename TValue >
517 std::ostream & operator<<(std::ostream & os, const VariableLengthVector< TValue > & arr)
519 const unsigned int length = arr.
Size();
520 const signed int last = (
unsigned int)length - 1;
523 for (
signed int i = 0; i < last; ++i )
525 os << arr[i] <<
", ";
538 #ifndef ITK_MANUAL_INSTANTIATION
539 #include "itkVariableLengthVector.hxx"
void Reserve(ElementIdentifier)
TValue & operator[](unsigned int i)
Self operator+(TValue s) const
unsigned int Size(void) const
VariableLengthVector(const VariableLengthVector< T > &v)
unsigned int GetNumberOfElements(void) const
bool operator==(const Self &v) const
CovariantVector< T, NVectorDimension > operator*(const T &scalar, const CovariantVector< T, NVectorDimension > &v)
Self operator/(T s) const
RealValueType GetNorm() const
void SetElement(unsigned int i, const TValue &value)
RealValueType GetSquaredNorm() const
Self operator+(const VariableLengthVector< T > &v) const
const TValue & GetElement(unsigned int i) const
Self operator-(const VariableLengthVector< T > &v) const
bool operator!=(const Self &v) const
const TValue * GetDataPointer() const
unsigned int GetSize(void) const
Self operator-(TValue s) const
Represents an array whose length can be defined at run-time.
TValue * AllocateElements(ElementIdentifier size) const
VariableLengthVector Self
Self operator*(T s) const
ElementIdentifier m_NumElements
void DestroyExistingData()
Self & operator-=(TValue s)
bool m_LetArrayManageMemory
void SetSize(unsigned int sz, bool destroyExistingData=true)
Self & operator+=(TValue s)
NumericTraits< ValueType >::RealType RealValueType
void SetData(TValue *data, bool LetArrayManageMemory=false)
void Fill(TValue const &v)
unsigned int ElementIdentifier
const VariableLengthVector< TValue > & operator=(const VariableLengthVector< T > &v)
TValue const & operator[](unsigned int i) const