OpendTect-6_4  6.4
multiid.h
Go to the documentation of this file.
1 #ifndef multiid_h
2 #define multiid_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: 15-1-2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "compoundkey.h"
17 #include "string2.h"
18 #include "fixedstring.h"
19 
20 
25 mExpClass(Basic) MultiID : public CompoundKey
26 {
27 public:
28  MultiID(const FixedString& s)
29  : CompoundKey(s) {}
30  MultiID( const char* s=0 )
31  : CompoundKey(s) {}
32  MultiID( const MultiID& mid )
33  : CompoundKey(mid) {}
34  MultiID( int i )
35  { add(i); }
36  MultiID( int i1, int i2 )
37  { add(i1); add(i2); }
38  MultiID( int i1, int i2, int i3 )
39  { add(i1); add(i2); add(i3); }
40 
41  inline MultiID& operator =( const MultiID& mi )
42  { impl_ = mi.impl_; return *this; }
43  inline MultiID& operator =( const CompoundKey& ck )
44  { impl_ = ck.buf(); return *this; }
45  inline MultiID& operator =( const FixedString& fs )
46  { impl_ = fs.str(); return *this; }
47  inline MultiID& operator =( const char* s )
48  { impl_ = s; return *this; }
49 
50  inline bool operator==( const MultiID& m ) const
51  { return impl_ == m.impl_; }
52  inline bool operator==( const char* s ) const
53  { return impl_ == s; }
54 
55  inline int ID( int idx ) const
56  { return key(idx).toInt(); }
57  inline void setID( int idx, int i )
58  { setKey( idx, toString(i) ); }
59  int leafID() const;
60  MultiID parent() const;
61 
62  inline MultiID& add( int i )
63  { *this += toString(i); return *this; }
64 
65  static const MultiID& udf();
66  inline void setUdf() { *this = udf(); }
67  inline bool isUdf() const { return *this == udf(); }
68 };
69 
70 #endif
#define mExpClass(module)
Definition: commondefs.h:160
const char * str() const
Definition: odstring.h:48
MultiID(int i1, int i2, int i3)
Definition: multiid.h:38
void setUdf()
Definition: multiid.h:66
MultiID(const char *s=0)
Definition: multiid.h:30
OD::String that holds an existing text string.
Definition: fixedstring.h:29
MultiID & add(int i)
Definition: multiid.h:62
MultiID(int i)
Definition: multiid.h:34
MultiID(int i1, int i2)
Definition: multiid.h:36
MultiID(const FixedString &s)
Definition: multiid.h:28
bool operator==(const MultiID &m) const
Definition: multiid.h:50
void setID(int idx, int i)
Definition: multiid.h:57
const char * buf() const
Definition: compoundkey.h:44
MultiID(const MultiID &mid)
Definition: multiid.h:32
Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager...
Definition: compoundkey.h:23
int ID(int idx) const
Definition: multiid.h:55
bool operator==(const char *s) const
Definition: multiid.h:52
bool isUdf() const
Definition: multiid.h:67
BufferString impl_
Definition: compoundkey.h:56
Export_Basic const char * toString(ViewStyle)
Compound key consisting of ints.
Definition: multiid.h:25

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