mbsim 4.0.0 MBSim Kernel

plotfeatureenum.h
1 /* Copyright (C) 2004-2012 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: martin.o.foerg@googlemail.com
18 */
19
20 #ifndef PLOTFEATUREENUM_H_
21 #define PLOTFEATUREENUM_H_
22
23 #include <unordered_map>
24 #include <functional>
25 #include <cassert>
26
27 namespace MBSim {
28
29 class PlotFeatureEnum {
30 public:
31 bool operator==(const PlotFeatureEnum& a) const { return this==&a; }
32 bool operator!=(const PlotFeatureEnum& a) const { return this!=&a; }
33
34 PlotFeatureEnum() = default;
35 ~PlotFeatureEnum() = default;
36 // must be defined due to SWIG
37 // static void* operator new(std::size_t);
38 // static void operator delete(void*, std::size_t);
39
40 PlotFeatureEnum(const PlotFeatureEnum&)=delete;
41 PlotFeatureEnum(PlotFeatureEnum&&)=delete;
42 PlotFeatureEnum& operator=(const PlotFeatureEnum&)=delete;
43 PlotFeatureEnum& operator=(PlotFeatureEnum&&)=delete;
44 private:
45 static void operator delete[](void*, std::size_t);
46 static void* operator new[](std::size_t);
47 };
48
49 #ifndef SWIG
50
51 struct PlotFeatureEnumOp {
52 size_t operator()(const PlotFeatureEnum &f) const { return reinterpret_cast<size_t>(&f); }
53 bool operator()(const PlotFeatureEnum &a, const PlotFeatureEnum &b) const { return &a==&b; }
54 };
55
56 typedef std::unordered_map<std::reference_wrapper<const PlotFeatureEnum>, bool, PlotFeatureEnumOp, PlotFeatureEnumOp> PlotFeatureMap;
57
58 #endif
59
60 }
61
62 #endif
MBSim::PlotFeatureEnum
Definition: plotfeatureenum.h:29
MBSim::PlotFeatureEnumOp
Definition: plotfeatureenum.h:51
MBSim
namespace MBSim
Definition: bilateral_constraint.cc:30