Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TypeIdInterface.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_TYPEIDINTERFACE_H_
21 #define OMNI_TYPEIDINTERFACE_H_
22 
23 #include <omni/Id.h>
24 
25 namespace omni {
26  /// Abstract Interface with a single virtual member function which returns
27  // type id
29  public:
30  virtual ~TypeIdInterface() {}
31 
32  /// Returns type id of object
33  virtual Id getTypeId() const = 0;
34 
35  /// Register the inherited class in factory
36  virtual void registerInFactory() const = 0;
37  };
38 }
39 
40 #define OMNI_TYPEID(type_id) \
41  BOOSTX_TYPE_ID(omni::Id, type_id, typeId, getTypeId)
42 
43 #define OMNI_REGISTER_CLASS(FACTORY, CLASS_NAME) \
44  OMNI_TYPEID(# CLASS_NAME) \
45  virtual void registerInFactory() const { \
46  FACTORY::template reg<CLASS_NAME>(); \
47  }
48 
49 #endif /* OMNI_TYPEIDINTERFACE_H_ */
Id type for classes An Id must only contain alpha numerical characters and must begin with a letter...
Definition: Id.h:34
virtual void registerInFactory() const =0
Register the inherited class in factory.
virtual Id getTypeId() const =0
Returns type id of object.
virtual ~TypeIdInterface()
Definition: TypeIdInterface.h:30
Abstract Interface with a single virtual member function which returns.
Definition: TypeIdInterface.h:28