#include <Finalizable.h>
| 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 trueif the object is final. | |
| operator T () const | |
| Implicit conversion. | |
| std::ostream & | operator<< (std::ostream &os) | 
| Output stream operator. | |
| Finalizable & | operator= (const Finalizable &other) | 
| Assignment is only allowed as long as this is not final. | |
| Finalizable & | operator= (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. | |
| T | m_value | 
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.
| icl_core::Finalizable< T >::Finalizable | ( | const T & | value | ) |  [inline] | 
Definition at line 45 of file Finalizable.h.
| 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.
| void icl_core::Finalizable< T >::finalize | ( | ) |  [inline] | 
Finalizes the object, i.e. makes it unmodifiable.
Definition at line 93 of file Finalizable.h.
| bool icl_core::Finalizable< T >::isFinal | ( | ) | const  [inline] | 
Returns true if the object is final. 
Definition at line 90 of file Finalizable.h.
| icl_core::Finalizable< T >::operator T | ( | ) | const  [inline] | 
Implicit conversion.
Definition at line 87 of file Finalizable.h.
| std::ostream& icl_core::Finalizable< T >::operator<< | ( | std::ostream & | os | ) |  [inline] | 
Output stream operator.
Definition at line 96 of file Finalizable.h.
| 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.
| 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.
| 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.
| 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.