1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11 
12 
13 
14 
15 #ifndef _BinaryParameter_h
16 #define _BinaryParameter_h
17 
18 
19 #include "Parameter.h"
20 
21 
22 //
23 // Class name definition:
24 //
25 #define ClassBinaryParameter	"BinaryParameter"
26 
27 //
28 // BinaryParameter class definition:
29 //
30 class BinaryParameter : public Parameter
31 {
32   private:
33     //
34     // Private member data:
35     //
36 	Parameter	*secondValue;
37 
38   protected:
39 
40   public:
41 
42 
43     //
44     // Constructor:
45     //
BinaryParameter(ParameterDefinition * pd)46     BinaryParameter(ParameterDefinition *pd) : Parameter(pd)
47     {
48 	this->secondValue = new Parameter(pd);
49     }
50 
51     //
52     // Destructor:
53     //
~BinaryParameter()54     ~BinaryParameter() { delete this->secondValue; }
55 
56     //
57     // Manipulate the Value and definition
58     //
set2ndValue(const char * v)59     Type	set2ndValue(const char *v)
60 			{ return this->secondValue->setValue(v); }
61     boolean 	set2ndValue(const char *v, Type t, boolean coerce = TRUE)
62 			{ return this->secondValue->setValue(v,t,coerce); }
63     //
64     // Set the stored value.
65     // If the parameter is not defaulting, this is
66     // the same as setValue, but if it is defaulting, then we set the
67     // value but leave the parameter clean and defaulting.
68     //
set2ndSetValue(const char * v,Type t)69     boolean set2ndSetValue(const char *v, Type t)
70 			{ return this->secondValue->setSetValue(v,t); }
71 
72 
has2ndValue()73     boolean 	has2ndValue()
74 		{ return this->secondValue->hasValue(); }
get2ndValueType()75     Type    	get2ndValueType()
76 		{ return this->secondValue->getValueType(); }
77 
get2ndSetValueString()78     const char 	*get2ndSetValueString()
79 		{ return this->secondValue->getSetValueString(); }
get2ndValueString()80     const char 	*get2ndValueString()
81 		{ return this->secondValue->getValueString(); }
82 
get2ndValueOrDefaultString()83     const char 	*get2ndValueOrDefaultString()
84 		{ return this->secondValue->getValueOrDefaultString(); }
85 
86     //
87     // Get the i'th component of a vector value.
88     //
get2ndVectorComponentValue(int index)89     double get2ndVectorComponentValue(int index)
90 		{ return this->secondValue->getVectorComponentValue(index); }
91     //
92     // Get the floating point value of a scalar
93     //
get2ndScalarValue()94     double get2ndScalarValue()
95 		{ return this->secondValue->getScalarValue(); }
96     //
97     // Get the value of an integer...
98     //
get2ndIntegerValue()99     int   get2ndIntegerValue()
100 		{ return this->secondValue->getIntegerValue(); }
101 
102     //
103     // These methods are somewhat of a hack, but at least they belong here and
104     // not in ScalarNode.C which is what uses them (for now anyway).
105     //
106     // G/Set the n'th component of a vector, scalar or integer.  For scalars
107     // and integers, the component number must be 1.
108     // Components are indexed from 1.
109     //
get2ndComponentValue(int component)110     double get2ndComponentValue(int component)
111 		{ return this->secondValue->getComponentValue(component); }
set2ndComponentValue(int component,double val)112     boolean set2ndComponentValue(int component, double val)
113 		{ return this->secondValue->setComponentValue(component, val); }
get2ndComponentCount()114     int get2ndComponentCount()
115 		{ return this->secondValue->getComponentCount(); }
116 
117     //
118     // Returns a pointer to the class name.
119     //
getClassName()120     const char* getClassName()
121     {
122 	return ClassBinaryParameter;
123     }
124 };
125 
126 
127 #endif // _BinaryParameter_h
128