|
NCBI C++ ToolKit
|
Search Toolkit Book for CNullable
Template class allowing to store a value or null (unassigned) state. More...
#include <corelib/ncbimisc.hpp>
Inheritance diagram for CNullable< TValue, TNullToValue >:Public Member Functions | |
| CNullable (ENull=null) | |
| Create an empty nullable. More... | |
| CNullable (TValue value) | |
| Initialize nullable with a specific value. More... | |
| bool | IsNull (void) const |
| Check if the object is unassigned. More... | |
| operator TValue (void) const | |
| Get nullable value. More... | |
| const TValue & | GetValue (void) const |
| Get a const reference to the current value. More... | |
| TValue & | SetValue (void) |
| Get a non-const reference to the value. More... | |
| CNullable & | operator= (TValue value) |
| Assign a value to the nullable. More... | |
| CNullable & | operator= (ENull) |
| Reset nullable to unassigned state. More... | |
Private Attributes | |
| bool | m_IsNull |
| TValue | m_Value |
Template class allowing to store a value or null (unassigned) state.
TNullToValue functor can be used to perform an action when the value is requested from a null object. By default CCoreException is thrown. To perform other actions (e.g. provide a default value) the functor must define 'TValue operator()(void) const' method.
Definition at line 771 of file ncbimisc.hpp.