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

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