openETCS
case study for the European Train Control System developed for the authors dissertation
|
class for holding variable values More...
#include <Language.h>
Public Types | |
enum | UNIT_T { SECONDS = 0, KILO_METERS_PER_HOUR = 1, METERS = 2, CENTI_METERS = 3, PER_MILL = 4, INTEGER = 5, DOUBLE = 6, STRING = 7 } |
enum type for the physical unit type of a variable More... |
Public Member Functions | |
void | Calculate () throw (::oETCS::DF::Error::CException) |
calculates the value | |
CVariable (oETCS::DF::CEVCStateMachine *const pStateMachine, const unsigned int &iResolution, const UNIT_T &eUnit, const unsigned long &lSize, const bool &bIsConditional=false, const long &lConditonalValue=0, const ::std::map< VARIABLE_VALUE_VECTOR_T, CVariable * > &ValueMap=::std::map< VARIABLE_VALUE_VECTOR_T, CVariable * >()) throw () | |
general constructor | |
CVariable (const CVariable &Source) | |
deleted copy constructor | |
unsigned long | GetSize () const throw () |
gets the size of the variable depending on the value stored | |
CVariable & | operator<< (const ::std::vector< bool > &Bits) throw (::oETCS::DF::Error::CException) |
streaming operator for filling a telegram with raw data | |
CVariable & | operator= (const CVariable &Source) |
deleted assignment operator | |
CVariable & | operator>> (::std::vector< bool > &Bits) throw (::oETCS::DF::Error::CException) |
streaming operator for getting the raw data in a variable | |
void | SetValue (const ::std::string &Value) throw () |
sets explicitly the value of a variable by a string | |
virtual | ~CVariable () throw () |
Static Public Member Functions | |
static oETCS::DF::VARIABLE_VALUE_VECTOR_T | StringToValueVector (const ::std::string &Value) throw () |
convertion method |
Public Attributes | |
::std::vector < oETCS::DF::CBitFlow * > | m_BitValues |
vector of pointers to bit flows to storages | |
const UNIT_T | m_eUnit |
unit of variable value | |
const unsigned int | m_iResolution |
fixed resolution of a variable | |
::std::vector< CVariable * > | m_IteratedVariables |
vector with pointers to all variables which are iterated by this instance | |
const unsigned long | m_lSize |
size of the variable in bit | |
::std::vector< CVariable * > | m_ScaledVariables |
vector with pointers to allvariable objecst which are scaled by this instance |
Private Attributes | |
const bool | m_bConditionalIterator |
flag for variable being a conditional iterator | |
double | m_dFactor |
scalar factor | |
unsigned int | m_iIterated |
iteration factor | |
const long | m_lConditionalValue |
conditional value used, if conditional operator | |
::std::vector < oETCS::DF::VARIABLE_VALUE_T > | m_Value |
vector as bit storages for the value of a variable | |
const ::std::map < oETCS::DF::VARIABLE_VALUE_VECTOR_T, CVariable * > | m_ValueMap |
optional map of certain byte values to predefined variables |
class for holding variable values
Definition at line 80 of file Language.h.
enum type for the physical unit type of a variable
Definition at line 86 of file Language.h.
|
explicit |
general constructor
Parameterises the Packet with all constant members. The Packet object takes over the posession of all variables/memory passed by pointer.
[in] | pStateMachine | pointer to parent EVC state machine |
[in] | iResolution | numerical resolution |
[in] | eUnit | physical unit |
[in] | bIsConditional | optional flag for an conditional iterator |
in] | lConditionalValue optional value used for the conditional iterator | |
[in] | ValueMap | optional map of values |
Definition at line 64 of file Language.cpp.
oETCS::DF::CVariable::CVariable | ( | const CVariable & | Source | ) |
deleted copy constructor
|
virtual |
Definition at line 88 of file Language.cpp.
void oETCS::DF::CVariable::Calculate | ( | ) | throw (::oETCS::DF::Error::CException) |
calculates the value
Calculates the real value, including value map and scaling, and stores it in the storage object under m_pValueStorage, if available.
Definition at line 99 of file Language.cpp.
References oETCS::DF::CStorage::Calculate(), oETCS::DF::DOUBLE, m_bConditionalIterator, m_BitValues, oETCS::DF::CStorage::m_dDoubleInput, m_dFactor, oETCS::DF::CStorage::m_DoubleArrayInput, m_eUnit, oETCS::DF::CStorage::m_iIntInput, m_iIterated, m_iResolution, m_IteratedVariables, m_lConditionalValue, m_lSize, m_ScaledVariables, oETCS::DF::CStorage::m_StringInput, m_Value, m_ValueMap, oETCS::DF::STRING, and STRING.
unsigned long oETCS::DF::CVariable::GetSize | ( | ) | const throw () |
gets the size of the variable depending on the value stored
Definition at line 668 of file Language.cpp.
References m_iIterated, and m_lSize.
oETCS::DF::CVariable & oETCS::DF::CVariable::operator<< | ( | const ::std::vector< bool > & | Bits | ) | throw (::oETCS::DF::Error::CException) |
streaming operator for filling a telegram with raw data
[in] | Bits | vector of boolean holding the the exact amount of bit raw data in little endian format |
Definition at line 703 of file Language.cpp.
oETCS::DF::CVariable & oETCS::DF::CVariable::operator>> | ( | ::std::vector< bool > & | Bits | ) | throw (::oETCS::DF::Error::CException) |
streaming operator for getting the raw data in a variable
[out] | Bits | vector of boolean holding the bit raw data in little endian format |
Definition at line 745 of file Language.cpp.
void oETCS::DF::CVariable::SetValue | ( | const ::std::string & | Value | ) | throw () |
sets explicitly the value of a variable by a string
[in] | Value | new value as string |
Definition at line 680 of file Language.cpp.
|
static |
convertion method
Converts a string (encoded by a prefix) to the value vector type used by language variables.
Prefixes:
d - double value s - string value i - integer value all other - binary value
[in] | Value | string with the value to convert |
Definition at line 771 of file Language.cpp.
|
private |
flag for variable being a conditional iterator
Definition at line 289 of file Language.h.
Referenced by Calculate().
::std::vector< oETCS::DF::CBitFlow* > oETCS::DF::CVariable::m_BitValues |
vector of pointers to bit flows to storages
Definition at line 305 of file Language.h.
Referenced by Calculate(), oETCS::UT::CFunctionBlock::setUp(), and oETCS::UT::CLanguage::setUp().
|
private |
scalar factor
Is multiplied with any numerical result of the value calculation
Definition at line 282 of file Language.h.
Referenced by Calculate().
const UNIT_T oETCS::DF::CVariable::m_eUnit |
|
private |
iteration factor
Defines how many times a variable object is iterated.
Definition at line 273 of file Language.h.
Referenced by Calculate(), and GetSize().
const unsigned int oETCS::DF::CVariable::m_iResolution |
fixed resolution of a variable
Definition at line 239 of file Language.h.
Referenced by Calculate().
::std::vector< CVariable* > oETCS::DF::CVariable::m_IteratedVariables |
vector with pointers to all variables which are iterated by this instance
Definition at line 319 of file Language.h.
Referenced by Calculate(), and oETCS::UT::CLanguage::setUp().
|
private |
conditional value used, if conditional operator
Definition at line 296 of file Language.h.
Referenced by Calculate().
const unsigned long oETCS::DF::CVariable::m_lSize |
size of the variable in bit
Definition at line 253 of file Language.h.
Referenced by Calculate(), and GetSize().
::std::vector< CVariable* > oETCS::DF::CVariable::m_ScaledVariables |
vector with pointers to allvariable objecst which are scaled by this instance
Definition at line 312 of file Language.h.
Referenced by Calculate(), and oETCS::UT::CLanguage::setUp().
|
private |
vector as bit storages for the value of a variable
Index 0 (m_Value[0]) is the LSB.
Definition at line 264 of file Language.h.
Referenced by Calculate().
|
private |
optional map of certain byte values to predefined variables
Definition at line 328 of file Language.h.
Referenced by Calculate().
Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or any later version.
The openETCS library is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with the openETCS library. If not, see
"http://www.gnu.org/licenses/.