The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::AssignOnceObject< T > Class Template Reference

Object which can only have it's value set once. Throws exception if being set more than once. More...

#include <Utils.hpp>

Public Member Functions

 AssignOnceObject (const AssignOnceObject &rhp)
 Copy Constructor.
 
 AssignOnceObject (AssignOnceObject &&rhp)
 Move-Construction disabled until needed.
 
 AssignOnceObject (const T &def_value, const char *name)
 Construct with a default and name for use during errors. This constructor starts the object in unassigned state, but provides a default value.
 
 AssignOnceObject ()
 Construct with no name.
 
 operator const T & () const
 Cast to contained type T.
 
const T & get () const
 Get contained value of type T.
 
bool operator== (const AssignOnceObject< T > &b) const
 Compare against another AssignOnceObject of the same contained type T.
 
const T & operator= (const AssignOnceObject< T > &b)
 Assign using another AssignOnceObject of the same contained type T.
 
const T & operator= (const T &v)
 Assign using a given value of type T.
 
bool assigned () const
 

Friends

template<typename X >
std::ostream & operator<< (std::ostream &o, const AssignOnceObject< X > &v)
 

Detailed Description

template<typename T>
class sparta::AssignOnceObject< T >

Object which can only have it's value set once. Throws exception if being set more than once.

Template Parameters
Templateparameter

Definition at line 437 of file Utils.hpp.

Constructor & Destructor Documentation

◆ AssignOnceObject() [1/4]

template<typename T >
sparta::AssignOnceObject< T >::AssignOnceObject ( const AssignOnceObject< T > &  rhp)
inline

Copy Constructor.

Definition at line 452 of file Utils.hpp.

◆ AssignOnceObject() [2/4]

template<typename T >
sparta::AssignOnceObject< T >::AssignOnceObject ( AssignOnceObject< T > &&  rhp)
inline

Move-Construction disabled until needed.

Definition at line 462 of file Utils.hpp.

◆ AssignOnceObject() [3/4]

template<typename T >
sparta::AssignOnceObject< T >::AssignOnceObject ( const T &  def_value,
const char *  name 
)
inline

Construct with a default and name for use during errors. This constructor starts the object in unassigned state, but provides a default value.

Parameters
[in]def_valueDefault value
[in]nameName of the object to print out in errors

Definition at line 478 of file Utils.hpp.

◆ AssignOnceObject() [4/4]

template<typename T >
sparta::AssignOnceObject< T >::AssignOnceObject ( )
inline

Construct with no name.

Definition at line 488 of file Utils.hpp.

Member Function Documentation

◆ assigned()

template<typename T >
bool sparta::AssignOnceObject< T >::assigned ( ) const
inline

Definition at line 543 of file Utils.hpp.

◆ get()

template<typename T >
const T & sparta::AssignOnceObject< T >::get ( ) const
inline

Get contained value of type T.

Definition at line 501 of file Utils.hpp.

◆ operator const T &()

template<typename T >
sparta::AssignOnceObject< T >::operator const T & ( ) const
inline

Cast to contained type T.

Definition at line 494 of file Utils.hpp.

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename T >
const T & sparta::AssignOnceObject< T >::operator= ( const AssignOnceObject< T > &  b)
inline

Assign using another AssignOnceObject of the same contained type T.

Definition at line 517 of file Utils.hpp.

◆ operator=() [2/2]

template<typename T >
const T & sparta::AssignOnceObject< T >::operator= ( const T &  v)
inline

Assign using a given value of type T.

Definition at line 531 of file Utils.hpp.

◆ operator==()

template<typename T >
bool sparta::AssignOnceObject< T >::operator== ( const AssignOnceObject< T > &  b) const
inline

Compare against another AssignOnceObject of the same contained type T.

Definition at line 509 of file Utils.hpp.

Here is the call graph for this function:

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