#include <serialize.hpp>
Public Types | |
| typedef SerializableT | cleaned_type |
Public Member Functions | |
| cleanup_ptr () throw () | |
| Constructs an object pointing to nothing. | |
| cleanup_ptr (cleaned_type *p) throw () | |
| Transfers ownership of p to this object. | |
| ~cleanup_ptr () throw () | |
| Uses s11n::cleanup_serializable<cleaned_type>() to free up up this->get(). | |
| cleaned_type & | operator * () |
| Dereferences this object's pointed-to object. | |
| cleaned_type * | operator-> () throw () |
| Returns the same as get(). | |
| cleaned_type * | get () throw () |
| Returns this object's pointed-to object without transfering ownership. | |
| void | take (cleaned_type *p) throw () |
| Transfers ownership of p to this object. | |
| cleaned_type * | release () throw () |
| Transfers ownership of this->get() to the caller. | |
| void | clean () throw () |
| Cleans up any pointed-to object and points this object at 0. | |
| void | swap (cleanup_ptr &rhs) throw () |
| Swaps ownership of pointers with rhs. | |
SerializableT must either have an explicit s11n_traits specialization installed or work properly with the default functor provided by s11n_traits::cleanup_functor. In practice, this means that types which manage the memory of their contained pointers are safe to work with the default, whereas the cleanup of unmanaged child pointers (e.g., std containers) requires a proper specialization.
Note that this type does not have copy/assignment ctors, due to the conventional constness of their right-hand sides: use the swap() or take() members to take over a pointer.
Added in 1.1.3.
Definition at line 263 of file serialize.hpp.
|
|||||
|
Definition at line 266 of file serialize.hpp. |
|
|||||||||
|
Constructs an object pointing to nothing.
Definition at line 282 of file serialize.hpp. |
|
||||||||||
|
Transfers ownership of p to this object.
Definition at line 288 of file serialize.hpp. |
|
|||||||||
|
Uses s11n::cleanup_serializable<cleaned_type>() to free up up this->get().
Definition at line 296 of file serialize.hpp. |
|
|||||||||
|
Cleans up any pointed-to object and points this object at 0. Does nothing if this object points to no object. Postcondition: 0 == this->get() Definition at line 375 of file serialize.hpp. References s11n::cleanup_ptr< SerializableT >::take(). |
|
|||||||||
|
Returns this object's pointed-to object without transfering ownership.
Definition at line 327 of file serialize.hpp. |
|
|||||||||
|
Dereferences this object's pointed-to object. If this object does not point to anything it throws a std::runtime_error with an informative what() message explaining the error. Definition at line 306 of file serialize.hpp. |
|
|||||||||
|
Returns the same as get().
Definition at line 318 of file serialize.hpp. |
|
|||||||||
|
Transfers ownership of this->get() to the caller. Postcondition: 0 == this->get() Definition at line 361 of file serialize.hpp. |
|
||||||||||
|
Swaps ownership of pointers with rhs.
Definition at line 383 of file serialize.hpp. |
|
||||||||||
|
Transfers ownership of p to this object. This member takes the place of copy/assign operators, since those conventionally take a const right-hand argument. Destroys the object this object pointed to before taking over ownership. 0 is a legal value for p. If (p == this->get()) then this function does nothing. Postcondition: p == this->get() Definition at line 346 of file serialize.hpp. Referenced by s11n::cleanup_ptr< SerializableT >::clean(). |
1.4.4