DUNE-FUNCTIONS (unstable)

Dune::Functions::PolymorphicType< Interface > Class Template Referenceabstract

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

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

Public Member Functions

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

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.

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:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 3, 22:32, 2024)