Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/output/src/libraries/util/output/OutputDefinitions.h @ 8835

Last change on this file since 8835 was 8835, checked in by landauf, 13 years ago

cleaned up contexts, added some sub-contexts and made some output verbose

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
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
29#ifndef _OutputDefinitions_H__
30#define _OutputDefinitions_H__
31
32#include "util/UtilPrereqs.h"
33#include <string>
34
35#define REGISTER_OUTPUT_CONTEXT(name) \
36    const OutputContextContainer& name() { static const OutputContextContainer& context = registerContext(#name); return context; }
37
38#define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
39    const OutputContextContainer& subname() { static const OutputContextContainer& context = registerContext(#name, #subname); return context; }
40
41namespace orxonox
42{
43    namespace level
44    {
45        enum OutputLevel
46        {
47            all              = 0xFFFF,
48            none             = 0x0000,
49
50            message          = 0x0001,
51            debug_output     = 0x0002,
52            user_error       = 0x0004,
53            user_warning     = 0x0008,
54            user_status      = 0x0010,
55            user_info        = 0x0020,
56            internal_error   = 0x0040,
57            internal_warning = 0x0080,
58            internal_status  = 0x0100,
59            internal_info    = 0x0200,
60            verbose          = 0x0400,
61            verbose_more     = 0x0800,
62            verbose_ultra    = 0x1000
63        };
64    }
65
66    using namespace level;
67
68    typedef uint64_t OutputContextMask;
69    typedef uint16_t OutputContextSubID;
70
71    struct OutputContextContainer
72    {
73        OutputContextMask mask;
74        OutputContextSubID sub_id;
75        std::string name;
76    };
77
78    typedef const OutputContextContainer& (OutputContextFunction)();
79
80    extern _UtilExport const OutputContextContainer& registerContext(const std::string& name, const std::string& subname = "");
81
82    namespace context
83    {
84        static const OutputContextMask all       = 0xFFFFFFFFFFFFFFFF;
85        static const OutputContextMask none      = 0x0000000000000000;
86
87        static const OutputContextSubID no_subcontext = 0;
88
89        namespace
90        {
91            REGISTER_OUTPUT_CONTEXT(undefined);
92
93            REGISTER_OUTPUT_CONTEXT(ogre);
94            REGISTER_OUTPUT_CONTEXT(cegui);
95            REGISTER_OUTPUT_CONTEXT(lua);
96            REGISTER_OUTPUT_CONTEXT(tcl);
97            REGISTER_OUTPUT_CONTEXT(identifier);
98            REGISTER_OUTPUT_CONTEXT(object_list);
99            REGISTER_OUTPUT_CONTEXT(super);
100            REGISTER_OUTPUT_CONTEXT(language);
101            REGISTER_OUTPUT_CONTEXT(commands);
102            REGISTER_OUTPUT_CONTEXT(input);
103            REGISTER_OUTPUT_CONTEXT(events);
104            REGISTER_OUTPUT_CONTEXT(config);
105            REGISTER_OUTPUT_CONTEXT(templates);
106            REGISTER_OUTPUT_CONTEXT(loader);
107            REGISTER_OUTPUT_CONTEXT(xml);
108            REGISTER_OUTPUT_CONTEXT(network);
109            REGISTER_OUTPUT_CONTEXT(packets);
110            REGISTER_OUTPUT_CONTEXT(master_server);
111            REGISTER_OUTPUT_CONTEXT(sound);
112            REGISTER_OUTPUT_CONTEXT(lod);
113            REGISTER_OUTPUT_CONTEXT(pickups);
114            REGISTER_OUTPUT_CONTEXT(quests);
115            REGISTER_OUTPUT_CONTEXT(notifications);
116            REGISTER_OUTPUT_CONTEXT(triggers);
117            REGISTER_OUTPUT_CONTEXT(docking);
118
119            namespace misc
120            {
121                REGISTER_OUTPUT_SUBCONTEXT(misc, executor);
122                REGISTER_OUTPUT_SUBCONTEXT(misc, factory);
123                REGISTER_OUTPUT_SUBCONTEXT(misc, gui);
124                REGISTER_OUTPUT_SUBCONTEXT(misc, overlays);
125                REGISTER_OUTPUT_SUBCONTEXT(misc, script);
126            }
127
128        }
129    }
130}
131
132#endif /* _OutputDefinitions_H__ */
Note: See TracBrowser for help on using the repository browser.