Orxonox  0.0.5 Codename: Arcturus
MemoryWriter.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 _MemoryWriter_H__
36 #define _MemoryWriter_H__
37 
38 #include "util/UtilPrereqs.h"
39 #include "OutputListener.h"
40 
41 namespace orxonox
42 {
55  {
57  struct Message
58  {
60  Message(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
61  : level(level), context(&context), lines(lines) {}
62 
65  std::vector<std::string> lines;
66  };
67 
68  public:
69  MemoryWriter();
70  virtual ~MemoryWriter();
71 
72  void resendOutput(OutputListener* listener) const;
73  void disable();
74 
75  protected:
76  virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines) override;
77 
78  private:
79  // non-copyable:
80  MemoryWriter(const MemoryWriter&) = delete;
81  MemoryWriter& operator=(const MemoryWriter&) = delete;
82 
83  std::vector<Message> messages_;
84  };
85 }
86 
87 #endif /* _MemoryWriter_H__ */
#define _UtilExport
Definition: UtilPrereqs.h:60
A helper struct which is used to store output and its properties.
Definition: MemoryWriter.h:57
Stores all information about a context.
Definition: OutputDefinitions.h:112
OutputLevel
Output levels define type and importance of an output message.
Definition: OutputDefinitions.h:84
MemoryWriter is a singleton which is derived from OutputListener and writes all output to a list...
Definition: MemoryWriter.h:54
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the util library ...
Message(OutputLevel level, const OutputContextContainer &context, const std::vector< std::string > &lines)
Constructor, assigns all values.
Definition: MemoryWriter.h:60
OutputListener is an interface which is used to receive output of a certain level and context from Ou...
Definition: OutputListener.h:51
Declaration of the OutputListener interface which receives output from orxonox::OutputManager.
OutputLevel level
The level of the output message.
Definition: MemoryWriter.h:63
const OutputContextContainer * context
The context of the output message.
Definition: MemoryWriter.h:64
std::vector< std::string > lines
The lines of text of the output message.
Definition: MemoryWriter.h:65
std::vector< Message > messages_
Stores all output messages from the creation of this instance until disable() is called.
Definition: MemoryWriter.h:83