Dune Core Modules (unstable)

parameterizedobjectfactorysingleton.hh
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3#ifndef DUNE_COMMON_TEST_PARAMETERIZEDOBJECTFACTORYSINGLETON_HH
4#define DUNE_COMMON_TEST_PARAMETERIZEDOBJECTFACTORYSINGLETON_HH
5
6#include <dune/common/parameterizedobject.hh>
8#include <string>
9
10#define DefineImplementation2(IF,T) \
11 struct T : public IF { \
12 T() {} \
13 std::string info() override { \
14 return #T; \
15 } \
16 }
17
18#define DefineImplementation(IF,T,...) \
19 struct T : public IF { \
20 T(__VA_ARGS__) {} \
21 std::string info() override { \
22 return #T; \
23 } \
24 }
25
26struct InterfaceA
27{
28 virtual std::string info() = 0;
29 virtual ~InterfaceA() = default;
30};
31
32struct InterfaceB
33{
34 virtual std::string info() = 0;
35 virtual ~InterfaceB() = default;
36};
37
38template<typename Interface>
40globalPtrFactory()
41{
43}
44
45#endif //#ifndef DUNE_COMMON_TEST_PARAMETERIZEDOBJECTFACTORYSINGLETON_HH
static DUNE_EXPORT MPIHelper & instance(int *argc=nullptr, char ***argv=nullptr)
Get the singleton instance of the helper.
Definition: mpihelper.hh:284
A factory class for parameterized objects.
Definition: parameterizedobject.hh:36
An adapter to turn a class into a singleton.
Definition: singleton.hh:56
Useful wrapper for creating singletons.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)