C++ TargetRTS
Loading...
Searching...
No Matches
RTLogStream.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2025. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTLogStream_h__
11#define __RTLogStream_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16#if RTS_LOGSTREAM
17#include <fstream>
18#include <string>
19#include <iostream>
20
21#include <RTLog.h>
22
23class RTLogStream
24{
25private:
26 std::ofstream ofStream;
27 Log::Base* baseStream;
28 bool ownsStream;
29
30 // unavailable methods
31 RTLogStream( const RTLogStream & );
32 RTLogStream & operator=( const RTLogStream & );
33
34public:
43 RTLogStream( const char * filename, bool overwrite = true );
44
48 RTLogStream( std::ostream* stdStreamPtr );
49
53 RTLogStream( Log::Base* baseStreamPtr );
54 ~RTLogStream();
55
60 RTLogStream& operator<<( const RTTypedValue & info );
61
65 RTLogStream& operator<<(std::ostream& (*manip)(std::ostream&));
66
70 template <typename T>
71 RTLogStream& operator<<(const T& value)
72 {
73 if (baseStream)
74 {
75 (*baseStream) << value;
76 }
77 return *this;
78 }
79};
80#endif
81#endif // __RTLogStream_h__
Represents a log port.
Definition: RTLog.h:38
Encapsulates a data object and its type descriptor.
Definition: RTTypedValue.h:29