OpendTect  6.6
propertyref.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 Bril
8  Date: Sep 2010
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "generalmod.h"
17 #include "ranges.h"
18 #include "namedobj.h"
19 #include "enums.h"
20 #include "bufstringset.h"
21 #include "color.h"
22 #include "repos.h"
23 
24 
25 class ascistream;
26 class ascostream;
27 class Property;
28 class MathProperty;
29 class Mnemonic;
30 struct PropRef_ThickRef_Man;
31 
32 
43 {
44 public:
45 
46  enum StdType {
47  Anis, Area, Class, Comp, Den, Dist, ElaRa, ElPot,
48  GR, Imp, Perm, Pres, PresGrad, PresWt, Res, Son,
50  };
52  static StdType surveyZType();
53 
54  PropertyRef( const char* nm, StdType t=Other )
55  : NamedObject(nm)
56  , stdtype_(t), mathdef_(0), defval_(nullptr)
57  , mn_(nullptr) {}
58  PropertyRef( const PropertyRef& pr )
59  : NamedObject(pr.name())
60  , mathdef_(0), defval_(nullptr)
61  , mn_(nullptr) { *this = pr; }
62  virtual ~PropertyRef();
63  PropertyRef& operator =(const PropertyRef&);
64  inline bool operator ==( const PropertyRef& pr ) const
65  { return name() == pr.name(); }
66  inline bool operator !=( const PropertyRef& pr ) const
67  { return name() != pr.name(); }
68  bool isKnownAs(const char*) const;
69  bool hasFixedDef() const { return mathdef_; }
71  void setMnemonic(BufferString mn) { mn_ = mn; }
72 
73  inline StdType stdType() const { return stdtype_; }
74  inline bool hasType( StdType t ) const
75  { return stdtype_ == t; }
76  inline bool isCompatibleWith( const PropertyRef& pr ) const
77  { return hasType(pr.stdType()); }
78  inline void setStdType( StdType t ) { stdtype_ = t; }
79  void setFixedDef(const MathProperty*);
81 
82  inline BufferStringSet& aliases() { return aliases_; }
83  inline const BufferStringSet& aliases() const { return aliases_; }
84  const MathProperty& fixedDef() const { return *mathdef_; }
86  float commonValue() const;
87 
88  static const PropertyRef& undef();
89 
91 
92  static const PropertyRef& thickness();
94  inline bool isThickness() const { return this == &thickness(); }
95  static const char* standardSVelStr() { return "Swave velocity";}
96  static const char* standardSVelAliasStr() { return "SVel";}
97  static const char* standardPVelStr() { return "Pwave velocity";}
98  static const char* standardPVelAliasStr() { return "PVel";}
99 
100 protected:
101 
106 
107  friend class PropertyRefSet;
108  void usePar(const IOPar&);
109  void fillPar(IOPar&) const;
110 public:
111  static void setThickness(const PropertyRef*);
112 
113 };
114 
115 
117 {
118 public:
119 
122  : ObjectSet<PropertyRef>() { *this = prs; }
125 
126  inline bool isPresent( const char* nm ) const
127  { return indexOf(nm) >= 0; }
128  int indexOf(const char*) const;
129  int indexOf(PropertyRef::StdType,int occ=0) const;
130  inline PropertyRef* find( const char* nm ) { return fnd(nm); }
131  inline const PropertyRef* find( const char* nm ) const { return fnd(nm); }
132 
136  int ensurePresent(PropertyRef::StdType,const char* nm1,
137  const char* nm2=0,const char* nm3=0);
138 
139  bool save(Repos::Source) const;
140 
141  inline bool isPresent( const PropertyRef* pr ) const
142  { return ObjectSet<PropertyRef>::isPresent(pr); }
143  int indexOf( const PropertyRef* pr ) const
144  { return ObjectSet<PropertyRef>::indexOf(pr); }
147 
148 protected:
149 
150  PropertyRef* fnd(const char*) const;
152  { add(pr); return *this; }
153 
154 public:
155 
157  bool writeTo(ascostream&) const;
158 
159 };
160 
161 mGlobal(General) const PropertyRefSet& PROPS();
162 inline PropertyRefSet& ePROPS() { return const_cast<PropertyRefSet&>(PROPS()); }
163 
164 
166 {
167 public:
168 
170  bool operator ==(const PropertyRefSelection&) const;
171 
172  int indexOf(const char*) const;
173  int find(const char*) const; // also uses 'isKnownAs'
174 
175  inline bool isPresent( const char* prnm ) const
176  { return indexOf( prnm ) >= 0; }
177  inline int indexOf( const PropertyRef* pr ) const
179  inline bool isPresent( const PropertyRef* pr ) const
181 
182  inline const PropertyRef* getByName( const char* nm ) const
183  { const int idx = indexOf(nm);
184  return idx < 0 ? 0 : (*this)[idx]; }
185 
187 
188  static PropertyRefSelection getAll(bool with_thickness=true,
189  const PropertyRef* exclude=0);
191 
192 };
193 
194 
Repos::Source
Source
Definition: repos.h:24
PROPS
const PropertyRefSet & PROPS()
PropertyRefSet::operator=
PropertyRefSet & operator=(const PropertyRefSet &)
PropertyRefSet::find
const PropertyRef * find(const char *nm) const
Definition: propertyref.h:131
PropertyRefSet
Definition: propertyref.h:117
PropertyRefSet::indexOf
int indexOf(const PropertyRef *pr) const
Definition: propertyref.h:143
NamedObject
object with a name.
Definition: namedobj.h:42
PropertyRef::stdtype_
StdType stdtype_
Definition: propertyref.h:102
PropertyRefSet::subselect
bool subselect(PropertyRef::StdType, ObjectSet< const PropertyRef > &) const
Vel
Velocity.
Definition: velocityfunction.h:32
sKey::Time
FixedString Time()
Definition: keystrs.h:163
PropertyRef::~PropertyRef
virtual ~PropertyRef()
PropertyRef::thickness
static const PropertyRef & thickness()
use this always. It has automatic defaults from SI()
Seis::Vol
@ Vol
Definition: seistype.h:32
Repos::Temp
@ Temp
Definition: repos.h:24
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
PropertyRefSelection::indexOf
int indexOf(const char *) const
ObjectSet< PropertyRef >
PropertyRef::isThickness
bool isThickness() const
Definition: propertyref.h:94
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
PropertyRefSelection::isPresent
bool isPresent(const PropertyRef *pr) const
Definition: propertyref.h:179
PropertyRefSelection::isPresent
bool isPresent(const char *prnm) const
Definition: propertyref.h:175
PropertyRef::mathdef_
MathProperty * mathdef_
Definition: propertyref.h:104
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
namedobj.h
ODInst::Other
@ Other
Definition: odinst.h:44
PropertyRefSelection::getByName
const PropertyRef * getByName(const char *nm) const
Definition: propertyref.h:182
PropertyRef::stdType
StdType stdType() const
Definition: propertyref.h:73
PropertyRef::standardPVelStr
static const char * standardPVelStr()
Definition: propertyref.h:97
PropertyRef::commonValue
float commonValue() const
Property
A (usually petrophysical) property of some object.
Definition: property.h:33
Mnemonic
Definition: mnemonics.h:26
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
PropertyRefSet::doAdd
virtual PropertyRefSet & doAdd(PropertyRef *pr)
Definition: propertyref.h:151
PropertyRefSet::~PropertyRefSet
~PropertyRefSet()
NamedObject::name
virtual const name_type & name() const
Definition: namedobj.h:54
PropertyRefSelection
Definition: propertyref.h:166
ascostream
OpendTect standard ascii format file writing.
Definition: ascstream.h:32
PropertyRefSelection::PropertyRefSelection
PropertyRefSelection()
ObjectSet::isPresent
virtual bool isPresent(const T *) const
Definition: objectset.h:426
PropertyRefSelection::subselect
PropertyRefSelection subselect(PropertyRef::StdType) const
PropertyRef::fixedDef
const MathProperty & fixedDef() const
be sure hasFixedDef() returns true!
Definition: propertyref.h:84
PropertyRef::aliases
const BufferStringSet & aliases() const
Definition: propertyref.h:83
PropertyRef::standardSVelAliasStr
static const char * standardSVelAliasStr()
Definition: propertyref.h:96
PropertyRefSet::PropertyRefSet
PropertyRefSet(const PropertyRefSet &prs)
Definition: propertyref.h:121
PropertyRef::hasType
bool hasType(StdType t) const
Definition: propertyref.h:74
indexOf
BufferStringSet::idx_type indexOf(const BufferStringSet &, const char *)
PropertyRefSet::fnd
PropertyRef * fnd(const char *) const
PropertyRef::mn_
BufferString mn_
Definition: propertyref.h:105
operator!=
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:90
PropertyRef::undef
static const PropertyRef & undef()
PropertyRef::isCompatibleWith
bool isCompatibleWith(const PropertyRef &pr) const
Definition: propertyref.h:76
PropertyRefSet::isPresent
bool isPresent(const PropertyRef *pr) const
Definition: propertyref.h:141
PropertyRefSelection::find
int find(const char *) const
PropertyRefSet::indexOf
int indexOf(const char *) const
PropertyRef::Son
@ Son
Definition: propertyref.h:48
PropertyRefSet::add
int add(PropertyRef *)
PropertyRef::defval_
Property * defval_
Definition: propertyref.h:90
PropertyRef::standardSVelStr
static const char * standardSVelStr()
Definition: propertyref.h:95
PropertyRefSet::save
bool save(Repos::Source) const
PropertyRef::ElPot
@ ElPot
Definition: propertyref.h:47
PropertyRef::hasFixedDef
bool hasFixedDef() const
Definition: propertyref.h:69
PropertyRefSet::readFrom
void readFrom(ascistream &)
PropertyRef::Volum
@ Volum
Definition: propertyref.h:49
PropertyRefSelection::getAll
static PropertyRefSelection getAll(PropertyRef::StdType)
PropertyRef::getMnemonic
BufferString getMnemonic() const
PropertyRefSet::indexOf
int indexOf(PropertyRef::StdType, int occ=0) const
PropertyRef::usePar
void usePar(const IOPar &)
PropertyRefSet::find
PropertyRef * find(const char *nm)
Definition: propertyref.h:130
PropertyRef::fillPar
void fillPar(IOPar &) const
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
PropertyRef
Ref Data for a (usually petrophysical) property.
Definition: propertyref.h:43
PropertyRef::setMnemonic
void setMnemonic(BufferString mn)
Definition: propertyref.h:71
bufstringset.h
PropertyRef::isKnownAs
bool isKnownAs(const char *) const
PropertyRef::setStdType
void setStdType(StdType t)
Definition: propertyref.h:78
ObjectSet::indexOf
virtual idx_type indexOf(const T *) const
Definition: objectset.h:420
PropertyRef::setFixedDef
void setFixedDef(const MathProperty *)
copy will be made
MathProperty
Calculated property.
Definition: mathproperty.h:32
PropertyRef::PropertyRef
PropertyRef(const PropertyRef &pr)
Definition: propertyref.h:58
ePROPS
PropertyRefSet & ePROPS()
Definition: propertyref.h:162
enums.h
PropertyRef::mDeclareEnumUtils
mDeclareEnumUtils(StdType) static StdType surveyZType()
PropertyRef::StdType
StdType
Definition: propertyref.h:46
repos.h
PropertyRef::PropertyRef
PropertyRef(const char *nm, StdType t=Other)
Definition: propertyref.h:54
color.h
ascistream
OpendTect standard ascii format file reading.
Definition: ascstream.h:83
PropertyRef::standardPVelAliasStr
static const char * standardPVelAliasStr()
Definition: propertyref.h:98
PropertyRefSelection::getAll
static PropertyRefSelection getAll(bool with_thickness=true, const PropertyRef *exclude=0)
PropertyRef::aliases_
BufferStringSet aliases_
Definition: propertyref.h:103
ranges.h
PropertyRef::aliases
BufferStringSet & aliases()
Definition: propertyref.h:82
PropertyRefSet::writeTo
bool writeTo(ascostream &) const
PropertyRefSelection::indexOf
int indexOf(const PropertyRef *pr) const
Definition: propertyref.h:177
PropertyRefSet::PropertyRefSet
PropertyRefSet()
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
PropertyRefSet::isPresent
bool isPresent(const char *nm) const
Definition: propertyref.h:126
PropertyRef::setThickness
static void setThickness(const PropertyRef *)
PropertyRefSet::ensurePresent
int ensurePresent(PropertyRef::StdType, const char *nm1, const char *nm2=0, const char *nm3=0)

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