OpendTect-6_4  6.4
mathspecvars.h
Go to the documentation of this file.
1 #ifndef mathspecvars_h
2 #define mathspecvars_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: May 2014
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "propertyref.h"
17 
18 
19 namespace Math
20 {
21 
22 
26 {
27 public:
28 
29  SpecVar( const char* varnm, const char* dispnm,
30  bool hasuns=false,
32  : varnm_(varnm), dispnm_(dispnm)
33  , hasunits_(hasuns), type_(typ) {}
34  bool operator ==( const SpecVar& oth ) const
35  { return varnm_ == oth.varnm_; }
36 
39  bool hasunits_;
41 
42 };
43 
44 
47 mExpClass(General) SpecVarSet : public TypeSet<SpecVar>
48 {
49 public:
51 
52  int getIndexOf(const char* varnm) const;
53  void getNames(BufferStringSet&,bool usrdisp=true) const;
54  void add( const char* varnm, const char* dispnm,
55  bool hasuns=false, PropertyRef::StdType typ
57  { *this += SpecVar(varnm,dispnm,hasuns,typ); }
58 
59  // convenience
60 
61  SpecVar* find( const char* nm )
62  { int idx=getIndexOf(nm); return idx<0?0:&(*this)[idx];}
63  const SpecVar* find( const char* nm ) const
64  { return const_cast<SpecVarSet*>(this)->find( nm ); }
65  bool isPresent( const char* nm ) const
66  { return getIndexOf(nm) >= 0; }
67  const OD::String& varName( int idx ) const
68  { return (*this)[idx].varnm_; }
69  const OD::String& dispName( int idx ) const
70  { return (*this)[idx].dispnm_; }
71  bool hasUnits( int idx )
72  { return (*this)[idx].hasunits_; }
74  { return (*this)[idx].type_; }
75 
76  static const SpecVarSet& getEmpty();
77 
78 };
79 
80 
81 
82 } // namespace Math
83 
84 
85 #endif
#define mExpClass(module)
Definition: commondefs.h:160
const SpecVar * find(const char *nm) const
Definition: mathspecvars.h:63
const OD::String & dispName(int idx) const
Definition: mathspecvars.h:69
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
bool isPresent(const char *nm) const
Definition: mathspecvars.h:65
Set of BufferString objects.
Definition: bufstringset.h:28
Special variables for Math Formulae/Expressions.
Definition: mathspecvars.h:25
Set of special variables for Math Formulae/Expressions.
Definition: mathspecvars.h:47
Definition: propertyref.h:49
Set of (small) copyable elements.
Definition: commontypes.h:30
SpecVarSet()
Definition: mathspecvars.h:50
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
SpecVar * find(const char *nm)
Definition: mathspecvars.h:61
BufferString dispnm_
Definition: mathspecvars.h:38
PropertyRef::StdType type_
Definition: mathspecvars.h:40
bool hasunits_
Definition: mathspecvars.h:39
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: math2.h:29
PropertyRef::StdType propType(int idx)
Definition: mathspecvars.h:73
StdType
Definition: propertyref.h:46
bool hasUnits(int idx)
Definition: mathspecvars.h:71
SpecVar(const char *varnm, const char *dispnm, bool hasuns=false, PropertyRef::StdType typ=PropertyRef::Other)
Definition: mathspecvars.h:29
void add(const char *varnm, const char *dispnm, bool hasuns=false, PropertyRef::StdType typ=PropertyRef::Other)
Definition: mathspecvars.h:54
const OD::String & varName(int idx) const
Definition: mathspecvars.h:67
BufferString varnm_
Definition: mathspecvars.h:37

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