Orxonox  0.0.5 Codename: Arcturus
OutputDefinitions.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  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
35 #ifndef _OutputDefinitions_H__
36 #define _OutputDefinitions_H__
37 
38 #include "util/UtilPrereqs.h"
39 #include <string>
40 
49 #ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
50  #define REGISTER_OUTPUT_CONTEXT(name) \
51  inline const OutputContextContainer& name() { static OutputContextContainer context = registerContext(#name); return context; }
52 #else
53  #define REGISTER_OUTPUT_CONTEXT(name) \
54  inline const OutputContextContainer& name() { return registerContext(#name); }
55 #endif
56 
67 #ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
68  #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
69  inline const OutputContextContainer& subname() { static const OutputContextContainer context = registerContext(#name, #subname); return context; }
70 #else
71  #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
72  inline const OutputContextContainer& subname() { return registerContext(#name, #subname); }
73 #endif
74 
75 // tolua_begin
76 namespace orxonox
77 {
78  namespace level
79  {
85  {
86  all = 0xFFFF,
87  none = 0x0000,
88 
89  message = 0x0001,
90  debug_output = 0x0002,
91  user_error = 0x0004,
92  user_warning = 0x0008,
93  user_status = 0x0010,
94  user_info = 0x0020,
95  internal_error = 0x0040,
96  internal_warning = 0x0080,
97  internal_status = 0x0100,
98  internal_info = 0x0200,
99  verbose = 0x0400,
100  verbose_more = 0x0800,
101  verbose_ultra = 0x1000
102  };
103  }
104 // tolua_end
105 
106  using namespace level;
107 
108  typedef uint64_t OutputContextMask;
109  typedef uint16_t OutputContextSubID;
110 
113  {
114  OutputContextMask mask;
115  OutputContextSubID sub_id;
117 
118  inline bool operator==(const OutputContextContainer& other) const
119  {
120  return this->mask == other.mask && this->sub_id == other.sub_id && this->name == other.name;
121  }
122  };
123 
125 
130  extern _UtilExport const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
131 
132  namespace context
133  {
134  static constexpr OutputContextMask all = 0xFFFFFFFFFFFFFFFFull;
135  static constexpr OutputContextMask none = 0x0000000000000000ull;
136 
137  static constexpr OutputContextSubID no_subcontext = 0;
138 
139  namespace
140  {
141  REGISTER_OUTPUT_CONTEXT(undefined);
142 
147  REGISTER_OUTPUT_CONTEXT(identifier);
148  REGISTER_OUTPUT_CONTEXT(object_list);
150  REGISTER_OUTPUT_CONTEXT(language);
151  REGISTER_OUTPUT_CONTEXT(commands);
153  REGISTER_OUTPUT_CONTEXT(events);
154  REGISTER_OUTPUT_CONTEXT(config);
155  REGISTER_OUTPUT_CONTEXT(templates);
156  REGISTER_OUTPUT_CONTEXT(loader);
159  REGISTER_OUTPUT_CONTEXT(packets);
160  REGISTER_OUTPUT_CONTEXT(master_server);
163  REGISTER_OUTPUT_CONTEXT(pickups);
164  REGISTER_OUTPUT_CONTEXT(quests);
165  REGISTER_OUTPUT_CONTEXT(notifications);
166  REGISTER_OUTPUT_CONTEXT(triggers);
167  REGISTER_OUTPUT_CONTEXT(docking);
168 
169  namespace misc
170  {
171  REGISTER_OUTPUT_SUBCONTEXT(misc, executor);
172  REGISTER_OUTPUT_SUBCONTEXT(misc, gui);
173  REGISTER_OUTPUT_SUBCONTEXT(misc, overlays);
174  REGISTER_OUTPUT_SUBCONTEXT(misc, script);
175  }
176  }
177  }
178 } // tolua_export
179 
180 #endif /* _OutputDefinitions_H__ */
Output level, used to notify the user about the program&#39;s state.
Definition: OutputDefinitions.h:93
#define _UtilExport
Definition: UtilPrereqs.h:60
static constexpr OutputContextSubID no_subcontext
Used as ID for contexts which are not sub-contexts.
Definition: OutputDefinitions.h:137
OutputContextMask mask
The mask of the context (or the mask of the main-context if this container defines a sub-context) ...
Definition: OutputDefinitions.h:114
bool operator==(const OutputContextContainer &other) const
Definition: OutputDefinitions.h:118
Stores all information about a context.
Definition: OutputDefinitions.h:112
OutputContextSubID sub_id
The id of the sub-context (or context::no_subcontext if this container doesn&#39;t define a sub-context) ...
Definition: OutputDefinitions.h:115
::std::string string
Definition: gtest-port.h:756
Output level, usually not visible, used for unimportant debug information.
Definition: OutputDefinitions.h:99
Output level, used for warnings which are important for developers.
Definition: OutputDefinitions.h:96
Output level, used for messages directed to the user (e.g. "Press any key to continue") ...
Definition: OutputDefinitions.h:89
#define REGISTER_OUTPUT_SUBCONTEXT(name, subname)
Defines a sub-context.
Definition: OutputDefinitions.h:68
Output level, usually not visible, used for unimportant debug information (even less important than v...
Definition: OutputDefinitions.h:101
OutputLevel
Output levels define type and importance of an output message.
Definition: OutputDefinitions.h:84
Output level, used to log the program&#39;s internal state in the log file.
Definition: OutputDefinitions.h:97
Output level, used for error messages which are important for developers.
Definition: OutputDefinitions.h:95
Level mask with all bits set to 0.
Definition: OutputDefinitions.h:87
Output level, used for error messages which are important for the user.
Definition: OutputDefinitions.h:91
_UtilExport const OutputContextContainer & registerContext(const std::string &name, const std::string &subname="")
Registers a context.
Definition: OutputManager.cc:260
Output level, used for temporary debug output while writing code.
Definition: OutputDefinitions.h:90
uint16_t OutputContextSubID
Used to store the IDs of sub-contexts. Each number except context::no_subcontext defines a sub-contex...
Definition: OutputDefinitions.h:109
#define REGISTER_OUTPUT_CONTEXT(name)
Defines a context function with a given name.
Definition: OutputDefinitions.h:50
std::string name
The name of this context.
Definition: OutputDefinitions.h:116
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the util library ...
Output level, usually not visible, used for unimportant debug information (less important than verbos...
Definition: OutputDefinitions.h:100
The Scripts&#39; code is executed through lua.
Level mask with all bits set to 1.
Definition: OutputDefinitions.h:86
Output level, used to log information about the program&#39;s progress in the log file.
Definition: OutputDefinitions.h:98
const OutputContextContainer &( OutputContextFunction)()
Definition: OutputDefinitions.h:124
Output level, used for warnings which are important for the user.
Definition: OutputDefinitions.h:92
uint64_t OutputContextMask
Used to store the context masks. Each bit defines a context.
Definition: OutputDefinitions.h:108
Output level, used to provide the user with additional progress information.
Definition: OutputDefinitions.h:94