#include <guarded_value.h>
Collaboration diagram for guarded_value< contents >:

Public Member Functions | |
| guarded_value () | |
| without an initial value, the guarded_value is considered invalid. | |
| guarded_value (const contents &def) | |
| the guarded_value with an initial value is considered valid. | |
| guarded_value (const guarded_value &to_copy) | |
| Copy constructor makes "this" into a copy of "to_copy". | |
| bool | initialized () const |
| if the object was initialized and not reset, then this returns true. | |
| void | reset () |
| marks the value held by this class as invalid. | |
| guarded_value & | operator= (const guarded_value &t_c) |
| assignment operator that takes another guarded value. | |
| guarded_value & | operator= (const contents &t_c) |
| assignment operator that takes one of the templated objects. | |
| operator contents () const | |
| Operator that returns the held object. | |
| contents & | access () |
| A synonym for the contents() operator. | |
Designed to act identically to the contained class except that it tracks whether the object held is initialized yet or not. The templated class must support a copy constructor.
Definition at line 26 of file guarded_value.h.
| guarded_value< contents >::guarded_value | ( | ) | [inline] |
without an initial value, the guarded_value is considered invalid.
Definition at line 29 of file guarded_value.h.
| guarded_value< contents >::guarded_value | ( | const contents & | def | ) | [inline] |
the guarded_value with an initial value is considered valid.
Definition at line 31 of file guarded_value.h.
| guarded_value< contents >::guarded_value | ( | const guarded_value< contents > & | to_copy | ) | [inline] |
Copy constructor makes "this" into a copy of "to_copy".
copying a guarded_value keeps all its characteristics and relies on a properly implemented copy constructor for the <contents>.
Definition at line 33 of file guarded_value.h.
| bool guarded_value< contents >::initialized | ( | ) | const [inline] |
if the object was initialized and not reset, then this returns true.
if this returns false, it is a clear sign that the object held cannot be used for any informational purposes.
Definition at line 38 of file guarded_value.h.
Referenced by item_statistics::adjusted_representation().
| void guarded_value< contents >::reset | ( | ) | [inline] |
marks the value held by this class as invalid.
if the object had any special destruction requirements (for example, held pointers...), then those need to be taken care of before the reset.
Definition at line 42 of file guarded_value.h.
| guarded_value& guarded_value< contents >::operator= | ( | const guarded_value< contents > & | t_c | ) | [inline] |
assignment operator that takes another guarded value.
Definition at line 46 of file guarded_value.h.
| guarded_value& guarded_value< contents >::operator= | ( | const contents & | t_c | ) | [inline] |
assignment operator that takes one of the templated objects.
Definition at line 49 of file guarded_value.h.
| guarded_value< contents >::operator contents | ( | ) | const [inline] |
Operator that returns the held object.
This conversion (and access()) yields the type of object held here, which re-enables the guarded_value to participate in the normal uses of the templated type.
Definition at line 53 of file guarded_value.h.
| contents& guarded_value< contents >::access | ( | ) | [inline] |
1.5.1