OpendTect  6.3
stratcontent.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: Jan 2012
9 ________________________________________________________________________
10 
11  Impl is in stratlith.cc.
12 
13 -*/
14 
15 #include "stratmod.h"
16 #include "namedobj.h"
17 #include "objectset.h"
18 #include "draw.h"
19 
22 namespace Strat
23 {
24 
28 {
29 public:
30 
31  Content( const char* nm )
32  : NamedObject(nm) {}
33  Content( const Content& c )
34  : NamedObject(c)
35  , pattern_(c.pattern_)
36  , color_(c.color_) {}
37 
38  Content& operator =( const Content& c )
39  {
40  setName(c.name());
41  pattern_=c.pattern_;
42  color_ = c.color_;
43  return *this;
44  }
45  bool operator ==( const Content& c ) const
46  { return name() == c.name(); }
47 
48  inline bool isUnspecified() const
49  { return this == &unspecified(); }
50 
51  static const Content& unspecified();
52 
55 
56  bool getApearanceFrom(const char*);
57  void putAppearanceTo(BufferString&) const;
58 
59 };
60 
61 
63 mGlobal(Strat) inline bool isUnspecified( const Content* ct )
64 {
65  return !ct || ct->isUnspecified();
66 }
67 
68 
72 {
73 public:
74 
75  ~ContentSet() { deepErase(*this); }
76 
77  int getIndexOf(const char*) const;
78 
79  Content* getByName( const char* s )
80  { const int idx = getIndexOf(s); return idx<0 ? 0 : (*this)[idx]; }
81  const Content* getByName( const char* s ) const
82  { return const_cast<ContentSet*>(this)->getByName(s); }
83 
84  const Content& getContent( const char* s ) const
85  { const Content* c = getByName(s); return c ? *c : Content::unspecified(); }
86 
87 };
88 
89 
90 } // namespace Strat
Color color_
Definition: stratcontent.h:53
#define mExpClass(module)
Definition: commondefs.h:157
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
#define mGlobal(module)
Definition: commondefs.h:160
const Content & getContent(const char *s) const
Definition: stratcontent.h:84
bool isUnspecified(const Content *ct)
convenience: contents can be null or unspecified, handle in one go
Definition: stratcontent.h:63
Content * getByName(const char *s)
Definition: stratcontent.h:79
bool isUnspecified() const
Definition: stratcontent.h:48
const Content * getByName(const char *s) const
Definition: stratcontent.h:81
Content(const char *nm)
Definition: stratcontent.h:31
Set of pointers to objects.
Definition: commontypes.h:28
Definition: draw.h:145
static const Content & unspecified()
Content(const Content &c)
Definition: stratcontent.h:33
~ContentSet()
Definition: stratcontent.h:75
set of names for stuff that can be inside porous layers
Definition: stratcontent.h:71
OD::FillPattern pattern_
Definition: stratcontent.h:54
Stratigraphy.
Definition: stratlevel.h:25
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
object with a name.
Definition: namedobj.h:20
stuff that can be inside porous layers
Definition: stratcontent.h:27
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
virtual const OD::String & name() const
Definition: namedobj.h:33
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122

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