DCMTK
Version 3.6.4
OFFIS DICOM Toolkit
|
Manages storage and state of the object contained in OFoptional<T>. More...
Public Member Functions | |
OFoptional_traits () | |
Requried: default constructor, must initialize the state to "disengaged". | |
void | construct (...) |
Required: type constructors, construct the contained object. More... | |
void | destroy () |
Required: type destructor, destroys the underlying object and must set the state to "disengaged". | |
OFBool | state () const |
Required: state query, must return OFTrue when "engaged" and OFFalse otherwhise. | |
void * | content () const |
Required: content access, must return a pointer to the contained object. | |
Public Attributes | |
< unspecified > | is_default_constructible |
Required: default construction policy. More... | |
Manages storage and state of the object contained in OFoptional<T>.
OFoptional_traits is a customization point for OFoptional that enables you to define a custom storage management policy for individual types T. If you don't want to implement everything from scratch, use OFdefault_optional_traits as base class for your implementation.
the | content type of the respective OFoptional instance. |
The following example shows how to implement custom OFoptional_traits for an enum that already contains a specific element to denote an invalid state.
void OFoptional_traits< T >::construct | ( | ... | ) |
Required: type constructors, construct the contained object.
You need to define at least one method of this kind, that takes appropriate parameter(s) to construct the underlying object. Must set the state to "engaged". If is_default_constructible
evaluates to OFTrue, an overload taking zero arguments is also required.
<unspecified> OFoptional_traits< T >::is_default_constructible |
Required: default construction policy.
You need to define an appropriate integral constant as "is_default_constructible" that denotes if OFoptional<T> may attempt to default construct the underlying object under certain circumstances. You may use OFdefault_optional_traits<T>::is_default_constructible
to specify this member, which uses SFINAE mechanisms to query a type's default constructibility.