#include <coherence/lang/BoxHandle.hpp>
Inherits TypedHandle< T >.
To support boxing a managed class defines an inner-type named "BoxedType", and includes a public static "create" method which takes that type. The BoxedType defines the type which the BoxHandle can use to create a managed object from. Alternatively the BoxHandle declaration can identify the "BoxedType" via a secondary template parameter.
Managed classes which wish to be auto-boxing may use this handle type when defining their Handle and View definitions. See String as an example.
When used with integral types a natural ambiguity is introduced when setting or comparing a BoxHandle to NULL, as it also an integral type. In such cases one may use the is_null(h) and clear_handle(h) helper functions to ensure the correct behavior.
BoxHandle can be configured as strict, or non-strict. In strict mode (the default), derefencing a NULL BoxHandle will result in a NullPointerException. In non-strict mode, dereferencing a BoxHandle will result in the BoxedType's default value being returned.
Public Member Functions | |
BoxHandle () | |
Create an empty BoxHandle. | |
BoxHandle (const B &b) | |
Create a new BoxHandle from the supplied BoxedType. | |
template<class O> | |
BoxHandle (const TypedHandle< O > &that) | |
Create a new BoxHandle from the TypedHandle with a type conversion. | |
BoxHandle (T *o) | |
Create a new BoxHandle from the raw pointer. | |
BoxHandle (const BoxHandle &h) | |
The copy constructor. | |
BoxHandle & | operator= (const BoxedType &b) |
The "boxing" operator. | |
operator BoxedType () const | |
The "unboxing" operator. |
operator BoxedType | ( | ) | const [inline] |