OpendTect-6_4  6.4
iodir.h
Go to the documentation of this file.
1 #ifndef iodir_H
2 #define iodir_H
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 31-7-1995
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "generalmod.h"
17 #include "multiid.h"
18 #include "objectset.h"
19 #include "namedobj.h"
20 #include "od_iosfwd.h"
21 class IOObj;
22 
23 
24 /*\brief 'Directory' of IOObj objects.
25 
26 The IODir class is responsible for finding all IOObj's in the system. An IODir
27 instance will actually load all IOObj's, provides access to keys and allows
28 searching. It has a key of its own.
29 
30 Few operation are done through the IODir directly: usually, IOMan will be
31 the service access point.
32 
33 */
34 
35 
36 mExpClass(General) IODir : public NamedObject
37 {
38 public:
39  IODir(const char*);
40  IODir(const MultiID&);
41  ~IODir();
42  void reRead();
43  bool isBad() const { return !isok_; }
44  const MultiID& key() const { return key_; }
45 
46  const IOObj* main() const;
47  const char* dirName() const { return dirname_; }
48 
49  int size() const { return objs_.size(); }
50  int isEmpty() const { return objs_.isEmpty(); }
51  const IOObj* get( int idx ) const { return objs_[idx]; }
52  const ObjectSet<IOObj>& getObjs() const { return objs_; }
53 
54  bool isPresent(const MultiID&) const;
55  int indexOf(const MultiID&) const;
56  const IOObj* get(const MultiID&) const;
57  const IOObj* get(const char* nm,const char* trgrpnm=0) const;
58  // Without trgrpnm, just returns first
59 
60  bool addObj(IOObj*,bool immediate_store=true);
62  bool commitChanges(const IOObj*);
64  bool permRemove(const MultiID&);
65  bool ensureUniqueName(IOObj&);
66 
67  static IOObj* getObj(const MultiID&);
68  static IOObj* getMain(const char*);
69 
70  // Use this if you know there's no contingency
71  // Therefore, only in special-purpose programs
72  bool doWrite() const;
73 
74 private:
75 
79  bool isok_;
80  mutable int curid_;
81 
82  IODir();
83  static bool create(const char* dirnm,const MultiID&,IOObj* mainobj);
84  static IOObj* doRead(const char*,IODir*,int id=-1);
85  static void setDirName(IOObj&,const char*);
86  static IOObj* readOmf(od_istream&,const char*,IODir*,int);
87 
88  bool build();
89  bool wrOmf(od_ostream&) const;
90  IOObj* get( int idx ) { return objs_[idx]; }
91  IOObj* get(const MultiID&);
92 
93  MultiID newKey() const;
94 
95  friend class IOMan;
96  friend class IOObj;
97 
98 };
99 
100 
101 #endif
MultiID key_
Definition: iodir.h:78
#define mExpClass(module)
Definition: commondefs.h:160
int size() const
Definition: iodir.h:49
bool isok_
Definition: iodir.h:79
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
Definition: ioobj.h:58
friend class IODir
Definition: ioobj.h:136
manages the &#39;Meta-&#39;data store for the IOObj&#39;s. This info is read from the .omf files.
Definition: ioman.h:36
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
ObjectSet< IOObj > objs_
Definition: iodir.h:76
virtual void setDirName(const char *s)
Definition: ioobj.h:147
OD class for stream read.
Definition: od_istream.h:24
const MultiID & key() const
Definition: iodir.h:44
int isEmpty() const
Definition: iodir.h:50
BufferString dirname_
Definition: iodir.h:77
const ObjectSet< IOObj > & getObjs() const
Definition: iodir.h:52
bool isBad() const
Definition: iodir.h:43
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
MultiID key_
Definition: ioobj.h:122
static uiHor3DInterpol * create(uiParent *)
Object with a name.
Definition: namedobj.h:35
int main(int argc, char **argv)
Definition: iodir.h:36
int curid_
Definition: iodir.h:80
Compound key consisting of ints.
Definition: multiid.h:25
const char * dirName() const
Definition: iodir.h:47

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