Orxonox  0.0.5 Codename: Arcturus
ScopedSingletonIncludes.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Reto Grieder
24  * Co-authors:
25  * ...
26  *
27  */
28 
35 #ifndef __ScopedSingletonIncludes_H__
36 #define __ScopedSingletonIncludes_H__
37 
38 #include "core/CorePrereqs.h"
39 
40 #include "ScopedSingletonWrapper.h"
42 
72 #define ManageScopedSingleton(className, scope, allowedToFail) \
73  className* className::singletonPtr_s = nullptr; \
74  static ScopedSingletonWrapper& className##ScopedSingletonWrapper \
75  = (new orxonox::SI_SSW(new ClassScopedSingletonWrapper<className, allowedToFail>(#className), scope))->getWrapper()
76 
77 namespace orxonox
78 {
80  {
81  public:
84  , wrapper_(wrapper)
85  , scope_(scope)
86  {}
88 
89  virtual void load() override;
90  virtual void unload() override;
91 
93  { return *this->wrapper_; }
94 
95  private:
98  };
99 
101 }
102 
103 #endif /* __ScopedSingletonIncludes_H__ */
Shared library macros, enums, constants and forward declarations for the core library ...
ScopedSingletonWrapper * wrapper_
Definition: ScopedSingletonIncludes.h:96
ScopedSingletonWrapper & getWrapper()
Definition: ScopedSingletonIncludes.h:92
~StaticallyInitializedScopedSingletonWrapper()
Definition: ScopedSingletonIncludes.h:87
Definition: ScopedSingletonIncludes.h:79
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
ScopeID::Value scope_
Definition: ScopedSingletonIncludes.h:97
StaticallyInitializedScopedSingletonWrapper(ScopedSingletonWrapper *wrapper, ScopeID::Value scope)
Definition: ScopedSingletonIncludes.h:82
Definition: StaticallyInitializedInstance.h:36
Base class of ClassScopedSingletonWrapper.
Definition: ScopedSingletonWrapper.h:59
#define _CoreExport
Definition: CorePrereqs.h:61
StaticallyInitializedScopedSingletonWrapper SI_SSW
Definition: ScopedSingletonIncludes.h:100
Definition of orxonox::ScopedSingletonWrapper and orxonox::ClassScopedSingletonWrapper.
int Value
Definition: CorePrereqs.h:82
static constexpr Type SCOPED_SINGLETON_WRAPPER
Definition: CorePrereqs.h:95