OpendTect  6.6
iostrm.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: A.H. Bril
8  Date: 2-8-1995
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "streamconn.h"
17 #include "filespec.h"
18 #include "ioobj.h"
19 class StreamProvider;
20 
21 
22 /*\brief is a file entry in the omf. */
23 
24 
25 mExpClass(General) IOStream : public IOObj
26 {
27 public:
28  IOStream(const char* nm=0,const char* id=0,
29  bool =false);
30  IOStream(const IOStream&);
31  virtual bool isBad() const;
32 
33  virtual void copyFrom(const IOObj*);
34  virtual const char* fullUserExpr(bool forread=true) const;
35  virtual BufferString mainFileName() const;
36  virtual const char* connType() const;
37  virtual Conn* getConn(bool) const;
38 
39  virtual bool implExists(bool forread) const;
40  virtual bool implReadOnly() const;
41  virtual bool implRemove() const;
42  virtual bool implSetReadOnly(bool) const;
43  virtual bool implRename(const char*,const CallBack* cb=0);
44  virtual bool implManagesObjects() const { return false; }
45 
46  bool isMultiConn() const { return isMulti(); }
47  int curConnIdx() const { return curfidx_; }
48  void resetConnIdx() const { curfidx_ = 0; }
49  int connIdxFor(int nr) const;
50  bool toNextConnIdx() const
51  { curfidx_++; return curfidx_ < nrFiles(); }
52  void setConnIdx( int idx ) const
53  { curfidx_ = idx; }
54 
55  FileSpec& fileSpec() { return fs_; }
56  const FileSpec& fileSpec() const { return fs_; }
57  void setExt( const char* ext ) { extension_ = ext; }
58  void genFileName();
59 
60  int nrFiles() const { return fs_.nrFiles();}
61  bool isMulti() const { return nrFiles()>1; }
62 
63 protected:
64 
65  virtual bool getFrom(ascistream&);
66  virtual bool putTo(ascostream&) const;
67 
69  mutable int curfidx_;
72 
73  StreamProvider* getStreamProv(bool,bool f=true) const;
74  bool implDoAll(bool,bool yn=true) const;
75 
76 public:
77 
78  virtual void setDirName(const char*);
79  virtual void setAbsDirectory(const char*);
80 
81 };
82 
83 
IOStream::extension_
BufferString extension_
Definition: iostrm.h:70
IOStream::curConnIdx
int curConnIdx() const
Definition: iostrm.h:47
IOStream::setConnIdx
void setConnIdx(int idx) const
Definition: iostrm.h:52
IOStream::genFileName
void genFileName()
IOStream::implSetReadOnly
virtual bool implSetReadOnly(bool) const
IOStream::getFrom
virtual bool getFrom(ascistream &)
Conn
Data connection.
Definition: conn.h:30
IOStream::isBad
virtual bool isBad() const
IOStream::specfname_
BufferString specfname_
Definition: iostrm.h:71
IOStream::getConn
virtual Conn * getConn(bool) const
FileSpec
Specification for one or more files.
Definition: filespec.h:28
IOStream::mainFileName
virtual BufferString mainFileName() const
IOStream::implDoAll
bool implDoAll(bool, bool yn=true) const
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
IOStream::curfidx_
int curfidx_
Definition: iostrm.h:69
IOStream::implRename
virtual bool implRename(const char *, const CallBack *cb=0)
IOStream::fileSpec
FileSpec & fileSpec()
Definition: iostrm.h:55
ascostream
OpendTect standard ascii format file writing.
Definition: ascstream.h:32
IOStream::setDirName
virtual void setDirName(const char *)
CallBack
CallBacks object-oriented (object + method).
Definition: callback.h:62
IOStream::putTo
virtual bool putTo(ascostream &) const
IOStream::IOStream
IOStream(const IOStream &)
StreamProvider
Provides I/O stream for file or system command.
Definition: strmprov.h:39
IOStream::nrFiles
int nrFiles() const
Definition: iostrm.h:60
IOStream::implRemove
virtual bool implRemove() const
IOObj
Definition: ioobj.h:58
IOStream::connType
virtual const char * connType() const
IOStream::fullUserExpr
virtual const char * fullUserExpr(bool forread=true) const
IOStream::setExt
void setExt(const char *ext)
Definition: iostrm.h:57
IOStream::IOStream
IOStream(const char *nm=0, const char *id=0, bool=false)
IOStream
Definition: iostrm.h:26
IOStream::fs_
FileSpec fs_
Definition: iostrm.h:68
IOStream::resetConnIdx
void resetConnIdx() const
Definition: iostrm.h:48
IOStream::setAbsDirectory
virtual void setAbsDirectory(const char *)
filespec.h
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
IOStream::fileSpec
const FileSpec & fileSpec() const
Definition: iostrm.h:56
IOStream::isMulti
bool isMulti() const
Definition: iostrm.h:61
IOStream::implManagesObjects
virtual bool implManagesObjects() const
Definition: iostrm.h:44
ascistream
OpendTect standard ascii format file reading.
Definition: ascstream.h:83
IOStream::copyFrom
virtual void copyFrom(const IOObj *)
IOStream::implExists
virtual bool implExists(bool forread) const
IOStream::isMultiConn
bool isMultiConn() const
Definition: iostrm.h:46
IOStream::connIdxFor
int connIdxFor(int nr) const
IOStream::implReadOnly
virtual bool implReadOnly() const
IOStream::toNextConnIdx
bool toNextConnIdx() const
Definition: iostrm.h:50
ioobj.h
IOStream::getStreamProv
StreamProvider * getStreamProv(bool, bool f=true) const
streamconn.h

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