GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
GoDBRow Class Referenceabstract

abstract class manages a map with keys matching fields of a gofiguredatabase table and values of the map matching a row of a gofiguredatabase table More...

#include <Code/IO/GoDBRow/GoDBRow.h>

Inheritance diagram for GoDBRow:
Inheritance graph
[legend]

Public Types

typedef
StringMapType::const_iterator 
StringMapConstIterator
 
typedef StringMapType::iterator StringMapIterator
 
typedef std::map< std::string,
std::string > 
StringMapType
 

Public Member Functions

StringMapConstIterator ConstMapBegin ()
 
StringMapConstIterator ConstMapEnd ()
 
void DeleteFromDB (vtkMySQLDatabase *iDatabaseConnector)
 delete from the database the row which has the same TableID More...
 
std::string GetMapValue (const std::string &key)
 return the value for the field map[key] after having removed the " at the beginning and at the end of the value if it is a string in order to get the original value. More...
 
template<typename T >
GetMapValue (const std::string &key)
 
std::string GetTableIDName ()
 
std::string GetTableName ()
 
std::vector< std::string > GetVectorColumnNames ()
 put all the keys of the map in a vector More...
 
 GoDBRow ()
 
StringMapIterator MapBegin ()
 
StringMapIterator MapEnd ()
 
std::string PrintColumnNames ()
 put all the keys of the map in a string separated by ',' More...
 
std::string PrintColumnNamesWithValues ()
 put all the keys and values of the map in a string as map[key] = value separated by ',' More...
 
std::vector< std::string > PrintColumnsAndValues ()
 
std::string PrintValues ()
 put all the values of the map in a string separated by ',' More...
 
template<typename T >
void SetField (const std::string &key, const T &value)
 convert the value into a string and assign it to the key in the map More...
 
void SetField (const std::string &key, const std::string &value)
 set value as the value of map[key] after having put " at the beginning and at the end of the string, as value is a string and it will be needed for the database queries. map[key] = " "value" " More...
 
virtual bool SetValuesForSpecificID (int ID, vtkMySQLDatabase *iDatabaseConnector)
 get the data from the database corresponding to the specific ID and put them in the map More...
 
virtual ~GoDBRow ()
 

Protected Member Functions

void AddConditions (const std::string &iNameOfField, std::vector< FieldWithValue > &ioFieldWithValue)
 add as an element of ioFieldWithValue the name and value of the map with the key iNameOfField More...
 
virtual void InitializeMap ()=0
 virtual pure. initialize all the values of the map More...
 

Protected Attributes

StringMapType m_MapRow
 
std::string m_TableIDName
 
std::string m_TableName
 

Friends

std::ostream & operator<< (std::ostream &os, const GoDBRow &c)
 print the keys and values of the map in a cout More...
 

Detailed Description

abstract class manages a map with keys matching fields of a gofiguredatabase table and values of the map matching a row of a gofiguredatabase table

Definition at line 55 of file GoDBRow.h.

Member Typedef Documentation

typedef StringMapType::const_iterator GoDBRow::StringMapConstIterator

Definition at line 61 of file GoDBRow.h.

typedef StringMapType::iterator GoDBRow::StringMapIterator

Definition at line 60 of file GoDBRow.h.

typedef std::map< std::string, std::string > GoDBRow::StringMapType

Definition at line 59 of file GoDBRow.h.

Constructor & Destructor Documentation

GoDBRow::GoDBRow ( )

Definition at line 38 of file GoDBRow.cxx.

GoDBRow::~GoDBRow ( )
virtual

Definition at line 45 of file GoDBRow.cxx.

Member Function Documentation

void GoDBRow::AddConditions ( const std::string &  iNameOfField,
std::vector< FieldWithValue > &  ioFieldWithValue 
)
protected

add as an element of ioFieldWithValue the name and value of the map with the key iNameOfField

Parameters
[in]iNameOfFieldkey of the map
[in,out]ioFieldWithValuevector of FieldWithValue

Definition at line 263 of file GoDBRow.cxx.

GoDBRow::StringMapConstIterator GoDBRow::ConstMapBegin ( )
Returns
the iterator at the beginning of the class map as a const

Definition at line 157 of file GoDBRow.cxx.

GoDBRow::StringMapConstIterator GoDBRow::ConstMapEnd ( )
Returns
the iterator at the end of the class map as a const

Definition at line 166 of file GoDBRow.cxx.

void GoDBRow::DeleteFromDB ( vtkMySQLDatabase *  iDatabaseConnector)

delete from the database the row which has the same TableID

Parameters
[in]iDatabaseConnectorconnection to the database

Definition at line 273 of file GoDBRow.cxx.

std::string GoDBRow::GetMapValue ( const std::string &  key)

return the value for the field map[key] after having removed the " at the beginning and at the end of the value if it is a string in order to get the original value.

Parameters
[in]keykey of the map for which the value is needed
Returns
the corresponding value without "" if the value was a string

Definition at line 174 of file GoDBRow.cxx.

template<typename T >
T GoDBRow::GetMapValue ( const std::string &  key)
inline

Definition at line 169 of file GoDBRow.h.

std::string GoDBRow::GetTableIDName ( )
Returns
the tableID name

Definition at line 255 of file GoDBRow.cxx.

std::string GoDBRow::GetTableName ( )
Returns
the table name

Definition at line 247 of file GoDBRow.cxx.

std::vector< std::string > GoDBRow::GetVectorColumnNames ( )

put all the keys of the map in a vector

Returns
all the map keys in a vector

Definition at line 123 of file GoDBRow.cxx.

virtual void GoDBRow::InitializeMap ( )
protectedpure virtual
GoDBRow::StringMapIterator GoDBRow::MapBegin ( )
Returns
the iterator at the beginning of the class map

Definition at line 139 of file GoDBRow.cxx.

GoDBRow::StringMapIterator GoDBRow::MapEnd ( )
Returns
the iterator at the end of the class map

Definition at line 148 of file GoDBRow.cxx.

std::string GoDBRow::PrintColumnNames ( )

put all the keys of the map in a string separated by ','

Returns
all the map keys separated by ',' but without a ',' at the end of the string

Definition at line 87 of file GoDBRow.cxx.

std::string GoDBRow::PrintColumnNamesWithValues ( )

put all the keys and values of the map in a string as map[key] = value separated by ','

Returns
all the map [key] = value separated by ',' but without a ',' at the end of the string

Definition at line 103 of file GoDBRow.cxx.

std::vector< std::string > GoDBRow::PrintColumnsAndValues ( )
std::string GoDBRow::PrintValues ( )

put all the values of the map in a string separated by ','

Returns
all the map values separated by ',' but without a ',' at the end of the string

Definition at line 71 of file GoDBRow.cxx.

template<typename T >
void GoDBRow::SetField ( const std::string &  key,
const T &  value 
)
inline

convert the value into a string and assign it to the key in the map

Parameters
[in]keykey of the map
[in]valuevalue to be assigned to key
Template Parameters
Ttype of the value, anything but string

Definition at line 73 of file GoDBRow.h.

void GoDBRow::SetField ( const std::string &  key,
const std::string &  value 
)

set value as the value of map[key] after having put " at the beginning and at the end of the string, as value is a string and it will be needed for the database queries. map[key] = " "value" "

Parameters
[in]keykey of the map
[in]valuevalue to be assigned to key which is a string

Definition at line 52 of file GoDBRow.cxx.

bool GoDBRow::SetValuesForSpecificID ( int  ID,
vtkMySQLDatabase *  iDatabaseConnector 
)
virtual

get the data from the database corresponding to the specific ID and put them in the map

Parameters
[in]IDID for which the data are needed
[in]iDatabaseConnectorconnection to the database
Returns
false if the ID hasn't been found in the database

Reimplemented in GoDBTraceRow.

Definition at line 209 of file GoDBRow.cxx.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const GoDBRow c 
)
friend

print the keys and values of the map in a cout

Parameters
[in,out]os
[in,out]cthe row to print

Definition at line 180 of file GoDBRow.h.

Member Data Documentation

StringMapType GoDBRow::m_MapRow
protected

Definition at line 223 of file GoDBRow.h.

std::string GoDBRow::m_TableIDName
protected

Definition at line 225 of file GoDBRow.h.

std::string GoDBRow::m_TableName
protected

Definition at line 224 of file GoDBRow.h.


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