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 
27 namespace MBSim {
28 
30  public:
31  bool operator==(const InitConfigEnum& a) const { return this==&a; }
32  bool operator!=(const InitConfigEnum& a) const { return this!=&a; }
33 
34  InitConfigEnum() = default;
35  ~InitConfigEnum() = 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  private:
40  static void operator delete[](void*, std::size_t);
41  static void* operator new[](std::size_t);
42  InitConfigEnum(const InitConfigEnum&)=delete;
44  InitConfigEnum& operator=(const InitConfigEnum&)=delete;
45  InitConfigEnum& operator=(InitConfigEnum&&)=delete;
46 };
47 
48 #ifndef SWIG
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 
55 typedef std::unordered_set<std::reference_wrapper<const InitConfigEnum>, InitConfigEnumOp, InitConfigEnumOp> InitConfigSet;
56 
57 #endif
58 
59 }
60 
61 #endif
Definition: initconfigenum.h:29
Definition: initconfigenum.h:50
namespace MBSim
Definition: eigenanalyzer.cc:47