Loading...
Searching...
No Matches
Dune::Functions::PolymorphicType< Interface > Class Template Referenceabstract
Utility

Base class with polymorphic type boiler plate code. More...

`#include <dune/functions/common/interfaces.hh>`

Inheritance diagram for Dune::Functions::PolymorphicType< Interface >:

## Public Member Functions

virtual | ~PolymorphicType ()
| Destructor.
virtual Interface * | clone () const =0
| Clones the object.
virtual Interface * | clone (void *buffer) const =0
| Clones the object into buffer.
virtual Interface * | move (void *buffer)=0
| Move object into buffer.

## Detailed Description

template<class Interface>
class Dune::Functions::PolymorphicType< Interface >

Base class with polymorphic type boiler plate code.

By deriving your polymorphic type from this class you enforce a default interface for common operations like clone, clone to buffer, and move.

## Constructor & Destructor Documentation

## ~PolymorphicType()

template<class Interface>

virtual Dune::Functions::PolymorphicType< Interface >::~PolymorphicType | ( |  | ) |

inline virtual

Destructor.

## Member Function Documentation

## clone() [1/2]

template<class Interface>

virtual Interface * Dune::Functions::PolymorphicType< Interface >::clone | ( |  | ) | const

pure virtual

Clones the object.

clone() needs to be redefined by an implementation class, with the return type covariantly adapted. This will return a new copy of *this via a pointer to newly allocated memory. Remember to delete the resulting pointer.

## clone() [2/2]

template<class Interface>

virtual Interface * Dune::Functions::PolymorphicType< Interface >::clone | ( | void * | buffer | ) | const

pure virtual

Clones the object into buffer.

clone(buffer) needs to be redefined by an implementation class, with the return type covariantly adapted. This will return a copy of this created in the given buffer using placement-new with copy construction. You must not delete the returned pointer since it points to the given buffer (however with the proper type instead of void).

## move()

template<class Interface>

virtual Interface * Dune::Functions::PolymorphicType< Interface >::move | ( | void * | buffer | ) |

pure virtual

Move object into buffer.

move(buffer) needs to be redefined by an implementation class, with the return type covariantly adapted. This will return a copy of this created in the given buffer using placement-new with move construction. You must not delete the returned pointer since it points to the given buffer (however with the proper type instead of void).

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

- interfaces.hh