Public Member Functions | Protected Member Functions

# HClonable Class Reference
[Common]

This class defines an interface for cloning instances of polymorphic classes. More...

`#include <HClonable>`

Inheritance diagram for HClonable:

List of all members.

## Public Member Functions
| HClonable ()
virtual | ~HClonable ()=0
virtual HClonable * | clone () const
## Protected Member Functions
virtual void | doClone (HClonable *target) const =0
virtual HClonable * | newInstance () const =0

## Detailed Description

Remarks:
  this class is thread-safe.

## Constructor & Destructor Documentation

HClonable | ( |  | ) |

Creates a new instance.

~HClonable | ( |  | ) | `[pure virtual]`

Destroys the instance.

## Member Function Documentation

virtual void doClone | ( | HClonable * | target | ) | const`[protected, pure virtual]`

Clones the contents of this to the `target` object.

Every derived class has to override this method. Further, the implementation should be something along these lines:

     void MyClonable::doClone(HClonable* target) const
     {
        MyClonable* myClonable = dynamic_cast<MyClonable*>(target);
        if (!myClonable)
        {
            return;
        }

        BaseClassOfMyClonable::doClone(target);

        // copy the variables introduced in *this* MyClonable
        // instance to "myClonable".
     }

Parameters:

  | target | specifies the target object to which the contents of `this` instance are cloned.

Implemented in HControlPointConfiguration, HDeviceConfiguration, and HDeviceHostConfiguration.

virtual HClonable* newInstance | ( |  | ) | const`[protected, pure virtual]`

Creates a new instance.

This method is used as part of object cloning. Because of that, it is important that every descendant class overrides this method:

     MyClonable* MyClonable::newInstance() const
     {
         return new MyClonable();
     }

Remarks:
  - the object has to be heap-allocated and
  - the ownership of the object is passed to the caller.

Implemented in HControlPointConfiguration, HDeviceConfiguration, and HDeviceHostConfiguration.

HClonable * clone | ( |  | ) | const`[virtual]`

Returns a deep copy of the instance.

Returns:
  a deep copy of the instance.

Remarks:
  - the ownership of the returned object is transferred to the caller.

Reimplemented in HControlPointConfiguration, HDeviceConfiguration, and HDeviceHostConfiguration.