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 #include "MBParameter.h" 15 #include "DXStrings.h" 16 17 boolean MBParameter::MBParameterClassInitialized = FALSE; 18 MBParameter()19MBParameter::MBParameter() : Base() 20 { 21 // 22 // Initialize member data. 23 // 24 25 this->name = NULL; 26 this->type_name = NULL; 27 this->description = NULL; 28 this->default_value = NULL; 29 this->structure = DuplicateString("Field/Group"); 30 this->data_type = DuplicateString("float"); 31 this->data_shape = DuplicateString("Scalar"); 32 this->counts = DuplicateString("1"); 33 this->positions = DuplicateString("Not required"); 34 this->connections = DuplicateString("Not required"); 35 this->element_type = DuplicateString("Not required"); 36 this->dependency = DuplicateString("Positions or connections"); 37 this->required = FALSE; 38 this->descriptive = FALSE; 39 this->type = 0; 40 41 } 42 setType(unsigned long type)43void MBParameter::setType(unsigned long type) 44 { 45 this->type = type; 46 } setTypeName(char * name)47void MBParameter::setTypeName(char * name) 48 { 49 this->type_name = name; 50 } addType(unsigned long type)51void MBParameter::addType(unsigned long type) 52 { 53 this->type |= type; 54 } removeType(unsigned long type)55void MBParameter::removeType(unsigned long type) 56 { 57 this->type &= ~type; 58 } setRequired(boolean required)59void MBParameter::setRequired(boolean required) 60 { 61 this->required = required; 62 } setDescriptive(boolean descriptive)63void MBParameter::setDescriptive(boolean descriptive) 64 { 65 this->descriptive = descriptive; 66 } setName(char * name)67void MBParameter::setName(char *name) 68 { 69 if(this->name) 70 delete this->name; 71 this->name = DuplicateString(name); 72 } setDescription(char * description)73void MBParameter::setDescription(char *description) 74 { 75 if(this->description) 76 delete this->description; 77 this->description = DuplicateString(description); 78 } setDefaultValue(char * default_value)79void MBParameter::setDefaultValue(char *default_value) 80 { 81 if(this->default_value) 82 delete this->default_value; 83 this->default_value = DuplicateString(default_value); 84 } setStructure(char * structure)85void MBParameter::setStructure(char *structure) 86 { 87 if(this->structure) 88 delete this->structure; 89 this->structure = DuplicateString(structure); 90 } setDataType(char * data_type)91void MBParameter::setDataType(char *data_type) 92 { 93 if(this->data_type) 94 delete this->data_type; 95 this->data_type = DuplicateString(data_type); 96 } setDataShape(char * data_shape)97void MBParameter::setDataShape(char *data_shape) 98 { 99 if(this->data_shape) 100 delete this->data_shape; 101 this->data_shape = DuplicateString(data_shape); 102 } setsimpleDataShape(char * data_shape)103void MBParameter::setsimpleDataShape(char *data_shape) 104 { 105 if(this->data_shape) 106 delete this->simple_data_shape; 107 this->simple_data_shape = DuplicateString(simple_data_shape); 108 } setCounts(char * counts)109void MBParameter::setCounts(char *counts) 110 { 111 if(this->counts) 112 delete this->counts; 113 this->counts = DuplicateString(counts); 114 } setPositions(char * positions)115void MBParameter::setPositions(char *positions) 116 { 117 if(this->positions) 118 delete this->positions; 119 this->positions = DuplicateString(positions); 120 } setConnections(char * connections)121void MBParameter::setConnections(char *connections) 122 { 123 if(this->connections) 124 delete this->connections; 125 this->connections = DuplicateString(connections); 126 } setElementType(char * element_type)127void MBParameter::setElementType(char *element_type) 128 { 129 if(this->element_type) 130 delete this->element_type; 131 this->element_type = DuplicateString(element_type); 132 } setDependency(char * dependency)133void MBParameter::setDependency(char *dependency) 134 { 135 if(this->dependency) 136 delete this->dependency; 137 this->dependency = DuplicateString(dependency); 138 } 139 ~MBParameter()140MBParameter::~MBParameter() 141 { 142 if(this->name) delete this->name; 143 if(this->description) delete this->description; 144 if(this->default_value) delete this->default_value; 145 if(this->structure) delete this->structure; 146 if(this->data_type) delete this->data_type; 147 if(this->data_shape) delete this->data_shape; 148 if(this->counts) delete this->counts; 149 if(this->positions) delete this->positions; 150 if(this->connections) delete this->connections; 151 if(this->element_type) delete this->element_type; 152 if(this->dependency) delete this->dependency; 153 } 154