torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::common::EncapsulatedInteger< T > Class Template Reference

Template base for encapsulated integers, to enforce strong typing. More...

#include <EncapsulatedInteger.hpp>

+ Collaboration diagram for torc::common::EncapsulatedInteger< T >:

Public Types

typedef EncapsulatedInteger< T > type
 Alias for the instantiated class type. More...
 
typedef T pod
 Alias for the encapsulated Plain-Old-Data type. More...
 

Public Member Functions

 EncapsulatedInteger (void)
 Null constructor. More...
 
 EncapsulatedInteger (const type &rhs)
 Copy constructor. More...
 
 EncapsulatedInteger (const T &rhs)
 Copy constructor. More...
 
typeoperator= (const type &rhs)
 Assignment operator (from encapsulated type). More...
 
typeoperator= (const T &rhs)
 Assignment operator. More...
 
bool operator== (const type &rhs) const
 Equality operator (against encapsulated type). More...
 
bool operator== (const T &rhs) const
 Equality operator. More...
 
 operator const T & (void) const
 Constant cast operator. More...
 
 operator T & (void)
 Non-constant cast operator. More...
 
bool isUndefined (void) const
 

Static Public Member Functions

static pod undefined (void)
 

Protected Attributes

m
 Encapsulated integer. More...
 

Friends

std::size_t hash_value (const type &rhs)
 Return a hash value for the specified encapsulated integer. More...
 

Detailed Description

template<typename T>
class torc::common::EncapsulatedInteger< T >

Template base for encapsulated integers, to enforce strong typing.

Definition at line 28 of file EncapsulatedInteger.hpp.

Member Typedef Documentation

template<typename T>
typedef T torc::common::EncapsulatedInteger< T >::pod

Alias for the encapsulated Plain-Old-Data type.

Definition at line 35 of file EncapsulatedInteger.hpp.

template<typename T>
typedef EncapsulatedInteger<T> torc::common::EncapsulatedInteger< T >::type

Alias for the instantiated class type.

Definition at line 34 of file EncapsulatedInteger.hpp.

Constructor & Destructor Documentation

template<typename T>
torc::common::EncapsulatedInteger< T >::EncapsulatedInteger ( void  )
inline

Null constructor.

Definition at line 38 of file EncapsulatedInteger.hpp.

38 { m = 0; }
template<typename T>
torc::common::EncapsulatedInteger< T >::EncapsulatedInteger ( const type rhs)
inline

Copy constructor.

Definition at line 40 of file EncapsulatedInteger.hpp.

40 { m = rhs.m; }
template<typename T>
torc::common::EncapsulatedInteger< T >::EncapsulatedInteger ( const T &  rhs)
inline

Copy constructor.

Definition at line 42 of file EncapsulatedInteger.hpp.

42 { m = rhs; }

Member Function Documentation

template<typename T>
bool torc::common::EncapsulatedInteger< T >::isUndefined ( void  ) const
inline

Definition at line 61 of file EncapsulatedInteger.hpp.

61 { return m == static_cast<pod>(-1); }
T pod
Alias for the encapsulated Plain-Old-Data type.

+ Here is the caller graph for this function:

template<typename T>
torc::common::EncapsulatedInteger< T >::operator const T & ( void  ) const
inline

Constant cast operator.

Definition at line 53 of file EncapsulatedInteger.hpp.

53 { return m; }
template<typename T>
torc::common::EncapsulatedInteger< T >::operator T & ( void  )
inline

Non-constant cast operator.

Definition at line 55 of file EncapsulatedInteger.hpp.

55 { return m; }
template<typename T>
type& torc::common::EncapsulatedInteger< T >::operator= ( const type rhs)
inline

Assignment operator (from encapsulated type).

Definition at line 45 of file EncapsulatedInteger.hpp.

45 { m = rhs.m; return *this; }
template<typename T>
type& torc::common::EncapsulatedInteger< T >::operator= ( const T &  rhs)
inline

Assignment operator.

Definition at line 47 of file EncapsulatedInteger.hpp.

47 { m = rhs; return *this; }
template<typename T>
bool torc::common::EncapsulatedInteger< T >::operator== ( const type rhs) const
inline

Equality operator (against encapsulated type).

Definition at line 49 of file EncapsulatedInteger.hpp.

49 { return m == rhs.m; }
template<typename T>
bool torc::common::EncapsulatedInteger< T >::operator== ( const T &  rhs) const
inline

Equality operator.

Definition at line 51 of file EncapsulatedInteger.hpp.

51 { return m == rhs; }
template<typename T>
static pod torc::common::EncapsulatedInteger< T >::undefined ( void  )
inlinestatic

Definition at line 60 of file EncapsulatedInteger.hpp.

60 { return static_cast<pod>(-1); }
T pod
Alias for the encapsulated Plain-Old-Data type.

Friends And Related Function Documentation

template<typename T>
std::size_t hash_value ( const type rhs)
friend

Return a hash value for the specified encapsulated integer.

Definition at line 58 of file EncapsulatedInteger.hpp.

58 { return boost::hash_value(rhs.m); }
std::size_t hash_value(const Arc &inArc)
Definition: Arc.cpp:25

Field Documentation

template<typename T>
T torc::common::EncapsulatedInteger< T >::m
protected

Encapsulated integer.

Definition at line 31 of file EncapsulatedInteger.hpp.


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