Public Member Functions | Private Attributes
icl_core::Finalizable< T > Class Template Reference

#include <Finalizable.h>

List of all members.

Public Member Functions

 Finalizable (const T &value)
 Finalizable (const Finalizable &other)
void finalize ()
 Finalizes the object, i.e. makes it unmodifiable.
bool isFinal () const
 Returns true if the object is final.
 operator T () const
 Implicit conversion.
std::ostream & operator<< (std::ostream &os)
 Output stream operator.
Finalizableoperator= (const Finalizable &other)
 Assignment is only allowed as long as this is not final.
Finalizableoperator= (const T &value)
 Assigning a value is only allowed as long as this is not final.

Private Attributes

bool m_final
 Indicates whether m_value is final, i.e. no longer modifiable.
m_value

Detailed Description

template<typename T>
class icl_core::Finalizable< T >

A simple object wrapper for objects which may be modified until they are "finalized", after which they are constant. Finalizable<T> behaves mostly like T, but after calling finalize(), assignments are no longer allowed and result in a std::logic_error.

This is useful in cases where variables cannot be made const, but should have a const behavior once they have received their correct value.

Definition at line 42 of file Finalizable.h.


Constructor & Destructor Documentation

template<typename T >
icl_core::Finalizable< T >::Finalizable ( const T &  value) [inline]

Definition at line 45 of file Finalizable.h.

template<typename T >
icl_core::Finalizable< T >::Finalizable ( const Finalizable< T > &  other) [inline]

Copy construction includes the m_final state, so a finalized object remains finalized.

Definition at line 53 of file Finalizable.h.


Member Function Documentation

template<typename T >
void icl_core::Finalizable< T >::finalize ( ) [inline]

Finalizes the object, i.e. makes it unmodifiable.

Definition at line 93 of file Finalizable.h.

template<typename T >
bool icl_core::Finalizable< T >::isFinal ( ) const [inline]

Returns true if the object is final.

Definition at line 90 of file Finalizable.h.

template<typename T >
icl_core::Finalizable< T >::operator T ( ) const [inline]

Implicit conversion.

Definition at line 87 of file Finalizable.h.

template<typename T >
std::ostream& icl_core::Finalizable< T >::operator<< ( std::ostream &  os) [inline]

Output stream operator.

Definition at line 96 of file Finalizable.h.

template<typename T >
Finalizable& icl_core::Finalizable< T >::operator= ( const Finalizable< T > &  other) [inline]

Assignment is only allowed as long as this is not final.

Definition at line 59 of file Finalizable.h.

template<typename T >
Finalizable& icl_core::Finalizable< T >::operator= ( const T &  value) [inline]

Assigning a value is only allowed as long as this is not final.

Definition at line 73 of file Finalizable.h.


Member Data Documentation

template<typename T >
bool icl_core::Finalizable< T >::m_final [private]

Indicates whether m_value is final, i.e. no longer modifiable.

Definition at line 107 of file Finalizable.h.

template<typename T >
T icl_core::Finalizable< T >::m_value [private]

The value managed by this object. Can be modified as long as m_final is false, after that it appears constant.

Definition at line 105 of file Finalizable.h.


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


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:20