C++ TargetRTS
Loading...
Searching...
No Matches
RTDiagStream.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. 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 __RTDiagStream_h__
11#define __RTDiagStream_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTConfig_h__
18#include <RTConfig.h>
19#endif
20
21#if RTUseCPP11
22#include <cstdint>
23#include <type_traits>
24#endif
25
26#include <iosfwd>
27
28class RTDataObject;
29class RTMutex;
30struct RTObject_class;
31struct RTTimespec;
32
33// It is safe to ignore the return value of these functions.
34//lint -esym(534,RTDiagStream::lock)
35//lint -esym(534,operator<<)
36//lint -esym(534,RTDiagStream::unlock)
37//lint -esym(534,RTDiagStream::write)
38
40{
41public:
42 RTDiagStream( void );
43 ~RTDiagStream( void );
44
45 RTS_INLINE RTDiagStream & lock( void );
46 RTDiagStream & write( const char * );
47#if OBJECT_ENCODE
48 RTDiagStream & write( const void *, const RTObject_class * );
49#endif
50 void flush( void );
51 RTS_INLINE void setMirror( std::ostream* m );
52 RTS_INLINE void clearMirror( void );
53
54 RTS_INLINE RTDiagStream & unlock( void );
55
56private:
57#if USE_THREADS
58 RTMutex * _mutex;
59#endif
60
61 std::ostream * mirror;
62 // unavailable methods
63 RTDiagStream( const RTDiagStream & );
64 RTDiagStream & operator=( const RTDiagStream & );
65};
66
67RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, const char * );
68 RTDiagStream & operator<<( RTDiagStream &, const char * const * );
69 RTDiagStream & operator<<( RTDiagStream &, const void * );
70 RTDiagStream & operator<<( RTDiagStream &, long );
71 RTDiagStream & operator<<( RTDiagStream &, unsigned long );
72
73#if RTUseCPP11
74 template<typename T>
75 typename std::enable_if<std::is_same<T, int64_t>::value, RTDiagStream&>::type
76 operator<<( RTDiagStream& ds, T value );
77
78 template<typename T>
79 typename std::enable_if<std::is_same<T, uint64_t>::value, RTDiagStream&>::type
80 operator<<( RTDiagStream& ds, T value );
81#endif
82
83RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, char );
84RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, unsigned char );
85RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, short );
86RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, unsigned short );
87RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, int );
88RTS_INLINE RTDiagStream & operator<<( RTDiagStream &, unsigned );
89
90#if RTS_INLINES
91#include <RTDiagStream.inl>
92#endif
93
94#endif // __RTDiagStream_h__
Provides a common interface to certain data type implementations (e.g.
Definition: RTDataObject.h:33
Definition: RTDiagStream.h:40
A type descriptor providing information about a type.
Definition: RTObject_class.h:64
A time value which can represent either an absolute or relative time.
Definition: RTTimespec.h:29