OpendTect  6.6
od_ostream.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: Sep 2013
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "basicmod.h"
15 #include "od_stream.h"
16 
17 class SeparString;
18 class CompoundKey;
19 class FixedString;
20 class uiString;
21 
22 
26 {
27 public:
28 
30  od_ostream( const char* fnm, bool useexist=false )
31  : od_stream(fnm,true,useexist) {}
32  od_ostream( const FilePath& fp, bool useexist=false )
33  : od_stream(fp,true,useexist) {}
35  const char* workdir=nullptr )
36  : od_stream(mc,workdir,true) {}
37  od_ostream( std::ostream* s )
38  : od_stream(s) {}
39  od_ostream( std::ostream& s )
40  : od_stream(s) {}
41  od_ostream(const od_ostream&) = delete;
43  od_ostream& operator=(const od_ostream&) = delete;
45 
46  bool open(const char*,bool useexist=false);
47 
48  od_ostream& add(char);
49  od_ostream& add(unsigned char);
50  od_ostream& add(const char*);
57 #ifdef __lux64__
58  od_ostream& add(long long);
59  od_ostream& add(unsigned long long);
60 #else
61  od_ostream& add(long);
62  od_ostream& add(unsigned long);
63 #endif
64  //add clean numbers to the string, no 1.50000001 but 1.5
65  od_ostream& add(float);
66  od_ostream& add(double);
67 
68  //add precise numbers to the string, 1.50000001 is left as is.
71 
74  od_ostream& add(const IOPar&);
77  od_ostream& addTab() { return add( "\t" ); }
78  od_ostream& addNewLine() { return add( "\n" ); }
79 
80  od_ostream& add(const void*);
81  od_ostream& addPtr(const void*);
83  od_ostream& add( od_ostream& ) { return *this; }
84 
85  bool addBin(const void*,Count nrbytes);
86  template <class T>
87  od_ostream& addBin(const T&);
88 
89  std::ostream& stdStream();
90  void flush();
91 
93  static od_ostream& logStream();
94 
97 };
98 
99 
102 {
103  return od_ostream::logStream();
104 }
105 
106 
109 
110 
111 
112 template <class T>
113 inline od_ostream& operator <<( od_ostream& s, const T& t )
114 {
115  return s.add( t );
116 }
117 
118 
119 inline od_ostream& od_endl( od_ostream& strm )
120 {
121  strm.add( od_newline ).flush();
122  return strm;
123 }
124 
125 
126 std::ostream& od_endl(std::ostream&) = delete;
127 
128 
129 typedef od_ostream& (*od_ostreamFunction)(od_ostream&);
131 {
132  return (*fn)( s );
133 }
134 
135 
136 template <class T>
137 inline od_ostream& od_ostream::addBin( const T& t )
138 {
139  addBin( &t, sizeof(T) );
140  return *this;
141 }
142 
143 
od_ostream::addTab
od_ostream & addTab()
Definition: od_ostream.h:77
od_uint64
#define od_uint64
Definition: plftypes.h:36
od_ostream::flush
void flush()
od_ostream::add
od_ostream & add(const OD::String &)
od_ostream::addPtr
od_ostream & addPtr(const void *)
od_ostream::add
od_ostream & add(const char *)
od_newline
#define od_newline
Definition: od_iosfwd.h:24
Pos
Position.
Definition: commontypes.h:78
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
od_ostream::operator=
od_ostream & operator=(od_ostream &&)
od_stream::Count
od_stream_Count Count
Definition: od_stream.h:56
od_endl
od_ostream & od_endl(od_ostream &strm)
Definition: od_ostream.h:119
od_int64
#define od_int64
Definition: plftypes.h:35
od_ostream::add
od_ostream & add(int64_t)
od_ostream::od_ostream
od_ostream(od_ostream &&)
od_ostream::stdStream
std::ostream & stdStream()
od_ostream::add
od_ostream & add(od_ostream &)
Definition: od_ostream.h:83
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
od_ostream::setWritePosition
void setWritePosition(Pos, Ref r=Abs)
od_istream
OD class for stream read common access to the std::cin.
Definition: od_istream.h:24
FilePath
File pathname tools.
Definition: filepath.h:34
od_ostream::addPrecise
od_ostream & addPrecise(float)
od_ostream::od_ostream
od_ostream(std::ostream *s)
Definition: od_ostream.h:37
od_ostream::nullStream
static od_ostream & nullStream()
od_stream::Ref
Ref
Definition: od_stream.h:73
Math::Abs
unsigned int Abs(unsigned int i)
Definition: math2.h:79
od_cout
od_ostream & od_cout()
Never redirected.
Definition: od_ostream.h:101
od_ostream::od_ostream
od_ostream()
Definition: od_ostream.h:29
od_ostream::add
od_ostream & add(uint64_t)
od_ostream::add
od_ostream & add(unsigned char)
od_ostream::add
od_ostream & add(const uiString &)
od_stream.h
od_ostream::od_ostream
od_ostream(const FilePath &fp, bool useexist=false)
Definition: od_ostream.h:32
od_int16
#define od_int16
Definition: plftypes.h:26
od_ostream::od_ostream
od_ostream(std::ostream &s)
Definition: od_ostream.h:39
od_ostream::add
od_ostream & add(short)
SeparString
Definition: separstr.h:136
od_ostreamFunction
od_ostream &(* od_ostreamFunction)(od_ostream &)
Definition: od_ostream.h:129
FixedString
OD::String that holds an existing text string.
Definition: fixedstring.h:29
od_ostream::lastWrittenPosition
Pos lastWrittenPosition() const
od_ostream::add
od_ostream & add(const void *)
produces pErrMsg but works
od_uint16
#define od_uint16
Definition: plftypes.h:27
od_stream
OD base class for stream read/write.
Definition: od_stream.h:56
od_ostream::addNewLine
od_ostream & addNewLine()
Definition: od_ostream.h:78
od_ostream::add
od_ostream & add(unsigned long)
od_ostream::add
od_ostream & add(long)
od_ostream::add
od_ostream & add(int)
od_ostream::add
od_ostream & add(double)
od_ostream::add
od_ostream & add(char)
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
od_ostream::add
od_ostream & add(const CompoundKey &)
od_int32
#define od_int32
Definition: plftypes.h:30
od_ostream::logStream
static od_ostream & logStream()
used by ErrMsg and UsrMsg
od_ostream::add
od_ostream & add(od_istream &)
OD::String
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
operator<<
od_ostream & operator<<(od_ostream &s, const T &t)
Definition: od_ostream.h:113
OS::MachineCommand
Encapsulates an actual command to execute + the machine to run it on.
Definition: oscommand.h:94
od_ostream::add
od_ostream & add(const IOPar &)
od_ostream::open
bool open(const char *, bool useexist=false)
od_ostream::add
od_ostream & add(const SeparString &)
CompoundKey
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager,...
Definition: compoundkey.h:23
od_ostream::addPrecise
od_ostream & addPrecise(double)
od_ostream::od_ostream
od_ostream(const OS::MachineCommand &mc, const char *workdir=nullptr)
Definition: od_ostream.h:34
od_uint32
#define od_uint32
Definition: plftypes.h:31
od_ostream::addBin
bool addBin(const void *, Count nrbytes)
od_ostream::add
od_ostream & add(unsigned int)
od_ostream::operator=
od_ostream & operator=(const od_ostream &)=delete
od_ostream::add
od_ostream & add(float)
od_ostream
OD class for stream write common access to the user log file, or std::cout in other than od_main.
Definition: od_ostream.h:26
od_ostream::od_ostream
od_ostream(const od_ostream &)=delete
od_ostream::od_ostream
od_ostream(const char *fnm, bool useexist=false)
Definition: od_ostream.h:30
od_ostream::add
od_ostream & add(unsigned short)
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
od_cerr
od_ostream & od_cerr()

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021