18 #ifndef __itkVariableLengthVector_h
19 #define __itkVariableLengthVector_h
75 template<
typename TValueType >
103 bool LetArrayManageMemory =
false);
112 bool LetArrayManageMemory =
false);
123 template<
typename T >
141 void Fill(TValueType
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(TValueType *data,
bool LetArrayManageMemory =
false);
218 void SetData(TValueType *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 TValueType,
typename T >
515 template<
typename TValueType >
516 std::ostream & operator<<(std::ostream & os, const VariableLengthVector< TValueType > & arr)
518 const unsigned int length = arr.
Size();
519 const signed int last = (
unsigned int)length - 1;
522 for (
signed int i = 0; i < last; ++i )
524 os << arr[i] <<
", ";
537 #ifndef ITK_MANUAL_INSTANTIATION
538 #include "itkVariableLengthVector.hxx"
TValueType * AllocateElements(ElementIdentifier size) const
NumericTraits< ValueType >::RealType RealValueType
RealValueType GetSquaredNorm() const
VariableLengthVector Self
ElementIdentifier m_NumElements
void SetElement(unsigned int i, const TValueType &value)
CovariantVector< T, NVectorDimension > operator*(const T &scalar, const CovariantVector< T, NVectorDimension > &v)
const TValueType * GetDataPointer() const
RealValueType GetNorm() const
bool operator==(const Self &v) const
Self operator*(T s) const
Self & operator+=(TValueType s)
Represents an array whose length can be defined at run-time.
const TValueType & GetElement(unsigned int i) const
void SetData(TValueType *data, bool LetArrayManageMemory=false)
Self operator+(TValueType s) const
unsigned int GetSize(void) const
TValueType const & operator[](unsigned int i) const
const VariableLengthVector< TValueType > & operator=(const VariableLengthVector< T > &v)
unsigned int Size(void) const
bool operator!=(const Self &v) const
Self operator+(const VariableLengthVector< T > &v) const
void SetSize(unsigned int sz, bool destroyExistingData=true)
Self operator-(TValueType s) const
void DestroyExistingData()
bool m_LetArrayManageMemory
Self operator-(const VariableLengthVector< T > &v) const
Self & operator-=(TValueType s)
VariableLengthVector(const VariableLengthVector< T > &v)
unsigned int ElementIdentifier
Self operator/(T s) const
TValueType & operator[](unsigned int i)
void Reserve(ElementIdentifier)
void Fill(TValueType const &v)
unsigned int GetNumberOfElements(void) const