torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::Value Class Reference

#include <Value.hpp>

Data Structures

class  MiNoMax
 
class  Number
 
class  Point
 

Public Types

enum  Type {
  eValueTypeUndefined, eValueTypeBoolean, eValueTypeInteger, eValueTypeMiNoMax,
  eValueTypeNumber, eValueTypePoint, eValueTypeString
}
 
typedef bool Boolean
 
typedef int32_t Integer
 
typedef std::string String
 

Public Member Functions

 Value ()
 
 Value (Type type)
 
template<typename _ValueType >
 Value (Type type, const _ValueType &inSource)
 
 ~Value () throw ()
 
 Value (const Value &inSource)
 
Valueoperator= (const Value &inSource)
 
template<typename _ValueType >
_ValueType get () const throw (Error)
 
template<typename _ValueType >
void set (const _ValueType &inSource) throw (Error)
 
const Type getType () const
 
void setType (const Type &inSource)
 
const bool getIsSet () const
 
void setIsSet (const bool &inSource)
 

Private Attributes

Type mType
 
boost::variant< Value::Boolean,
Value::Integer, Value::Number,
Value::MiNoMax, Value::Point,
Value::String
mValue
 
bool mIsSet
 

Detailed Description

Represents a Value in EDIF. Values are used in different regions in EDIF such as in properties, parameters etc.

Definition at line 34 of file Value.hpp.

Member Typedef Documentation

Boolean Type

Definition at line 51 of file Value.hpp.

32 bit Signed Integer type.

Definition at line 56 of file Value.hpp.

typedef std::string torc::generic::Value::String

Defines a non-unicode standard string.

Definition at line 61 of file Value.hpp.

Member Enumeration Documentation

Defines the type of inSource stored in this Value object.

Enumerator
eValueTypeUndefined 
eValueTypeBoolean 
eValueTypeInteger 
eValueTypeMiNoMax 
eValueTypeNumber 
eValueTypePoint 
eValueTypeString 

Definition at line 44 of file Value.hpp.

Constructor & Destructor Documentation

torc::generic::Value::Value ( )

Definition at line 194 of file Value.cpp.

194 : mType(eValueTypeUndefined), mValue(), mIsSet(false) {}
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303
torc::generic::Value::Value ( Value::Type  type)

Definition at line 196 of file Value.cpp.

196 : mType(type), mValue(), mIsSet(false) {}
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303
template<typename _ValueType >
torc::generic::Value::Value ( Value::Type  type,
const _ValueType &  inSource 
)

Definition at line 361 of file Value.hpp.

361  :
362  mType(type), mValue(inSource), mIsSet(true) {}
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303
torc::generic::Value::~Value ( )
throw (
)

Definition at line 198 of file Value.cpp.

198 {}
torc::generic::Value::Value ( const Value inSource)

Definition at line 200 of file Value.cpp.

200  : mType(inSource.mType), mValue(inSource.mValue),
201  mIsSet(inSource.mIsSet) {}
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303

Member Function Documentation

template<typename _ValueType >
_ValueType torc::generic::Value::get ( ) const
throw (Error
)

Get the inSource stored in this object.

Note
This needs to be called as: v.get<Value::Integer>();
Returns
The inSource according to the specified type.
Exceptions
ErrorThe stored an requested types are incompatible.

Definition at line 386 of file Value.hpp.

386  {
387  if(!mIsSet) {
388  Error e(eMessageIdErrorValueNotSet, __FUNCTION__, __FILE__, __LINE__);
389  e.saveContextData("Value set", mIsSet);
390  throw e;
391  }
392  _ValueType v;
393  try {
394  v = boost::get < _ValueType > (mValue);
395  } catch(const boost::bad_get& bg) {
396  Error e(eMessageIdErrorTypeCast, __FUNCTION__, __FILE__, __LINE__);
397  e.saveContextData("Value", mValue);
398  e.saveContextData("Casted Type", std::string("_ValueType"));
399  throw e;
400  }
401  return v;
402 }
std::string string
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const bool torc::generic::Value::getIsSet ( ) const
inline

Get whether this object is defined with a inSource, or is undefined.

Returns
True if initialized.

Definition at line 357 of file Value.hpp.

357  {
358  return mIsSet;
359 }

+ Here is the caller graph for this function:

const Value::Type torc::generic::Value::getType ( void  ) const
inline

Get the type of inSource stored in this object.

Returns
The type of object

Definition at line 348 of file Value.hpp.

348  {
349  return mType;
350 }

+ Here is the caller graph for this function:

Value & torc::generic::Value::operator= ( const Value inSource)

Definition at line 203 of file Value.cpp.

203  {
204  if(this != &inSource) {
205  mType = inSource.mType;
206  mValue = inSource.mValue;
207  mIsSet = inSource.mIsSet;
208  }
209  return *this;
210 }
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303
template<typename _ValueType >
void torc::generic::Value::set ( const _ValueType &  inSource)
throw (Error
)

Set a inSource object.

Note
This needs to be called as: v.set<Value::Integer>(10);
Parameters
[in]inSourceThe inSource according to the specified type.
Exceptions
ErrorThe requested type is wrong.

Definition at line 373 of file Value.hpp.

373  {
374  mValue = inSource;
375 }
boost::variant< Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String > mValue
Definition: Value.hpp:303
void torc::generic::Value::setIsSet ( const bool &  inSource)

Set whether this object is defined with a inSource, or is undefined.

Parameters
[in]inSourceTrue if initialized.

false* Set whether this object is defined with a inSource, or is undefined.

Parameters
[in]inSourceTrue if initialized.

Definition at line 226 of file Value.cpp.

226  {
227  mIsSet = inSource;
228 }
void torc::generic::Value::setType ( const Type inSource)

Get the type of inSource stored in this object.

Returns
The type of object

Definition at line 217 of file Value.cpp.

217  {
218  mType = inSource;
219 }

Field Documentation

bool torc::generic::Value::mIsSet
private

Definition at line 304 of file Value.hpp.

Type torc::generic::Value::mType
private

Definition at line 301 of file Value.hpp.

boost::variant<Value::Boolean, Value::Integer, Value::Number, Value::MiNoMax, Value::Point, Value::String> torc::generic::Value::mValue
private

Definition at line 303 of file Value.hpp.


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