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

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