Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# BoxHandle Class Template Reference

`#include <coherence/lang/BoxHandle.hpp>`

Inherits TypedHandle< T >.

List of all members.

## Detailed Description

### template<class T, class B = typename T::BoxedType, bool fStrict = true>
class coherence::lang::BoxHandle< T, B, fStrict >

A TypedHandle implementation which supports auto-boxing.

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.

Author:
  mf 2007.07.05

## 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.

## Member Function Documentation

operator BoxedType | ( |  | ) | const `[inline]`

The "unboxing" operator.

Returns:
  a copy of the referenced Object

The documentation for this class was generated from the following file:

- coherence/lang/BoxHandle.hpp

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.