Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
   Copyright (c) 2018 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software
   and associated documentation files (the "Software"), to deal in the Software
   without restriction,
   including without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
   DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef _CORE_CONSOLE_H_
#define _CORE_CONSOLE_H_

namespace Divide {

constexpr int CONSOLE_OUTPUT_BUFFER_SIZE = 4096 * 16;
constexpr int MAX_CONSOLE_ENTRIES = 128;

class Console : private NonCopyable {
   public:
     enum class EntryType : U8 {
         Info = 0,
         Warning,
         Error,
         Command
    };

    struct OutputEntry {
        stringImplBest _text;
        EntryType _type = EntryType::Info;
    };

    typedef std::function<void(const Console::OutputEntry&)> ConsolePrintCallback;

   public:
    static void start();
    static void stop();

    static void printCopyrightNotice();

    template <typename... T>
    inline static void printfn(const char* format, T&&... args);
    template <typename... T>
    inline static void printf(const char* format, T&&... args);
    template <typename... T>
    inline static void warnfn(const char* format, T&&... args);
    template <typename... T>
    inline static void warnf(const char* format, T&&... args);
    template <typename... T>
    inline static void errorfn(const char* format, T&&... args);
    template <typename... T>
    inline static void errorf(const char* format, T&&... args);

    template <typename... T>
    inline static void d_printfn(const char* format, T&&... args);
    template <typename... T>
    inline static void d_printf(const char* format, T&&... args);
    template <typename... T>
    inline static void d_warnfn(const char* format, T&&... args);
    template <typename... T>
    inline static void d_warnf(const char* format, T&&... args);
    template <typename... T>
    inline static void d_errorfn(const char* format, T&&... args);
    template <typename... T>
    inline static void d_errorf(const char* format, T&&... args);

    template <typename... T>
    inline static void printfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void printf(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void warnfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void warnf(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void errorfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void errorf(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_printfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_printf(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_warnfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_warnf(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_errorfn(std::ofstream& outStream, const char* format, T&&... args);
    template <typename... T>
    inline static void d_errorf(std::ofstream& outStream, const char* format, T&&... args);

    static bool timeStampsEnabled() noexcept { return _timestamps; }
    static void toggleTimeStamps(const bool state) noexcept { _timestamps = state; }

    static bool threadIDEnabled() noexcept { return _threadID; }
    static void togglethreadID(const bool state) noexcept { _threadID = state; }

    static bool enabled() noexcept { return _enabled; }
    static void toggle(const bool state) noexcept { _enabled = state; }

    static bool errorStreamEnabled() noexcept { return _errorStreamEnabled; }
    static void toggleErrorStream(const bool state) noexcept { _errorStreamEnabled = state; }
    static size_t bindConsoleOutput(const ConsolePrintCallback& guiConsoleCallback) {
        _guiConsoleCallbacks.push_back(guiConsoleCallback);
        return _guiConsoleCallbacks.size() - 1;
    }

    static bool unbindConsoleOutput(size_t index) {
        if (index < _guiConsoleCallbacks.size()) {
            _guiConsoleCallbacks.erase(std::begin(_guiConsoleCallbacks) + index);
            return true;
        }
        return false;
    }
   protected:
    static const char* formatText(const char* format, ...) noexcept;
    static void output(const char* text, const bool newline, const EntryType type);
    static void output(std::ostream& outStream, const char* text, const bool newline, const EntryType type);
    static void decorate(std::ostream& outStream, const char* text, const bool newline, const EntryType type);
    static void outThread();

   private:
    static vectorImpl<ConsolePrintCallback> _guiConsoleCallbacks;
    static bool _timestamps;
    static bool _threadID;
    static bool _enabled;
    static bool _errorStreamEnabled;

    static std::atomic_bool _running;
    static std::thread _printThread;
};

};  // namespace Divide

#endif  //_CORE_CONSOLE_H_

#include "Console.inl"

Commits for Divide-Framework/trunk/Source Code/Core/Headers/Console.h

Diff revisions: vs.
Revision Author Commited Message
1029 Diff Diff IonutCava picture IonutCava Tue 30 Jan, 2018 17:28:39 +0000

[Ionut]
- Update copyright notices

1012 Diff Diff IonutCava picture IonutCava Mon 15 Jan, 2018 17:21:32 +0000

[Ionut]
- Update boost to v1.66
- Performance optimizations

993 Diff Diff IonutCava picture IonutCava Sun 10 Dec, 2017 20:07:57 +0000

[Ionut]
- Finished initial port of the old scene graph system to the new ECS based system.
- Finished converting 2 components to the new ECS system: Transform and RigidBody
- Fixed the “Deploy” build error with the CEGUI OpenGL renderer.
- Compilation now needs C++14 support (it’s sufficiently wide-spread now)

977 Diff Diff IonutCava picture IonutCava Mon 20 Nov, 2017 17:13:16 +0000

[Ionut]
- Add an “ApplicationOutput” class that the Editor uses to show console entries and parse commands
- Add “Warning” messages to console outputs

944 Diff Diff IonutCava picture IonutCava Tue 12 Sep, 2017 14:49:05 +0000

[Ionut]
- Fix the Console producer/consumer conditional variable system
- Re-enable Prio queues in TaskPool, but specify only FIFO queues in Kernel (to help debugging later on)

891 Diff Diff IonutCava picture IonutCava Mon 15 May, 2017 16:18:45 +0000

[Ionut]
- Some memory-friendly optimizations

890 Diff Diff IonutCava picture IonutCava Sun 14 May, 2017 20:54:59 +0000

[Ionut]
- Add pre-compiled header support
- Initial code for per-stage tessellation computation

869 Diff Diff IonutCava picture IonutCava Sun 26 Feb, 2017 23:25:54 +0000

[IonutCava]
- Reduce loading time using profile guided optimizations
- Camera/Quaternion work in an attempt to fix a weird Yaw-rotation bug.

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

833 IonutCava picture IonutCava Thu 26 Jan, 2017 22:04:33 +0000

[IonutCava]
- Fix most build errors. Divide-Server does not build for now.