OpendTect  6.3
mathspecvars.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: May 2014
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "generalmod.h"
14 #include "propertyref.h"
15 
16 
17 namespace Math
18 {
19 
20 
24 {
25 public:
26 
27  SpecVar( const char* varnm, const char* dispnm,
28  bool hasuns=false,
30  : varnm_(varnm), dispnm_(dispnm)
31  , hasunits_(hasuns), type_(typ) {}
32  bool operator ==( const SpecVar& oth ) const
33  { return varnm_ == oth.varnm_; }
34 
37  bool hasunits_;
39 
40 };
41 
42 
45 mExpClass(General) SpecVarSet : public TypeSet<SpecVar>
46 {
47 public:
49 
50  int getIndexOf(const char* varnm) const;
51  void getNames(BufferStringSet&,bool usrdisp=true) const;
52  void add( const char* varnm, const char* dispnm,
53  bool hasuns=false, PropertyRef::StdType typ
55  { *this += SpecVar(varnm,dispnm,hasuns,typ); }
56 
57  // convenience
58 
59  SpecVar* find( const char* nm )
60  { int idx=getIndexOf(nm); return idx<0?0:&(*this)[idx];}
61  const SpecVar* find( const char* nm ) const
62  { return const_cast<SpecVarSet*>(this)->find( nm ); }
63  bool isPresent( const char* nm ) const
64  { return getIndexOf(nm) >= 0; }
65  const OD::String& varName( int idx ) const
66  { return (*this)[idx].varnm_; }
67  const OD::String& dispName( int idx ) const
68  { return (*this)[idx].dispnm_; }
69  bool hasUnits( int idx )
70  { return (*this)[idx].hasunits_; }
72  { return (*this)[idx].type_; }
73 
74  static const SpecVarSet& getEmpty();
75 
76 };
77 
78 
79 
80 } // namespace Math
#define mExpClass(module)
Definition: commondefs.h:157
const SpecVar * find(const char *nm) const
Definition: mathspecvars.h:61
const OD::String & dispName(int idx) const
Definition: mathspecvars.h:67
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
bool isPresent(const char *nm) const
Definition: mathspecvars.h:63
Set of BufferString objects.
Definition: bufstringset.h:25
Special variables for Math Formulae/Expressions.
Definition: mathspecvars.h:23
Set of special variables for Math Formulae/Expressions.
Definition: mathspecvars.h:45
Definition: propertyref.h:47
Set of (small) copyable elements.
Definition: commontypes.h:26
SpecVarSet()
Definition: mathspecvars.h:48
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:29
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:187
SpecVar * find(const char *nm)
Definition: mathspecvars.h:59
BufferString dispnm_
Definition: mathspecvars.h:36
PropertyRef::StdType type_
Definition: mathspecvars.h:38
bool hasunits_
Definition: mathspecvars.h:37
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
Definition: math2.h:27
PropertyRef::StdType propType(int idx)
Definition: mathspecvars.h:71
StdType
Definition: propertyref.h:44
bool hasUnits(int idx)
Definition: mathspecvars.h:69
SpecVar(const char *varnm, const char *dispnm, bool hasuns=false, PropertyRef::StdType typ=PropertyRef::Other)
Definition: mathspecvars.h:27
void add(const char *varnm, const char *dispnm, bool hasuns=false, PropertyRef::StdType typ=PropertyRef::Other)
Definition: mathspecvars.h:52
const OD::String & varName(int idx) const
Definition: mathspecvars.h:65
BufferString varnm_
Definition: mathspecvars.h:35

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