OpendTect  6.3
attribparambase.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: Helene Huck
8  Date: 16-01-2008
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "attributeenginemod.h"
14 #include "bufstring.h"
15 #include "fixedstring.h"
16 
17 class DataInpSpec;
18 class BufferStringSet;
19 
20 namespace Attrib
21 {
22 
34 mExpClass(AttributeEngine) Param
35 {
36 public:
37  Param(const char* key);
38  Param(const Param&);
39  virtual ~Param() {}
40 
41  virtual Param* clone() const = 0;
42 
43  bool operator==( const Param& p ) const
44  { return _isEqual( p ); }
45  bool operator!=( const Param& p ) const
46  { return !_isEqual( p ); }
47 
48  virtual bool isOK() const = 0;
49 
50  bool isEnabled() const { return enabled_; }
51  void setEnabled(bool yn=true) { enabled_=yn; }
52  bool isRequired() const { return required_; }
53  void setRequired(bool yn=true) { required_=yn; }
54  bool isGroup() const { return isgroup_; }
55 
56  FixedString getKey() const { return key_.buf(); }
57 
59  virtual bool setCompositeValue(const char*)
60  { return false; }
62  virtual bool setValues(BufferStringSet&)
63  { return false; }
64  virtual bool getCompositeValue(BufferString&) const =0;
67  virtual BufferString getDefaultValue() const { return ""; }
68  void setKey(const char* newkey) { key_ = newkey; }
69 
70  virtual void fillDefStr(BufferString&) const =0;
71 
72 protected:
73 
75  bool isgroup_;
76 
77  bool enabled_;
78  bool required_;
79 
80  bool _isEqual( const Param& p ) const
81  {
82  return p.key_!=key_ ? false : isEqual( p );
83  }
84  virtual bool isEqual(const Param&) const = 0;
85 };
86 
87 
92 mExpClass(AttributeEngine) ValParam : public Param
93 {
94 public:
95  ValParam(const char* key,DataInpSpec*);
96  ValParam(const ValParam&);
97  ~ValParam();
98 
99  virtual ValParam* clone() const;
100 
101  virtual bool isOK() const;
102 
103  int nrValues() const;
104  virtual int getIntValue(int idx=0) const;
105  virtual float getFValue(int idx=0) const;
106  virtual double getDValue(int idx=0) const;
107  bool getBoolValue(int idx=0) const;
108  const char* getStringValue(int idx=0) const;
109 
110  void setValue(int,int idx=0);
111  void setValue(float,int idx=0);
112  void setValue(bool,int idx=0);
113  void setValue(const char*,int idx=0);
114  void setValue(double,int idx=0);
115 
116  virtual int getDefaultIntValue(int idx=0) const;
117  virtual float getDefaultFValue(int idx=0) const;
118  bool getDefaultBoolValue(int idx=0) const;
119  const char* getDefaultStringValue(int idx=0) const;
120  virtual double getDefaultDValue(int idx=0) const;
121 
122  void setDefaultValue(int,int idx=0);
123  void setDefaultValue(float,int idx=0);
124  void setDefaultValue(bool,int idx=0);
125  void setDefaultValue(const char*,int idx=0);
126  void setDefaultValue(double,int idx=0);
127 
128  DataInpSpec* getSpec() { return spec_; }
129  const DataInpSpec* getSpec() const { return spec_; }
130 
131  virtual bool setCompositeValue(const char*);
132  virtual bool getCompositeValue(BufferString&) const;
133  virtual BufferString getDefaultValue() const { return ""; }
134  virtual void fillDefStr(BufferString&) const;
135 
136 protected:
138 
139  virtual bool isEqual(const Param&) const;
140 
141 public:
142  mDeprecated float getfValue( int idx=0 ) const
143  { return getFValue( idx ); }
144  mDeprecated double getdValue( int idx=0 ) const
145  { return getDValue( idx ); }
146  mDeprecated float getDefaultfValue( int idx=0 ) const
147  { return getDefaultFValue( idx ); }
148  mDeprecated double getDefaultdValue( int idx=0 ) const
149  { return getDefaultDValue( idx ); }
150 };
151 
152 } // namespace Attrib
Attribute Value Parameter.
Definition: attribparambase.h:92
#define mExpClass(module)
Definition: commondefs.h:157
DataInpSpec * spec_
Definition: attribparambase.h:137
bool isEnabled() const
Definition: attribparambase.h:50
void setKey(const char *newkey)
Definition: attribparambase.h:68
virtual bool setValues(BufferStringSet &)
Definition: attribparambase.h:62
OD::String that holds an existing text string.
Definition: fixedstring.h:27
bool enabled_
Definition: attribparambase.h:77
Set of BufferString objects.
Definition: bufstringset.h:25
virtual ~Param()
Definition: attribparambase.h:39
bool isRequired() const
Definition: attribparambase.h:52
BufferString key_
Definition: attribparambase.h:74
bool operator!=(const Param &p) const
Definition: attribparambase.h:45
FixedString getKey() const
Definition: attribparambase.h:56
bool required_
Definition: attribparambase.h:78
void setEnabled(bool yn=true)
Definition: attribparambase.h:51
mDeprecated double getDefaultdValue(int idx=0) const
Definition: attribparambase.h:148
mDeprecated double getdValue(int idx=0) const
Definition: attribparambase.h:144
Specification of input characteristics.
Definition: datainpspec.h:88
const DataInpSpec * getSpec() const
Definition: attribparambase.h:129
bool operator==(const Param &p) const
Definition: attribparambase.h:43
void setRequired(bool yn=true)
Definition: attribparambase.h:53
DataInpSpec * getSpec()
Definition: attribparambase.h:128
A parameter that is used by an attribute.
Definition: attribparambase.h:34
mDeprecated float getDefaultfValue(int idx=0) const
Definition: attribparambase.h:146
bool isGroup() const
Definition: attribparambase.h:54
const char * buf() const
Definition: odstring.h:45
#define mDeprecated
Definition: plfdefs.h:213
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
virtual BufferString getDefaultValue() const
Definition: attribparambase.h:67
bool isgroup_
Definition: attribparambase.h:75
mDeprecated float getfValue(int idx=0) const
Definition: attribparambase.h:142
virtual BufferString getDefaultValue() const
Definition: attribparambase.h:133
virtual bool setCompositeValue(const char *)
Definition: attribparambase.h:59
bool _isEqual(const Param &p) const
Definition: attribparambase.h:80
Semblance Attribute.
Definition: attribdataholder.h:21

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