|
STK++ 1.0
|
Variable is an implementation of the Base class IVariable using The Array1D class for storing the data. More...
#include <STK_Variable.h>

Public Member Functions | |
| Variable (const Range &I=Range(), String const &name=Arithmetic< String >::NA()) | |
| Default constructor. | |
| Variable (Range const &I, TYPE const &v, String const &name=Arithmetic< String >::NA()) | |
| Misc constructor. | |
| Variable (Variable const &V, bool ref=false) | |
| Copy ctor. | |
| Variable (Variable const &V, Range const &I, Integer col) | |
| Reference constructor. | |
| virtual | ~Variable () |
| Virtual destructor. | |
| TYPE & | elt (Integer const &pos) |
| access to one element. | |
| TYPE const & | elt (Integer const &pos) const |
| access to one element const. | |
| Variable | elt (Range const &J) const |
| access to many elements. | |
| Variable & | operator= (Variable const &V) |
| Operator = : overwrite the Variable with V. | |
| Variable & | operator= (TYPE const &v) |
| Operator = : overwrite the Variable with the value v. | |
| virtual Variable * | clone (bool ref=false) const |
| clone return a ptr on a copy of the Object. | |
| void | pushBackNAValues (Integer const &n=1) |
| push back n NA values. | |
| virtual Integer | importString (const _VarStringType &V, std::ios_base &(*f)(std::ios_base &)=std::dec) |
| overwrite the Variable by converting the strings contained in V into the Type. | |
| virtual Variable const & | exportString (Variable< String > &V, std::ios_base &(*f)(std::ios_base &)=std::dec) const |
| Overwrite the variable V by converting the data into strings. | |
| virtual Variable & | operator<< (const Variable< String > &V) |
| Operator << : overwrite the IVariable by converting the strings contained in V into the Type. | |
| virtual Variable const & | operator>> (Variable< String > &V) const |
| Operator >> : convert the Variable V into strings. | |
Private Types | |
| typedef IArrayBase< TYPE * > | _IArrayBaseType |
| Type for the Base reference Class. | |
| typedef RecursiveArray1D< TYPE, Variable< TYPE > > | _IArray1DType |
| Type for the IArray1DBase Class. | |
Friends | |
| ostream & | operator<< (ostream &s, const Variable< TYPE > &V) |
| ostream for Variable. | |
Variable is an implementation of the Base class IVariable using The Array1D class for storing the data.
It implement all purely virtual methods defined in the IVariableBase and IVariable base classes.
Definition at line 55 of file STK_Variable.h.
typedef IArrayBase<TYPE*> STK::Variable< TYPE >::_IArrayBaseType [private] |
Type for the Base reference Class.
Reimplemented from STK::RecursiveArray1D< TYPE, Variable< TYPE > >.
Definition at line 59 of file STK_Variable.h.
typedef RecursiveArray1D<TYPE, Variable<TYPE> > STK::Variable< TYPE >::_IArray1DType [private] |
Type for the IArray1DBase Class.
Reimplemented from STK::RecursiveArray1D< TYPE, Variable< TYPE > >.
Definition at line 61 of file STK_Variable.h.
| STK::Variable< TYPE >::Variable | ( | const Range & | I = Range(), |
| String const & | name = Arithmetic<String>::NA() |
||
| ) | [inline] |
Default constructor.
| I | : range of the data |
| name | : name of the variable |
Definition at line 68 of file STK_Variable.h.
Referenced by STK::Variable< String >::clone(), and STK::Variable< String >::elt().
: IVariable(IdTypeImpl<TYPE>::returnType(), name) , _IArray1DType(I) { ;}
| STK::Variable< TYPE >::Variable | ( | Range const & | I, |
| TYPE const & | v, | ||
| String const & | name = Arithmetic<String>::NA() |
||
| ) | [inline] |
Misc constructor.
| I | : range of the data |
| name | : name of the variable |
| v | : initial value |
Definition at line 80 of file STK_Variable.h.
: IVariable(IdTypeImpl<TYPE>::returnType(), name) , _IArray1DType(I, v) { ;}
| STK::Variable< TYPE >::Variable | ( | Variable< TYPE > const & | V, |
| bool | ref = false |
||
| ) | [inline] |
Copy ctor.
| V | the Variable to copy |
| ref | true if we want to wrap V |
Definition at line 89 of file STK_Variable.h.
: IVariable(V) , _IArray1DType(V, ref) { ;}
| STK::Variable< TYPE >::Variable | ( | Variable< TYPE > const & | V, |
| Range const & | I, | ||
| Integer | col | ||
| ) | [inline] |
Reference constructor.
| V | the Variable to wrap |
| I | range of the data |
| col | the column of the data |
Definition at line 99 of file STK_Variable.h.
: IVariable(V) , _IArray1DType(V, I, col) { ;}
| virtual STK::Variable< TYPE >::~Variable | ( | ) | [inline, virtual] |
| TYPE& STK::Variable< TYPE >::elt | ( | Integer const & | pos | ) | [inline] |
access to one element.
| pos | index of the element |
Reimplemented from STK::ITContainer1D< TYPE, Variable< TYPE > >.
Definition at line 112 of file STK_Variable.h.
Referenced by STK::operator>>().
{ return this->data(pos);}
| TYPE const& STK::Variable< TYPE >::elt | ( | Integer const & | pos | ) | const [inline] |
access to one element const.
| pos | index of the const element |
Reimplemented from STK::ITContainer1D< TYPE, Variable< TYPE > >.
Definition at line 118 of file STK_Variable.h.
{ return this->data(pos);}
| Variable STK::Variable< TYPE >::elt | ( | Range const & | J | ) | const [inline] |
access to many elements.
| J | the range of the elements |
Reimplemented from STK::ITContainer1D< TYPE, Variable< TYPE > >.
Definition at line 124 of file STK_Variable.h.
| Variable& STK::Variable< TYPE >::operator= | ( | Variable< TYPE > const & | V | ) | [inline] |
Operator = : overwrite the Variable with V.
| V | the variable to copy |
Definition at line 142 of file STK_Variable.h.
{
IVariable *p3 = this; // convert this to IVariable
const IVariable *p4 = &V; // convert V to IVariable
(*p3) = (*p4); // use = of IVariable class
// check size
if (size()!=V.size()) resize(V.range());
// copy without ovelapping.
if (first() < V.first())
{ for (Integer i=first(), j=V.first(); j<=V.last(); i++, j++)
setData(i, V.data(j));
}
else
{ for (Integer i=last(), j=V.last(); j>=V.first(); i--, j--)
setData(i, V.data(j));
}
return *this;
}
| Variable& STK::Variable< TYPE >::operator= | ( | TYPE const & | v | ) | [inline] |
| virtual Variable* STK::Variable< TYPE >::clone | ( | bool | ref = false | ) | const [inline, virtual] |
clone return a ptr on a copy of the Object.
| ref | true if we want just a reference |
Implements STK::IVariable.
Definition at line 175 of file STK_Variable.h.
{ return new Variable(*this, ref);}
| void STK::Variable< TYPE >::pushBackNAValues | ( | Integer const & | n = 1 | ) | [inline, virtual] |
push back n NA values.
| n | number of NA values to add |
Implements STK::IVariable.
Definition at line 181 of file STK_Variable.h.
| virtual Integer STK::Variable< TYPE >::importString | ( | const _VarStringType & | V, |
| std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
| ) | [inline, virtual] |
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 |
Implements STK::IVariable.
Definition at line 192 of file STK_Variable.h.
Referenced by STK::ImportFromCsv::convertToTYPE().
| virtual Variable const& STK::Variable< TYPE >::exportString | ( | Variable< String > & | V, |
| std::ios_base &(*)(std::ios_base &) | f = std::dec |
||
| ) | const [inline, virtual] |
Overwrite the variable V by converting the data into strings.
| V | Variable of String |
| f | io flags |
Definition at line 212 of file STK_Variable.h.
| virtual Variable& STK::Variable< TYPE >::operator<< | ( | const Variable< String > & | V | ) | [inline, virtual] |
Operator << : overwrite the IVariable by converting the strings contained in V into the Type.
| V | the Variable of string to import |
Definition at line 230 of file STK_Variable.h.
| virtual Variable const& STK::Variable< TYPE >::operator>> | ( | Variable< String > & | V | ) | const [inline, virtual] |
ostream for Variable.
Definition at line 253 of file STK_Variable.h.