STK::IVariable Class Reference
[project DManager (Data Management)]

IVariable is an Interface class for all Variables classes. More...

#include <STK_IVariable.h>

Inherited by STK::Variable< TYPE >, and STK::Variable< String >.

List of all members.

Public Types

typedef Variable< String_VarStringType

Public Member Functions

virtual ~IVariable ()
IVariableoperator= (const IVariable &V)
const IdTypegetType () const
const StringgetName () const
void setName (const Integer &num=0, const String &prefix=STRING_VAR)
void setName (const String &name)
virtual Integer size () const =0
 Number of elements.
virtual Integer first () const =0
 Index of the first element.
virtual Integer last () const =0
 Index of the last element.
virtual void shift (const Integer &beg=1)=0
virtual void pushBackElts (const Integer &n=1)=0
virtual void insertElts (const Integer &pos, const Integer &n=1)=0
virtual void popBackElts (const Integer &n=1)=0
virtual void eraseElts (const Integer &pos, const Integer &n=1)=0
virtual void resize (const Inx &I=Inx())=0
virtual void erase (const Integer &pos)=0
virtual void erase (const Inx &I)=0
virtual void pop_back ()=0
virtual void pop_front ()=0
virtual void setNA (const Integer &pos, const Integer &n=1)=0
virtual void pushBackNA (const Integer &n=1)=0
virtual void insertNA (const Integer &pos, const Integer &n=1)=0
virtual IVariableimportString (Integer &nsuccess, const _VarStringType &V, std::ios_base &(*f)(std::ios_base &)=std::dec)=0
virtual const IVariableexportString (_VarStringType &V, std::ios_base &(*f)(std::ios_base &)=std::dec) const =0
virtual IVariableoperator<< (const _VarStringType &V)=0
virtual const IVariableoperator>> (_VarStringType &V) const =0
virtual IVariableclone (const bool &ref=false) const =0

Static Public Member Functions

static String giveName (const Integer &num=0, const String &prefix=STRING_VAR)

Protected Member Functions

 IVariable (const IdType &type, const String &name)
 IVariable (const IVariable &V)

Protected Attributes

const IdType type_
String name_


Detailed Description

A Variable have a name and a type, the implementation have to choose some one-dimensional container class derived from ITContainer1D for storing the data.

Definition at line 63 of file STK_IVariable.h.


Member Typedef Documentation

type Variable of String (used for exporting the variable).

Definition at line 89 of file STK_IVariable.h.


Constructor & Destructor Documentation

STK::IVariable::IVariable ( const IdType type,
const String name 
) [inline, protected]

Default Ctor.

Definition at line 75 of file STK_IVariable.h.

00076              : type_(type)
00077              , name_(name)
00078     { ;}

STK::IVariable::IVariable ( const IVariable V  )  [inline, protected]

Copy Ctor.

Definition at line 82 of file STK_IVariable.h.

00083              : type_(V.type_)
00084              , name_(V.name_)
00085     { ;}

virtual STK::IVariable::~IVariable (  )  [inline, virtual]

Dtor.

Definition at line 92 of file STK_IVariable.h.

00092 { ;}


Member Function Documentation

IVariable& STK::IVariable::operator= ( const IVariable V  )  [inline]

Operator = : overwrite the IVariable with T.

Definition at line 97 of file STK_IVariable.h.

References name_.

00098     {
00099       name_ = V.name_;  // copy name_ of the variable
00100       return *this;
00101     }

static String STK::IVariable::giveName ( const Integer num = 0,
const String prefix = STRING_VAR 
) [inline, static]

Return a default name for variable of the form : prefix + num.

Definition at line 107 of file STK_IVariable.h.

00110    { return (prefix+typeToString<Integer> (num));}

const IdType& STK::IVariable::getType (  )  const [inline]

Get the type of the variable.

Definition at line 115 of file STK_IVariable.h.

References type_.

00116     { return type_;}

const String& STK::IVariable::getName (  )  const [inline]

void STK::IVariable::setName ( const Integer num = 0,
const String prefix = STRING_VAR 
) [inline]

Set a default name for variable of the form : prefix + num.

Definition at line 125 of file STK_IVariable.h.

References name_.

Referenced by STK::Variable< String >::exportString(), STK::Variable< String >::importString(), STK::Variable< String >::operator<<(), and STK::Variable< String >::operator>>().

00128     { name_ = (prefix+typeToString<Integer> (num));}

void STK::IVariable::setName ( const String name  )  [inline]

Set the name of the variable.

Definition at line 131 of file STK_IVariable.h.

References name_.

00132    { name_ = name;}

virtual Integer STK::IVariable::size (  )  const [pure virtual]

New first index for the object.

Parameters:
beg the index of the first column to set

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::insertVariable(), and STK::DataFrame::pushBackVariable().

virtual Integer STK::IVariable::first (  )  const [pure virtual]

virtual Integer STK::IVariable::last (  )  const [pure virtual]

virtual void STK::IVariable::shift ( const Integer beg = 1  )  [pure virtual]

New first index for the object.

Parameters:
beg the index of the first column to set

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::insertDataFrame(), STK::DataFrame::insertVariable(), STK::DataFrame::pushBackDataFrame(), STK::DataFrame::pushBackVariable(), and STK::DataFrame::shift().

virtual void STK::IVariable::pushBackElts ( const Integer n = 1  )  [pure virtual]

Add n Elts to the container.

Parameters:
n number of elements to add

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::pushBackRows().

virtual void STK::IVariable::insertElts ( const Integer pos,
const Integer n = 1 
) [pure virtual]

Insert n elts at the position pos of the container.

Parameters:
pos index where to insert elements
n number of elements to insert (default 1)

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::insertRows().

virtual void STK::IVariable::popBackElts ( const Integer n = 1  )  [pure virtual]

Delete last elts of the container.

Parameters:
n number of elts to delete

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::popBackRows().

virtual void STK::IVariable::eraseElts ( const Integer pos,
const Integer n = 1 
) [pure virtual]

Delete n elts at the pos index to the container.

Parameters:
pos index where to delete elements
n number of elements to delete (default 1)

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::eraseRows().

virtual void STK::IVariable::resize ( const Inx I = Inx()  )  [pure virtual]

STL compatibility. Resize the container.

  • call shift(I)
  • call pushBackElts if there is more elements
  • call popBackElts if three is less elements.
    Parameters:
    I the new size of the container

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::erase ( const Integer pos  )  [pure virtual]

STL compatibility. Delete one element at the position pos to the container.

Parameters:
pos position of the element to erase

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::erase ( const Inx I  )  [pure virtual]

STL compatibility. Delete the elements of the range [beg,end) to the container.

Parameters:
I the range of the elements to delete

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::pop_back (  )  [pure virtual]

STL compatibility. Pop last element.

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::pop_front (  )  [pure virtual]

STL compatibility. Pop first element.

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::setNA ( const Integer pos,
const Integer n = 1 
) [pure virtual]

Put NA values in the range [pos, pos+n).

Parameters:
pos index where to set NA values
n number of elements to set

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual void STK::IVariable::pushBackNA ( const Integer n = 1  )  [pure virtual]

virtual void STK::IVariable::insertNA ( const Integer pos,
const Integer n = 1 
) [pure virtual]

insert n NA values at pos.

Parameters:
pos index where to set NA values
n number of elements to insert

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

virtual IVariable& STK::IVariable::importString ( Integer nsuccess,
const _VarStringType V,
std::ios_base &(*)(std::ios_base &)  f = std::dec 
) [pure virtual]

overwrite the IVariable by converting the strings contained in V into the Type. Give the number of success.

Parameters:
nsuccess number of successful conversion
V Variable of String
f io flags

virtual const IVariable& STK::IVariable::exportString ( _VarStringType V,
std::ios_base &(*)(std::ios_base &)  f = std::dec 
) const [pure virtual]

Overwrite the variable V by converting the data into strings.

Parameters:
V Variable of String
f io flags

Referenced by STK::ExportToCsv::ExportToCsv().

virtual IVariable& STK::IVariable::operator<< ( const _VarStringType V  )  [pure virtual]

Operator << : overwrite the IVariable by converting the strings contained in V into the Type.

Parameters:
V the Variable of string to import

virtual const IVariable& STK::IVariable::operator>> ( _VarStringType V  )  const [pure virtual]

Operator >> : convert the Variable V into strings.

Parameters:
V Variable of String

virtual IVariable* STK::IVariable::clone ( const bool &  ref = false  )  const [pure virtual]

clone return a ptr on a copy of the object.

Parameters:
ref true if we don't want to copy the data

Implemented in STK::Variable< TYPE >, and STK::Variable< String >.

Referenced by STK::DataFrame::insertDataFrame(), and STK::DataFrame::pushBackDataFrame().


Member Data Documentation

const IdType STK::IVariable::type_ [protected]

Id Type of the variable.

Definition at line 67 of file STK_IVariable.h.

Referenced by getType().

Name of the variable.

Definition at line 70 of file STK_IVariable.h.

Referenced by getName(), operator=(), and setName().


The documentation for this class was generated from the following file:

Generated on Fri Sep 25 10:31:00 2009 for STK++ by  doxygen 1.5.8