mbsim  4.0.0
MBSim Kernel
initconfigenum.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 INITCONFIGENUM_H_
21#define INITCONFIGENUM_H_
22
23#include <unordered_set>
24#include <functional>
25#include <cassert>
26
27namespace MBSim {
28
29#ifndef SWIG
30
32 public:
33 bool operator==(const InitConfigEnum& a) const { return this==&a; }
34 bool operator!=(const InitConfigEnum& a) const { return this!=&a; }
35
36 InitConfigEnum() = default;
37 ~InitConfigEnum() = default;
38 // must be defined due to SWIG
39 // static void* operator new(std::size_t);
40 // static void operator delete(void*, std::size_t);
41 private:
42 static void operator delete[](void*, std::size_t);
43 static void* operator new[](std::size_t);
44 InitConfigEnum(const InitConfigEnum&)=delete;
46 InitConfigEnum& operator=(const InitConfigEnum&)=delete;
47 InitConfigEnum& operator=(InitConfigEnum&&)=delete;
48};
49
51 size_t operator()(const InitConfigEnum &f) const { return reinterpret_cast<size_t>(&f); }
52 bool operator()(const InitConfigEnum &a, const InitConfigEnum &b) const { return &a==&b; }
53};
54
55typedef std::unordered_set<std::reference_wrapper<const InitConfigEnum>, InitConfigEnumOp, InitConfigEnumOp> InitConfigSet;
56
57#else
58
59class InitConfigSet;
60
61#endif
62
63}
64
65#endif
Definition: initconfigenum.h:31
namespace MBSim
Definition: bilateral_constraint.cc:30
Definition: initconfigenum.h:50