OpendTect  6.3
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 ________________________________________________________________________
10 
11 -*/
12 
13 #include "basicmod.h"
14 #include "od_stream.h"
15 
16 class DBKey;
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 File::Path& fp, bool useexist=false )
33  : od_stream(fp,true,useexist) {}
34  od_ostream( std::ostream* s )
35  : od_stream(s) {}
36  od_ostream( std::ostream& s )
37  : od_stream(s) {}
38  od_ostream(const od_ostream&) = delete;
40  od_ostream& operator=(const od_ostream&) = delete;
42 
43  bool open(const char*,bool useexist=false);
44 
45  od_ostream& add(char);
46  od_ostream& add(unsigned char);
47  od_ostream& add(const char*);
48  od_ostream& add(od_int16);
49  od_ostream& add(od_uint16);
50  od_ostream& add(od_int32);
51  od_ostream& add(od_uint32);
52  od_ostream& add(od_int64);
53  od_ostream& add(od_uint64);
54 #ifdef __lux64__
55  od_ostream& add(long long);
56  od_ostream& add(unsigned long long);
57 #else
58  od_ostream& add(long);
59  od_ostream& add(unsigned long);
60 #endif
61  //add clean numbers to the string, no 1.50000001 but 1.5
62  od_ostream& add(float);
63  od_ostream& add(double);
64 
65  //add precise numbers to the string, 1.50000001 is left as is.
66  od_ostream& addPrecise(float);
67  od_ostream& addPrecise(double);
68 
69  od_ostream& add(const OD::String&);
70  od_ostream& add(const uiString&);
71  od_ostream& add(const IOPar&);
72  od_ostream& add(const SeparString&);
73  od_ostream& add(const CompoundKey&);
74  od_ostream& add(const DBKey&);
75 
76  od_ostream& add(const void*);
77  od_ostream& addPtr(const void*);
78  od_ostream& add(od_istream&);
79  od_ostream& add( od_ostream& ) { return *this; }
80 
81  bool addBin(const void*,Count nrbytes);
82  template <class T>
83  od_ostream& addBin(const T&);
84 
85  std::ostream& stdStream();
86  void flush();
87 
88  static od_ostream& nullStream();
89  static od_ostream& logStream();
90 
91 };
92 
93 
95 inline mGlobal(Basic) od_ostream& od_cout() { return od_ostream::logStream(); }
96 
98 mGlobal(Basic) od_ostream& od_cerr();
99 
100 
101 
102 template <class T>
103 inline od_ostream& operator <<( od_ostream& s, const T& t )
104 { return s.add( t ); }
105 
106 
107 inline od_ostream& od_endl( od_ostream& strm )
108 {
109  strm.add( od_newline ).flush();
110  return strm;
111 }
112 
113 
114 mGlobal(Basic) std::ostream& od_endl( std::ostream& strm );
115 //Just to give linker errors
116 
117 
118 typedef od_ostream& (*od_ostreamFunction)(od_ostream&);
120 { return (*fn)( s ); }
121 
122 template <class T>
123 inline od_ostream& od_ostream::addBin( const T& t )
124 {
125  addBin( &t, sizeof(T) );
126  return *this;
127 }
#define mExpClass(module)
Definition: commondefs.h:157
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:25
od_ostream(std::ostream *s)
Definition: od_ostream.h:34
#define mGlobal(module)
Definition: commondefs.h:160
OD::String that holds an existing text string.
Definition: fixedstring.h:27
od_ostream(const char *fnm, bool useexist=false)
Definition: od_ostream.h:30
#define od_int64
Definition: plftypes.h:34
od_ostream & od_endl(od_ostream &strm)
Definition: od_ostream.h:107
bool addBin(const void *, Count nrbytes)
od_ostream & add(char)
List encoded in a string.
Definition: separstr.h:32
File pathname tools.
Definition: filepath.h:35
Definition: uistring.h:88
OD base class for stream read/write.
Definition: od_stream.h:52
od_ostream & od_cout()
Never redirected.
Definition: od_ostream.h:95
uiString & operator=(const uiString &)
no copy, ref counted
OD class for stream read.
Definition: od_istream.h:23
void flush()
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
#define od_uint32
Definition: plftypes.h:30
static od_ostream & logStream()
used by ErrMsg and UsrMsg
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:29
od_ostream & operator<<(od_ostream &s, const T &t)
Definition: od_ostream.h:103
od_stream_Count Count
Definition: od_stream.h:53
od_ostream &(* od_ostreamFunction)(od_ostream &)
Definition: od_ostream.h:118
#define od_int16
Definition: plftypes.h:25
#define od_uint64
Definition: plftypes.h:35
#define od_int32
Definition: plftypes.h:29
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager...
Definition: compoundkey.h:21
od_ostream & od_cerr()
od_ostream()
Definition: od_ostream.h:29
od_ostream & add(od_ostream &)
Definition: od_ostream.h:79
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
#define od_uint16
Definition: plftypes.h:26
od_ostream(const File::Path &fp, bool useexist=false)
Definition: od_ostream.h:32
od_ostream(std::ostream &s)
Definition: od_ostream.h:36
#define od_newline
Definition: od_iosfwd.h:23

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