F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Console.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Posix/Console.hpp
3 // \brief posix implementation for Os::Console, header and test definitions
4 // ======================================================================
5 #include <cstdio>
6 #include <Os/Console.hpp>
7 #ifndef OS_POSIX_Console_HPP
8 #define OS_POSIX_Console_HPP
9 
10 namespace Os {
11 namespace Posix {
12 namespace Console {
13 
18  FILE* m_file_descriptor = stdout;
19 };
20 
28  public:
30  enum Stream {
32  STANDARD_ERROR = 1
33  };
36  PosixConsole() = default;
37 
39  PosixConsole(const PosixConsole& other) = default;
40 
42  PosixConsole& operator=(const PosixConsole& other) = default;
43 
46  ~PosixConsole() override = default;
47 
48  // ------------------------------------
49  // Functions overrides
50  // ------------------------------------
51 
59  void writeMessage(const CHAR *message, const FwSizeType size) override;
60 
61 
69  ConsoleHandle *getHandle() override;
70 
75  void setOutputStream(Stream stream);
76 
77  private:
79  PosixConsoleHandle m_handle;
80 };
81 } // namespace Console
82 } // namespace Posix
83 } // namespace Os
84 
85 #endif // OS_POSIX_Console_HPP
char CHAR
Definition: BasicTypes.h:32
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
posix implementation of Os::ConsoleInterface
Definition: Console.hpp:27
Stream
Stream selection enumeration.
Definition: Console.hpp:30
@ STANDARD_OUT
Use standard output stream.
Definition: Console.hpp:31
@ STANDARD_ERROR
Use standard error stream.
Definition: Console.hpp:32
PosixConsole & operator=(const PosixConsole &other)=default
assignment operator that copies the internal representation
void writeMessage(const CHAR *message, const FwSizeType size) override
write message to console
Definition: Console.cpp:15
PosixConsole()=default
constructor
void setOutputStream(Stream stream)
select the output stream
Definition: Console.cpp:30
ConsoleHandle * getHandle() override
returns the raw console handle
Definition: Console.cpp:26
~PosixConsole() override=default
destructor
PosixConsole(const PosixConsole &other)=default
copy constructor
Base class for storing implementation specific handle information.
Definition: Console.hpp:15
FILE * m_file_descriptor
Posix console file descriptor.
Definition: Console.hpp:18