STK++ 1.0

STK::IVariable Class Reference

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

#include <STK_IVariable.h>

Inheritance diagram for STK::IVariable:

List of all members.

Public Types

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

Public Member Functions

virtual ~IVariable ()
 destructor.
IVariableoperator= (const IVariable &V)
 Operator = : overwrite the IVariable with T.
const IdTypegetType () const
 Get the type of the variable.
String const & name () const
 Get the name of the variable.
void setName (Integer const &num=0, const String &prefix=STRING_VAR)
 Set a default name for variable of the form : prefix + num.
void setName (String const &name)
 Set the name of the variable.
virtual void pushBackNAValues (Integer const &n=1)=0
 push back n NA values.
virtual Integer importString (const _VarStringType &V, std::ios_base &(*f)(std::ios_base &)=std::dec)=0
 overwrite the IVariable by converting the strings contained in V into the Type.
virtual const IVariableexportString (_VarStringType &V, std::ios_base &(*f)(std::ios_base &)=std::dec) const =0
 Overwrite the variable V by converting the data into strings.
virtual IVariableoperator<< (const _VarStringType &V)=0
 Operator << : overwrite the IVariable by converting the strings contained in V into the Type.
virtual const IVariableoperator>> (_VarStringType &V) const =0
 Operator >> : convert the Variable V into strings.
virtual IVariableclone (bool ref=false) const =0
 clone return a ptr on a copy of the object.

Static Public Member Functions

static String giveName (Integer const &num=0, const String &prefix=STRING_VAR)
 Return a default name for variable of the form : prefix + num.

Protected Member Functions

 IVariable (const IdType &type, String const &name)
 Default constructor.
 IVariable (const IVariable &V)
 Copy constructor.

Protected Attributes

const IdType type_
 Id Type of the variable.
String name_
 Name of the variable.

Detailed Description

IVariable is an Interface class for all Variables classes.

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.

The pure virtual function defined in this class are the one needed by the DataFrame container.

Definition at line 61 of file STK_IVariable.h.


Member Typedef Documentation

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

Definition at line 85 of file STK_IVariable.h.


Constructor & Destructor Documentation

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

Default constructor.

Definition at line 72 of file STK_IVariable.h.

             : type_(type)
             , name_(name)
    { ;}
STK::IVariable::IVariable ( const IVariable V) [inline, protected]

Copy constructor.

Definition at line 78 of file STK_IVariable.h.

             : type_(V.type_)
             , name_(V.name_)
    { ;}
virtual STK::IVariable::~IVariable ( ) [inline, virtual]

destructor.

Definition at line 88 of file STK_IVariable.h.

{ ;}

Member Function Documentation

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

Operator = : overwrite the IVariable with T.

Definition at line 91 of file STK_IVariable.h.

References name_.

    {
      name_ = V.name_;  // copy name_ of the variable
      return *this;
    }
static String STK::IVariable::giveName ( Integer const &  num = 0,
const String prefix = STRING_VAR 
) [inline, static]

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

Definition at line 99 of file STK_IVariable.h.

Referenced by STK::operator>>().

   { return (prefix+typeToString<Integer> (num));}
const IdType& STK::IVariable::getType ( ) const [inline]

Get the type of the variable.

Definition at line 105 of file STK_IVariable.h.

References type_.

Referenced by STK::ExportToArray2D< TYPE >::ExportToArray2D().

    { return type_;}
void STK::IVariable::setName ( Integer const &  num = 0,
const String prefix = STRING_VAR 
) [inline]

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

Definition at line 113 of file STK_IVariable.h.

References name_.

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

    { name_ = (prefix+typeToString<Integer> (num));}
void STK::IVariable::setName ( String const &  name) [inline]

Set the name of the variable.

Definition at line 119 of file STK_IVariable.h.

References name(), and name_.

    { name_ = name;}
virtual void STK::IVariable::pushBackNAValues ( Integer const &  n = 1) [pure virtual]
virtual Integer STK::IVariable::importString ( 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:
VVariable of String
fio flags
Returns:
number of successful conversion

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

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:
VVariable of String
fio 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:
Vthe Variable of string to import
virtual const IVariable& STK::IVariable::operator>> ( _VarStringType V) const [pure virtual]

Operator >> : convert the Variable V into strings.

Parameters:
VVariable of String
virtual IVariable* STK::IVariable::clone ( bool  ref = false) const [pure virtual]

clone return a ptr on a copy of the object.

Parameters:
reftrue 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 65 of file STK_IVariable.h.

Referenced by getType().

Name of the variable.

Definition at line 68 of file STK_IVariable.h.

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


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