/usr/include/dune/functions/common/interfaces.hh is in libdune-functions-dev 2.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FUNCTIONS_COMMON_INTERFACES_HH
#define DUNE_FUNCTIONS_COMMON_INTERFACES_HH
#include <type_traits>
namespace Dune {
namespace Functions {
/**
* \brief Base class with polymorphic type boiler plate code
*
* \ingroup Utility
*
* By deriving your polymorphic type from this class you
* enforce a default interface for common operations like
* clone, clone to buffer, and move.
*/
template<class Interface>
class PolymorphicType
{
public:
/** \brief Destructor */
virtual ~PolymorphicType()
{}
/**
* \brief 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.
*/
virtual Interface* clone() const = 0;
/**
* \brief 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*).
*/
virtual Interface* clone(void* buffer) const = 0;
/**
* \brief 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*).
*/
virtual Interface* move(void* buffer) = 0;
};
}} // namespace Dune::Functions
#endif // DUNE_FUNCTIONS_COMMON_EXTENDED_CLONEABLE_HH
|