15 #include "generalmod.h" 35 enum Rep { intTp, floatTp, doubleTp, boolTp, stringTp };
39 : rep_( tp ), form_(frm) {}
41 inline Rep
rep()
const {
return rep_; }
45 {
return (rep_==oth.
rep_) && (form_==oth.
form_); }
47 {
return ! (oth == *
this); }
72 inline Rep
rep__(
int i )
const {
return intTp; }
73 inline Rep
rep__(
float f )
const {
return floatTp; }
74 inline Rep
rep__(
double d )
const {
return doubleTp; }
75 inline Rep
rep__(
bool b )
const {
return boolTp; }
76 inline Rep
rep__(
const char* s )
const {
return stringTp; }
95 DataInpSpec(
const DataInpSpec&);
100 virtual DataInpSpec* clone()
const =0;
103 virtual bool isUndef(
int idx=0 )
const =0;
106 virtual bool isInsideLimits(
int idx=0)
const;
108 virtual const char* text(
int idx=0 )
const =0;
109 virtual bool setText(
const char*,
int idx=0) =0;
116 virtual int getIntValue(
int idx=0)
const;
117 virtual double getDValue(
int idx=0)
const;
118 virtual float getFValue(
int idx=0)
const;
119 virtual bool getBoolValue(
int idx=0)
const;
121 virtual void setValue(
int i,
int idx=0);
122 virtual void setValue(
double d,
int idx=0);
123 virtual void setValue(
float f,
int idx=0);
124 virtual void setValue(
bool b,
int idx=0);
126 virtual int getDefaultIntValue(
int idx=0)
const;
127 virtual double getDefaultValue(
int idx=0)
const;
128 virtual float getDefaultfValue(
int idx=0)
const;
129 virtual bool getDefaultBoolValue(
int idx=0)
const;
130 virtual const char* getDefaultStringValue(
int idx=0)
const;
138 virtual const char*
name(
int idx=0)
const;
139 virtual DataInpSpec&
setName(
const char*,
int idx=0);
155 double getdValue(
int idx=0)
const {
return getDValue(idx); }
156 float getfValue(
int idx=0)
const {
return getFValue(idx); }
160 #define mDefDISSetValBaseClassImpl(typ) \ 161 virtual void setValue( typ val, int idx=0 ) \ 162 { DataInpSpec::setValue(val,idx); } 163 #define mDefDISSetDefValBaseClassImpl(typ) \ 164 virtual void setDefaultValue( typ val, int idx=0 ) \ 165 { DataInpSpec::setDefaultValue(val,idx); } 204 {
return mIsUdf(value_); }
206 virtual bool setText(
const char* s,
int idx=0 )
210 virtual double getDValue(
int idx=0)
const {
return value(); }
211 virtual float getFValue(
int idx=0)
const {
return (
float)value(); }
214 {
return (
int)defaultValue(); }
216 {
return defaultValue(); }
218 {
return (
float ) defaultValue(); }
221 { defaultvalue_ = (T)val; }
223 { defaultvalue_ = (T)val; }
225 { defaultvalue_ = (T)val; }
237 return defaultvalue_;
240 virtual const char*
text(
int idx=0 )
const 242 if ( isUndef() )
return "";
249 if ( !limits_ )
return true;
251 return limits_->includes( value(),
true );;
253 const bool startudf =
mIsUdf(limits_->start);
254 const bool stopudf =
mIsUdf(limits_->stop);
255 if ( startudf && stopudf )
return true;
257 return value() < limits_->stop;
259 return value() > limits_->start;
286 , limits_( nis.limits_ ? new
StepInterval<T>(*nis.limits_) : 0 )
287 , value_( nis.value_ )
288 , defaultvalue_( nis.defaultvalue_ )
312 , startlimits_(0), stoplimits_(0), steplimits_(0)
333 , startlimits_(0), stoplimits_(0), steplimits_(0)
336 , interval_( interval.
clone() )
348 , startlimits_(0), stoplimits_(0), steplimits_(0)
349 , symm_(o.isSymmetric())
350 , wsymm_(o.withSymmetric())
351 , interval_( o.interval_ ? o.interval_->
clone() : 0)
352 , defaultinterval_( o.defaultinterval_ ?
353 o.defaultinterval_->
clone() : 0)
363 delete defaultinterval_;
372 virtual int nElems()
const {
return hasStep() ? 3 : 2; }
373 inline bool hasStep()
const {
return stpi(); }
377 if ( !interval_ )
return true;
383 if ( interval_ )
delete interval_;
384 interval_ = intval.
clone();
393 if ( defaultinterval_ )
delete defaultinterval_;
394 defaultinterval_ = defaultintval.clone();
402 virtual
bool setText( const
char* s,
int idx=0 )
404 if ( pt_value_(idx) )
421 if ( !defaultinterval_ )
return mUdf(T);
432 virtual const char*
text(
int idx=0 )
const 439 {
return startlimits_||stoplimits_||steplimits_; }
443 if ( !lims )
return true;
449 if ( startudf && stopudf )
return true;
469 case 0 :
return startlimits_;
470 case 1 :
return stoplimits_;
471 case 2 :
return steplimits_;
487 if ( idx<0 || idx==0 )
492 if ( idx<0 || idx==1 )
497 if ( idx==-2 || idx==2 )
512 { symm_ = yn; wsymm_ =
true; }
531 if ( pt_value_(idx) )
return *pt_value_(idx);
537 if ( pt_value_(idx,
true) )
538 return *pt_value_(idx,
true);
547 if ( !defaultinterval_)
return 0;
548 if ( idx == 0 )
return &defaultinterval_->
start;
549 if ( idx == 1 )
return &defaultinterval_->
stop;
550 if ( hasStep() )
return &stpi(defval)->step;
554 if ( !interval_)
return 0;
555 if ( idx == 0 )
return &interval_->
start;
556 if ( idx == 1 )
return &interval_->
stop;
557 if ( hasStep() )
return &stpi()->step;
565 defval ? defaultinterval_ : interval_)
581 virtual bool isUndef(
int idx=0)
const;
583 virtual DataInpSpec*
clone()
const;
584 const char*
text()
const;
586 virtual bool setText(
const char*,
int idx=0) ;
587 virtual const char*
text(
int)
const;
611 virtual DataInpSpec*
clone()
const;
636 virtual bool isUndef(
int idx=0)
const;
638 virtual DataInpSpec*
clone()
const;
639 uiString trueFalseTxt(
bool tf=
true)
const;
640 void setTrueFalseTxt(
bool,
const uiString&);
642 bool checked()
const;
643 void setChecked(
bool yesno);
644 virtual const char*
text(
int idx=0)
const;
646 virtual bool setText(
const char* s,
int idx=0);
648 virtual void setValue(
bool,
int idx=0);
653 virtual
void setDefaultValue(
bool,
int idx=0);
659 bool isSet()
const {
return isset_; }
660 void setSet(
bool yesno=
true ) { isset_ = yesno; }
691 virtual bool isUndef(
int idx=0)
const;
693 virtual DataInpSpec*
clone()
const;
698 void setEnumDef(
const EnumDef&);
701 void addString(
const uiString& txt);
702 virtual const char*
text(
int idx=0)
const;
703 void setItemText(
int idx,
const uiString&);
704 virtual bool setText(
const char* s,
int nr);
707 virtual double getDValue(
int idx=0)
const;
708 virtual float getFValue(
int idx=0)
const;
710 virtual void setValue(
int i,
int idx=0);
711 virtual void setValue(
double d,
int idx=0);
712 virtual void setValue(
float f,
int idx=0);
715 virtual
void setDefaultValue(
int i,
int idx=0);
722 bool isSet()
const {
return isset_; }
723 void setSet(
bool yn=
true ) { isset_ = yn; }
743 Setup(
bool wc=
false,
bool d2=
false,
bool ps=
false )
747 , isrel_(false) {
clear(); }
759 coord_.x = coord_.y =
mUdf(
double);
760 binid_.inl() = binid_.crl() =
mUdf(
int);
772 virtual int nElems()
const;
775 {
return getVal(setup_,idx); }
777 { setVal( setup_, idx, f ); }
781 virtual
bool isUndef(
int idx=0) const;
782 virtual const
char* text(
int idx=0) const;
783 virtual
bool setText(const
char* s,
int idx=0);
786 {
return getVal(defsetup_,idx); }
788 { setVal( defsetup_, idx, f ); }
795 {
return def ? defsetup_ : setup_; }
797 {
return def ? defsetup_ : setup_; }
799 Coord getCoord(
double udfval=
mUdf(
double))
const;
800 BinID getBinID(
int udfval=
mUdf(
int))
const;
801 int getTrcNr(
int udfval=
mUdf(
int))
const;
802 float getOffset(
float udfval=
mUdf(
float))
const;
809 float getVal(
const Setup&,
int)
const;
810 void setVal(
Setup&,
int,
float);
#define mExpClass(module)
Definition: commondefs.h:160
virtual void setName(const char *)
virtual void setValue(int i, int idx=0)
mODTextTranslationClass(NumInpIntervalSpec) public
Definition: datainpspec.h:308
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
double getdValue(int idx=0) const
Definition: datainpspec.h:155
bool getFromString(int &, const char *, int udfval)
Rep rep() const
Definition: datainpspec.h:41
T defaultValue() const
Definition: datainpspec.h:234
StepInterval< T > * steplimits_
Definition: datainpspec.h:524
DataType(Rep tp, Form frm=normal)
Definition: datainpspec.h:38
virtual double getDefaultValue(int idx=0) const
Definition: datainpspec.h:427
NumInpSpec(T val)
Definition: datainpspec.h:182
virtual void setDefaultValue(float f, int idx=0)
Definition: datainpspec.h:134
bool isset_
Definition: datainpspec.h:668
NumInpIntervalSpec(const NumInpIntervalSpec< T > &o)
Definition: datainpspec.h:346
bool hasStep() const
Definition: datainpspec.h:373
void setDefaultValue(float f, int idx=0)
Definition: datainpspec.h:787
const EnumDef * enumdef_
Definition: datainpspec.h:731
Form form_
Definition: datainpspec.h:53
virtual bool getDefaultBoolValue(int idx=0) const
NumInpSpec< double > DoubleInpSpec
Definition: datainpspec.h:294
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
#define mSetUdf(val)
Use this macro to set simple types to undefined.
Definition: undefval.h:274
const StepInterval< T > * limits(int idx=0) const
gets limits for interval components.
Definition: datainpspec.h:464
mODTextTranslationClass(DataInpSpec) public DataInpSpec(const DataInpSpec &)
NumInpIntervalSpec< float > FloatInpIntervalSpec
Definition: datainpspec.h:572
bool yn_
Definition: datainpspec.h:666
Form form() const
Definition: datainpspec.h:42
virtual int nElems() const
Definition: datainpspec.h:372
BufferStringSet names_
Definition: datainpspec.h:148
virtual void setDefaultValue(int val, int idx=0)
Definition: datainpspec.h:220
StepInterval< T > * stoplimits_
Definition: datainpspec.h:523
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
virtual double getDValue(int idx=0) const
Definition: datainpspec.h:416
Definition: datainpspec.h:36
DataType implementation.
Definition: datainpspec.h:63
StepInterval< T > * startlimits_
Definition: datainpspec.h:522
void setWithSymmetric(bool yn)
Definition: datainpspec.h:514
virtual void setDefaultValue(double d, int idx=0)
Definition: datainpspec.h:133
uiString falsetext_
Definition: datainpspec.h:665
const StepInterval< T > * limits() const
Definition: datainpspec.h:263
Setup defsetup_
Definition: datainpspec.h:807
mODTextTranslationClass(DataTypeImpl) public
Definition: datainpspec.h:64
NumInpIntervalSpec & setLimits(const StepInterval< T > &r, int idx=-1)
sets limits for interval components.
Definition: datainpspec.h:485
virtual double getDValue(int idx=0) const
Definition: datainpspec.h:210
virtual float getFValue(int idx=0) const
Definition: datainpspec.h:417
Definition: uistring.h:89
NumInpSpec< T > & setLimits(const Interval< T > &intv)
Definition: datainpspec.h:264
virtual bool getBoolValue(int idx=0) const
bool operator!=(const DataType &oth) const
Definition: datainpspec.h:46
A cartesian coordinate in 2D space.
Definition: coord.h:25
bool operator==(const DataType &oth) const
Definition: datainpspec.h:44
Set of BufferString objects.
Definition: bufstringset.h:28
virtual DataInpSpec * clone() const
Definition: datainpspec.h:771
TypeSet< int > nameidxs_
Definition: datainpspec.h:147
Data type.
Definition: datainpspec.h:31
Rep rep_
Definition: datainpspec.h:52
T value(int idx=0) const
Definition: datainpspec.h:409
Interval of values.
Definition: commontypes.h:31
NumInpSpec(T val, const StepInterval< T > &intv)
Definition: datainpspec.h:192
float value(int idx=0) const
Definition: datainpspec.h:774
virtual int getDefaultIntValue(int idx=0) const
Definition: datainpspec.h:213
Specifications for character string inputs.
Definition: datainpspec.h:577
virtual bool isInsideLimits(int idx=0) const
Definition: datainpspec.h:440
bool symm_
Definition: datainpspec.h:526
NumInpIntervalSpec(const Interval< T > &interval)
Definition: datainpspec.h:331
uiStringSet strings_
Definition: datainpspec.h:727
NumInpIntervalSpec< int > IntInpIntervalSpec
Definition: datainpspec.h:571
bool prefempty_
Definition: datainpspec.h:145
virtual NumInpSpec< T > * clone() const
Definition: datainpspec.h:200
Setup setup_
Definition: datainpspec.h:806
virtual bool hasLimits() const
Definition: datainpspec.h:438
static uiString sNo()
Definition: uistrings.h:375
virtual ~DataInpSpec()
Definition: datainpspec.h:96
Rep rep__(float f) const
Definition: datainpspec.h:73
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
int defaultval_
Definition: datainpspec.h:729
Specification of input characteristics.
Definition: datainpspec.h:89
virtual bool isUndef(int idx=0) const
Definition: datainpspec.h:375
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
virtual NumInpIntervalSpec< T > * clone() const
Definition: datainpspec.h:369
uiString truetext_
Definition: datainpspec.h:664
virtual int getIntValue(int idx=0) const
Definition: datainpspec.h:415
const uiStringSet & strings() const
Definition: enums.h:59
Interval with step.
Definition: commontypes.h:33
Setup(bool wc=false, bool d2=false, bool ps=false)
Definition: datainpspec.h:743
Interval< T > * defaultinterval_
Definition: datainpspec.h:520
virtual bool hasLimits() const
Definition: datainpspec.h:105
bool defaultyn_
Definition: datainpspec.h:667
T defaultvalue_
Definition: datainpspec.h:277
virtual void setDefaultValue(double val, int idx=0)
Definition: datainpspec.h:222
virtual void setDefaultValue(float val, int idx=0)
Definition: datainpspec.h:224
void setSet(bool yn=true)
Definition: datainpspec.h:723
static uiString sYes()
Definition: uistrings.h:526
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
T defaultValue(int idx=0) const
Definition: datainpspec.h:419
Specifications for numerical inputs that may or may not have limits.
Definition: datainpspec.h:175
Form
Definition: datainpspec.h:36
float getfValue(int idx=0) const
Definition: datainpspec.h:156
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
#define mDynamicCastGet(typ, out, in)
Definition: commondefs.h:131
Rep rep__(int i) const
Definition: datainpspec.h:72
~NumInpSpec()
Definition: datainpspec.h:198
bool wsymm_
Definition: datainpspec.h:527
virtual int nElems() const
Definition: datainpspec.h:101
virtual void setDefaultValue(bool b, int idx=0)
Definition: datainpspec.h:135
T value() const
Definition: datainpspec.h:228
Specifications for BinID/Coordinate/TrcNrs and offsets.
Definition: datainpspec.h:737
NumInpSpec< int > IntInpSpec
Definition: datainpspec.h:292
virtual float getDefaultfValue(int idx=0) const
Definition: datainpspec.h:429
bool isset_
Definition: datainpspec.h:730
Rep rep__(bool b) const
Definition: datainpspec.h:75
virtual const char * text(int idx=0) const
Definition: datainpspec.h:240
NumInpSpec(T val, T start, T stop=mUdf(T), T step=1)
Definition: datainpspec.h:187
T stop
Definition: ranges.h:93
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
StepInterval< T > * limits_
Definition: datainpspec.h:279
virtual const char * text(int idx=0) const
Definition: datainpspec.h:432
bool isSymmetric() const
Definition: datainpspec.h:513
void setSet(bool yesno=true)
Definition: datainpspec.h:660
virtual double getDefaultValue(int idx=0) const
Definition: datainpspec.h:215
NumInpSpec< T > & setLimits(const StepInterval< T > &r)
Definition: datainpspec.h:267
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Definition: datainpspec.h:741
virtual int getIntValue(int idx=0) const
Definition: datainpspec.h:209
#define mDefDISSetDefValBaseClassImpl(typ)
Definition: datainpspec.h:163
StepInterval< T > * stpi(bool defval=false) const
Definition: datainpspec.h:562
T value_(int idx=0) const
Definition: datainpspec.h:529
mODTextTranslationClass(NumInpSpec) public
Definition: datainpspec.h:176
bool includes(const X &, bool allowrev) const
Definition: ranges.h:482
virtual bool isInsideLimits(int idx=0) const
Definition: datainpspec.h:247
virtual void setValue(const Interval< T > &intval)
Definition: datainpspec.h:381
Definition: datainpspec.h:36
const EnumDef * enumDef() const
Definition: datainpspec.h:697
~NumInpIntervalSpec()
Definition: datainpspec.h:360
NumInpIntervalSpec & setLimits(const Interval< T > &r, int idx=-1)
Definition: datainpspec.h:505
virtual float getDefaultfValue(int idx=0) const
Definition: datainpspec.h:217
virtual const char * getDefaultStringValue(int idx=0) const
virtual void setDefaultValue(int i, int idx=0)
Definition: datainpspec.h:132
T start
Definition: ranges.h:92
Specifications for numerical intervals.
Definition: datainpspec.h:307
Definition: uistring.h:218
NumInpSpec< float > FloatInpSpec
Definition: datainpspec.h:293
DataType
Definition: seistype.h:54
Rep rep__(double d) const
Definition: datainpspec.h:74
T * pt_value_(int idx=0, bool defval=false) const
Definition: datainpspec.h:543
int cur_
Definition: datainpspec.h:728
NumInpIntervalSpec< double > DoubleInpIntervalSpec
Definition: datainpspec.h:573
#define mDefDISSetValBaseClassImpl(typ)
Definition: datainpspec.h:160
void setValue(float f, int idx=0)
Definition: datainpspec.h:776
Interval< T > * interval_
Definition: datainpspec.h:519
#define mClass(module)
Definition: commondefs.h:164
void setSymmetric(bool yn)
Definition: datainpspec.h:511
bool withSymmetric() const
Definition: datainpspec.h:515
virtual bool setText(const char *s, int idx=0)
Definition: datainpspec.h:206
virtual bool hasLimits() const
Definition: datainpspec.h:246
Specifications for file-name inputs.
Definition: datainpspec.h:607
virtual const OD::String & name() const
Definition: namedobj.h:47
virtual void setDefaultValue(const char *s, int idx=0)
Definition: datainpspec.h:136
virtual bool isUndef(int idx=0) const
Definition: datainpspec.h:203
static const char * valuestr
Definition: datainpspec.h:152
DataType tp_
Definition: datainpspec.h:144
Export_Basic const char * toString(ViewStyle)
Holds data pertinent to a certain enum. It does not know the enum values themselves, but treat them as integers.
Definition: enums.h:45
T defaultvalue_(int idx=0) const
Definition: datainpspec.h:535
Rep rep__(const char *s) const
Definition: datainpspec.h:76
virtual int getDefaultIntValue(int idx=0) const
Definition: datainpspec.h:425
T value_
Definition: datainpspec.h:276
Specifications for boolean inputs.
Definition: datainpspec.h:627
Specifications for list of character string inputs.
Definition: datainpspec.h:677
virtual float getFValue(int idx=0) const
Definition: datainpspec.h:211
const Setup & setup(bool def=false) const
Definition: datainpspec.h:796
virtual Interval< T > * clone() const
Definition: ranges.h:407