STK++ 0.9.13
|
Variable is an implementation of the Base class IVariable using The Array1D class for storing the data. More...
#include <STK_Variable.h>
Public Types | |
enum | { structure_ = hidden::Traits< Variable<Type_> >::structure_ , orient_ = hidden::Traits< Variable<Type_> >::orient_ , size_ = hidden::Traits< Variable<Type_> >::size_ , sizeCols_ = hidden::Traits< Variable<Type_> >::sizeCols_ , sizeRows_ = hidden::Traits< Variable<Type_> >::sizeRows_ , storage_ = hidden::Traits< Variable<Type_> >::storage_ } |
typedef Variable< Type_ > | Row |
typedef Variable< Type_ > | Col |
typedef Variable< Type_ > | SubRow |
typedef Variable< Type_ > | SubCol |
typedef Variable< Type_ > | SubArray |
typedef Variable< Type_ > | SubVector |
typedef hidden::Traits< Variable< Type_ > >::Type | Type |
typedef hidden::Traits< Variable< Type_ > >::TypeConst | TypeConst |
typedef hidden::Traits< Variable< Type_ > >::Allocator | Allocator |
typedef IArray1D< Variable< Type_ > > | Base |
![]() | |
enum | |
typedef ITContainer1D< Variable< Type_ > > | Base |
typedef hidden::Traits< Variable< Type_ > >::Allocator | Allocator |
typedef hidden::Traits< Variable< Type_ > >::Type | Type |
typedef hidden::Traits< Variable< Type_ > >::TypeConst | TypeConst |
typedef hidden::Traits< Variable< Type_ > >::RowRange | RowRange |
typedef hidden::Traits< Variable< Type_ > >::ColRange | ColRange |
typedef hidden::Traits< Variable< Type_ > >::Iterator | Iterator |
typedef hidden::Traits< Variable< Type_ > >::ConstIterator | ConstIterator |
typedef hidden::Traits< Variable< Type_ > >::ReverseIterator | ReverseIterator |
typedef hidden::Traits< Variable< Type_ > >::ConstReverseIterator | ConstReverseIterator |
![]() | |
enum | { size_ = hidden::Traits<Derived>::size_ } |
typedef hidden::Traits< Derived >::Type | Type |
typedef hidden::Traits< Derived >::TypeConst | TypeConst |
typedef hidden::Traits< Derived >::RowRange | RowRange |
typedef hidden::Traits< Derived >::ColRange | ColRange |
typedef hidden::Traits< Derived >::Row | Row |
typedef hidden::Traits< Derived >::Col | Col |
typedef hidden::Traits< Derived >::SubVector | SubVector |
typedef hidden::Traits< Derived >::Iterator | Iterator |
typedef hidden::Traits< Derived >::ConstIterator | ConstIterator |
typedef hidden::Traits< Derived >::ReverseIterator | ReverseIterator |
typedef hidden::Traits< Derived >::ConstReverseIterator | ConstReverseIterator |
Public Member Functions | |
Variable (String const &name=stringNa) | |
default constructor | |
Variable (int size, String const &name=stringNa) | |
constructor | |
Variable (Range const &I, String const &name=stringNa) | |
Default constructor. | |
Variable (Range const &I, Type_ const &v, String const &name) | |
constructor with specified initial value | |
Variable (Variable const &V, bool ref=false) | |
copy/reference constructor. | |
Variable (Variable const &V, Range const &I, bool ref=true) | |
reference constructor | |
template<class OtherArray > | |
Variable (IArray1D< OtherArray > const &T) | |
constructor by reference, ref_=1. | |
~Variable () | |
destructor. | |
virtual Variable * | clone (bool ref=false) const |
clone return a ptr on a copy of the Object. | |
void | shift1D (int rbeg) |
New first index for the object. | |
Variable< Type_ > & | resize1D (Range const &I) |
Resize the container. | |
virtual void | popBack (int n=1) |
remove n elements to the end of the container | |
void | pushBack (int n=1) |
Add n elements to the container. | |
void | push_back (Type_ const &v) |
Add an element to the container. | |
void | insertElt (int pos, int n=1) |
Insert n elements at the position pos of the container. | |
Variable & | operator= (Variable const &V) |
operator = : overwrite the CArray with the Right hand side T. | |
Variable & | operator= (Type_ const &v) |
set the container to a constant value. | |
void | move (Variable const &V) |
move the variable in this | |
void | encode () |
encode values as ints. | |
int | maxLength (bool with_name) const |
int | nbMiss () const |
virtual int | size () const |
virtual void | clear () |
clear Container from all elements and memory allocated. | |
virtual void | erase (int pos, int n=1) |
Delete n elements at the pos index from the container. | |
virtual void | shift (int beg) |
New first index for the object. | |
virtual void | pushBackNAValues (int n=1) |
push back n NA values. | |
virtual void | exportAsString (Variable< String > &V) const |
Overwrite the variable V by converting the data into strings. | |
virtual Variable & | operator<< (Variable< String > const &V) |
Operator << : overwrite the Variable by converting the Strings contained in V into the Type_. | |
virtual Variable< Type_ > const & | operator>> (Variable< String > &V) const |
Operator >> : convert the Variable V into strings. | |
int | importFromString (Variable< String > const &V, std::ios_base &(*f)(std::ios_base &)=std::dec) |
overwrite the Variable by converting the strings contained in V into the Type_. | |
void | pushBackNAValues (int n) |
push back n NA values. | |
int | importFromString (Variable< String > const &V, std::ios_base &(*f)(std::ios_base &)) |
overwrite the Variable by converting the strings contained in V into the Type_. | |
void | exportAsString (Variable< String > &V) const |
Overwrite the variable V by converting the data into strings. | |
Variable< String > & | operator<< (Variable< String > const &V) |
Operator << : overwrite the Variable by converting the strings contained in V into the String. | |
Variable< String > const & | operator>> (Variable< String > &V) const |
Operator >> : convert the Variable V into strings. | |
![]() | |
virtual | ~IVariable () |
destructor. | |
IVariable & | operator= (const IVariable &V) |
Operator = : overwrite the IVariable with T. | |
const Base::IdType & | getType () const |
String const & | name () const |
void | setName (int num=0, String const &prefix=STRING_VAR) |
Set a default name for the variable of the form : prefix + num. | |
void | setName (String const &name) |
Set the name of the variable. | |
template<class Type > | |
String | eltAsString (int pos) const |
virtual void | exportAsString (VariableString &V) const =0 |
Overwrite the variable V by converting the data into strings. | |
virtual IVariable & | operator<< (VariableString const &V)=0 |
Operator << : overwrite the IVariable by converting the strings contained in V into the Type. | |
virtual const IVariable & | operator>> (VariableString &V) const =0 |
Operator >> : convert the Variable V into strings. | |
![]() | |
bool | isRef () const |
void | setRef (bool ref) const |
Modify the state of the container: this become a reference (if ref is true ) or the owner of the data (if ref is false ). | |
Allocator const & | allocator () const |
RowRange const & | rows () const |
int | beginRows () const |
int | endRows () const |
int | sizeRows () const |
ColRange | cols () const |
int | beginCols () const |
int | endCols () const |
int | sizeCols () const |
int | lastIdxRows () const |
int | lastIdxCols () const |
int | capacity () const |
Type & | elt1Impl (int pos) |
access to an element | |
TypeConst | elt1Impl (int pos) const |
access to a constant element | |
Variable< Type_ > & | setValue (Type const &value) |
set a value to this container. | |
void | setValue (int pos, TypeConst value) |
Write a value at a given position. | |
void | shiftImpl (int beg=baseIdx) |
New beginning index for the object. | |
Variable< Type_ > & | resizeImpl (Range const &I) |
Resize the container. | |
void | reserve (int size) |
reserve internal memory for at least size elements. | |
void | clear () |
Clear the object. | |
void | move (Variable< Type_ > const &T) |
move T to this. | |
Variable< Type_ > & | pushBack (int n=1) |
Add n Elements to the end of the container. | |
Variable< Type_ > & | popBack (int n=1) |
Delete last elts of the container. | |
Variable< Type_ > & | erase (int pos, int n=1) |
Delete n elements at the pos index to the container. | |
Variable< Type_ > & | insertElt (int pos, int n=1) |
Insert n elements at the position pos of the container. | |
Variable< Type_ > & | insert (int pos, Type const &v) |
STL compatibility: Insert element v at position pos of the Array. | |
Variable< Type_ > & | insert (Range const &I, Type const &v) |
STL compatibility: Insert element v in the range I of the Array. | |
Variable< Type_ > & | push_front (Type const &v) |
STL compatibility: push front an element. | |
Variable< Type_ > & | push_back (Type const &v) |
STL compatibility: append an element v. | |
void | swap (int pos1, int pos2) |
Swapping the pos1 elt and the pos2 elt. | |
void | exchange (IArray1D &T) |
exchange this Container with T. | |
Variable< Type_ > & | assign (IArray1D const &src) |
overwrite this with src . | |
void | memmove (int pos1, int pos2, int n) |
Copy n elements from pos2 to pos1, guaranteeing correct behavior for overlapping. | |
RowRange const & | range () const |
int | begin () const |
int | end () const |
int | size () const |
int | lastIdx () const |
void | decLast (int n=1) |
decrement the end of the container. | |
void | incLast (int n=1) |
increment the end of the container (can be negative). | |
void | incRange (int n=1) |
increment the range of the container (can be negative). | |
void | setRange (RowRange const &I=RowRange()) |
Set range of the rows of the container. | |
Type & | elt (int i) |
TypeConst | elt (int i) const |
![]() | |
RowRange const & | range () const |
int | begin () const |
int | end () const |
int | size () const |
int | lastIdx () const |
Iterator | beginIterator () |
Iterator | endIterator () |
ConstIterator | beginConstIterator () const |
ConstIterator | endConstIterator () const |
ReverseIterator | rbeginIterator () |
ReverseIterator | rendIterator () |
ConstReverseIterator | rbeginConstIterator () const |
ConstReverseIterator | rendConstIterator () const |
bool | empty () const |
Is there some data ? | |
Type & | elt (int i) |
TypeConst | elt (int i) const |
Type & | operator[] (int i) |
TypeConst | operator[] (int i) const |
Type & | at (int i) |
TypeConst | at (int i) const |
SubVector | sub (Range const &I) const |
Access to many elements. | |
Type & | front () |
TypeConst | front () const |
Type & | back () |
TypeConst | back () const |
void | shift (int beg) |
Derived & | resize (Range const &I=RowRange()) |
![]() | |
Derived & | asDerived () |
static cast : return a reference of this with a cast to the derived class. | |
Derived const & | asDerived () const |
static cast : return a const reference of this with a cast to the derived class. | |
Derived * | asPtrDerived () |
static cast : return a ptr on a Derived of this with a cast to the derived class. | |
Derived const * | asPtrDerived () const |
static cast : return a ptr on a constant Derived of this with a cast to the derived class. | |
Derived * | clone () const |
create a leaf using the copy constructor of the Derived class. | |
Derived * | clone (bool isRef) const |
create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not. | |
Protected Attributes | |
std::map< Type_, int > | coding_ |
store the map String <-> int | |
![]() | |
const Base::IdType | type_ |
Id Type of the variable. | |
String | name_ |
Name of the variable. | |
Additional Inherited Members | |
![]() | |
static String | giveName (int num=0, String const &prefix=STRING_VAR) |
![]() | |
IVariable (Base::IdType const &type, String const &name) | |
Default constructor. | |
IVariable (const IVariable &V) | |
Copy constructor | |
![]() | |
IArray1D () | |
Default constructor. | |
IArray1D (Range const &I) | |
constructor with a specified Range. | |
IArray1D (Range const &I, Type const &v) | |
Misc constructor with first and last, initialization with a constant. | |
IArray1D (IArray1D const &T, bool ref) | |
Copy constructor. | |
IArray1D (IArray1D< OtherDerived > const &T, bool ref) | |
Copy constructor. | |
IArray1D (IArray1D< OtherDerived > const &T, RowRange const &I, bool ref) | |
copy constructor. | |
IArray1D (Allocator const &A, Range const &I, bool ref) | |
Wrapper constructor. | |
~IArray1D () | |
destructor: allocated memory is liberated by MemAllocator class. | |
Allocator & | allocator () |
void | initialize (RowRange const &I) |
function for memory allocation and initialization. | |
void | allocate (RowRange const &I) |
function for memory allocation. | |
void | freeMem () |
Method for memory deallocation. | |
![]() | |
ITContainer1D () | |
Default constructor. | |
ITContainer1D (RowRange const &I) | |
constructor with a specified range. | |
~ITContainer1D () | |
destructor. | |
void | exchange (ITContainer1D &T) |
exchange this container with T | |
void | setRange (RowRange const &I=RowRange()) |
Set range of the rows of the container. | |
void | incRange (int n=1) |
increment the range of the container (can be negative). | |
void | incFirst (int n=1) |
increment the beginning of the container (can be negative). | |
void | decFirst (int n=1) |
decrement the beginning of the container. | |
void | incLast (int n=1) |
increment the end of the container (can be negative). | |
void | decLast (int n=1) |
decrement the end of the container. | |
![]() | |
IRecursiveTemplate () | |
constructor. | |
~IRecursiveTemplate () | |
destructor. | |
Variable is an implementation of the Base class IVariable using The Array1D class for storing the data.
It implements all purely virtual methods defined in the IVariable base class.
Definition at line 95 of file STK_Variable.h.
typedef hidden::Traits<Variable<Type_>>::Allocator STK::Variable< Type_ >::Allocator |
Definition at line 119 of file STK_Variable.h.
typedef IArray1D< Variable<Type_> > STK::Variable< Type_ >::Base |
Definition at line 122 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::Col |
Definition at line 100 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::Row |
Definition at line 99 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::SubArray |
Definition at line 103 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::SubCol |
Definition at line 102 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::SubRow |
Definition at line 101 of file STK_Variable.h.
typedef Variable<Type_> STK::Variable< Type_ >::SubVector |
Definition at line 104 of file STK_Variable.h.
typedef hidden::Traits<Variable<Type_>>::Type STK::Variable< Type_ >::Type |
Definition at line 106 of file STK_Variable.h.
typedef hidden::Traits<Variable<Type_>>::TypeConst STK::Variable< Type_ >::TypeConst |
Definition at line 107 of file STK_Variable.h.
Enumerator | |
---|---|
structure_ | |
orient_ | |
size_ | |
sizeCols_ | |
sizeRows_ | |
storage_ |
Definition at line 109 of file STK_Variable.h.
|
inlineexplicit |
default constructor
name | name of the variable |
Definition at line 128 of file STK_Variable.h.
|
inlineexplicit |
constructor
size,name | size and name of the variable |
Definition at line 135 of file STK_Variable.h.
|
inlineexplicit |
Default constructor.
I,name | range and name of the variable |
Definition at line 142 of file STK_Variable.h.
|
inline |
constructor with specified initial value
I,v | range of the data and initial value |
name | name of the variable |
Definition at line 150 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::setValue().
|
inlineexplicit |
copy/reference constructor.
V | the Variable to copy |
ref | true if we want to wrap V |
Definition at line 158 of file STK_Variable.h.
|
inlineexplicit |
reference constructor
V,I | Variable and range to wrap |
ref | true if we want to wrap V |
Definition at line 166 of file STK_Variable.h.
|
inline |
constructor by reference, ref_=1.
T | the container to wrap |
Definition at line 173 of file STK_Variable.h.
|
inline |
|
inlinevirtual |
clear Container from all elements and memory allocated.
Implements STK::IVariable.
Definition at line 260 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::clear().
|
inlinevirtual |
clone return a ptr on a copy of the Object.
ref | true if we want just a reference |
Implements STK::IVariable.
Definition at line 182 of file STK_Variable.h.
|
inline |
encode values as ints.
Not used yet.
Definition at line 236 of file STK_Variable.h.
References STK::baseIdx, STK::IArray1D< Variable< Type_ > >::begin(), STK::Variable< Type_ >::coding_, STK::IArray1D< Variable< Type_ > >::elt(), and STK::IArray1D< Variable< Type_ > >::end().
|
inlinevirtual |
Delete n elements at the pos
index from the container.
pos | index where to delete elements |
n | number of elements to delete (default 1) |
Implements STK::IVariable.
Definition at line 265 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::erase().
|
inlinevirtual |
Overwrite the variable V by converting the data into strings.
V | Variable of String |
Definition at line 375 of file STK_Variable.h.
|
inline |
Overwrite the variable V by converting the data into strings.
V | Variable of String |
Definition at line 369 of file STK_Variable.h.
|
inline |
overwrite the Variable by converting the strings contained in V into the Type_.
Give the number of success.
V | Variable of String |
f | io flags |
Definition at line 340 of file STK_Variable.h.
|
inline |
overwrite the Variable by converting the strings contained in V into the Type_.
V | Variable of String |
f | io flags |
Definition at line 351 of file STK_Variable.h.
References STK::Arithmetic< Type >::NA(), and STK::stringNa.
|
inlinevirtual |
Insert n elements at the position pos of the container.
The bound end_ should be modified at the very end of the insertion as pos can be a reference to it.
pos,n | index and number of elements to insert |
Implements STK::IVariable.
Definition at line 213 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::insertElt().
|
inline |
Definition at line 245 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::begin(), STK::IArray1D< Variable< Type_ > >::end(), STK::IVariable::name(), and STK::Variable< Type_ >::size().
|
inline |
move the variable in this
V | variable to move in this |
Definition at line 231 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::move(), and STK::IVariable::name_.
int STK::Variable< Type_ >::nbMiss | ( | ) | const |
Definition at line 304 of file STK_Variable.h.
|
inlinevirtual |
Operator << : overwrite the Variable by converting the Strings contained in V into the Type_.
V | the Variable of string to import |
Definition at line 375 of file STK_Variable.h.
Operator << : overwrite the Variable by converting the strings contained in V into the String.
V | the Variable of string to import |
Definition at line 375 of file STK_Variable.h.
|
inline |
set the container to a constant value.
v | the value to set |
Definition at line 226 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::setValue().
|
inline |
operator = : overwrite the CArray with the Right hand side T.
V | the container to copy |
Definition at line 218 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::assign(), and STK::IVariable::name_.
|
inlinevirtual |
Operator >> : convert the Variable V into strings.
V | Variable of String |
Definition at line 421 of file STK_Variable.h.
|
inlinevirtual |
remove n elements to the end of the container
n | number of element to remove |
Implements STK::IVariable.
Definition at line 196 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::popBack().
|
inline |
Add an element to the container.
v | the element to add |
Definition at line 204 of file STK_Variable.h.
References STK::ITContainer1D< Derived >::back(), and STK::IArray1D< Variable< Type_ > >::pushBack().
|
inlinevirtual |
Add n elements to the container.
n | number of elements to add |
Implements STK::IVariable.
Definition at line 200 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::pushBack().
|
inlinevirtual |
push back n NA values.
Specialization for Type_ = String.
n | number of NA values to add |
Implements STK::IVariable.
Definition at line 316 of file STK_Variable.h.
References STK::stringNa.
|
inlinevirtual |
push back n NA values.
n | number of NA values to add |
Implements STK::IVariable.
Definition at line 326 of file STK_Variable.h.
References STK::Arithmetic< Type >::NA().
|
inline |
Resize the container.
I | the range to set to the container |
Definition at line 191 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::cols(), and STK::ITContainer1D< Derived >::resize().
|
inlinevirtual |
New first index for the object.
beg | the index of the first column to set |
Implements STK::IVariable.
Definition at line 269 of file STK_Variable.h.
References STK::ITContainer1D< Derived >::shift().
|
inline |
New first index for the object.
rbeg | the index of the first row to set |
Definition at line 187 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::beginCols(), and STK::ITContainer1D< Derived >::shift().
|
inlinevirtual |
Implements STK::IVariable.
Definition at line 258 of file STK_Variable.h.
References STK::IArray1D< Variable< Type_ > >::size().
Referenced by STK::Variable< Type_ >::maxLength().
|
protected |
store the map String <-> int
Definition at line 299 of file STK_Variable.h.
Referenced by STK::Variable< Type_ >::encode().