cgma
SettingHolder.cpp
Go to the documentation of this file.
00001 #include "SettingHolder.hpp"
00002 #include "CubitDefines.h"
00003 #include "CubitString.hpp"
00004 #include "CubitUtil.hpp"
00005 #include "CubitMessage.hpp"
00006 
00007 
00009 
00010 
00011 SettingHolder::SettingHolder()
00012 {
00013  setting_type = SETTING_UNKNOWN_VALUE_TYPE;
00014   description = "";
00015   name = "";
00016 
00017   get_int_function    = NULL;
00018   set_int_function    = NULL; 
00019   get_double_function = NULL;
00020   set_double_function = NULL;
00021   get_bool_function   = NULL;
00022   set_bool_function   = NULL;
00023   get_string_function = NULL;
00024   set_string_function = NULL;
00025 
00026 }
00027 
00028 // constructor for int settings
00029 SettingHolder::SettingHolder(CubitString n, void (*setFn) (int), 
00030                  int (*getFn)(), int value)
00031 {
00032   setting_type = SETTING_INT_VALUE_TYPE;
00033   int_value    = value;
00034   double_value = 0.0;
00035   string_value = "";
00036   description = "";
00037   name = n; 
00038 
00039   get_int_function    = getFn;
00040   set_int_function    = setFn; 
00041   get_double_function = NULL;
00042   set_double_function = NULL;
00043   get_bool_function   = NULL;
00044   set_bool_function   = NULL;
00045   get_string_function = NULL;
00046   set_string_function = NULL;
00047 
00048 }
00049 
00050 // constructor for double settings
00051 SettingHolder::SettingHolder(CubitString n, void (*setFn) (double), 
00052                  double (*getFn)(), double value)
00053 { 
00054   setting_type = SETTING_DOUBLE_VALUE_TYPE;
00055   int_value    = 0;
00056   double_value = value;
00057   string_value = "";
00058   description = "";
00059   name = n;
00060 
00061   get_int_function    = NULL;
00062   set_int_function    = NULL;
00063   get_double_function = getFn;
00064   set_double_function = setFn;
00065   get_bool_function   = NULL;
00066   set_bool_function   = NULL;
00067   get_string_function = NULL;
00068   set_string_function = NULL;
00069 
00070 }
00071 
00072 
00073 // constructor for boolean settings
00074 SettingHolder::SettingHolder(CubitString n, void (*setFn) (CubitBoolean), 
00075                  CubitBoolean (*getFn)(), CubitBoolean)
00076 { 
00077   setting_type = SETTING_CUBITBOOLEAN_VALUE_TYPE;
00078   int_value    = 0;
00079   double_value = 0.0;
00080   description = "";
00081   name = n;
00082 
00083   get_int_function    = NULL;
00084   set_int_function    = NULL;
00085   get_double_function = NULL;
00086   set_double_function = NULL;
00087   get_bool_function   = getFn;
00088   set_bool_function   = setFn;
00089   get_string_function = NULL;
00090   set_string_function = NULL;
00091   
00092 }
00093 
00094 // constructor for string settings
00095 SettingHolder::SettingHolder(CubitString n, void (*setFn) (CubitString), 
00096                  CubitString (*getFn)(), char* value)
00097 { 
00098   setting_type = SETTING_CUBITSTRING_VALUE_TYPE;
00099   int_value    = 0;
00100   double_value = 0.0;
00101   string_value = value;
00102   description = "";
00103   name = n;
00104   
00105   get_int_function   = NULL;
00106   set_int_function   = NULL;
00107   get_double_function = NULL;
00108   set_double_function = NULL;
00109   get_bool_function   = NULL;
00110   set_bool_function   = NULL;
00111   get_string_function = getFn;
00112   set_string_function = setFn;  
00113 
00114 }
00115 
00116 // This is added for settings function.
00117 // constructor for int settings
00118 SettingHolder::SettingHolder(CubitString n, void (*setFn) (int),
00119                  int (*getFn)())
00120 {
00121   setting_type = SETTING_INT_VALUE_TYPE;
00122   description = "";
00123   name = n;
00124 
00125   get_int_function    = getFn;
00126   set_int_function    = setFn;
00127   get_double_function = NULL;
00128   set_double_function = NULL;
00129   get_bool_function   = NULL;
00130   set_bool_function   = NULL;
00131   get_string_function = NULL;
00132   set_string_function = NULL;
00133 
00134 }
00135 
00136 // constructor for double settings
00137 SettingHolder::SettingHolder(CubitString n, void (*setFn) (double),
00138                  double (*getFn)())
00139 {
00140   setting_type = SETTING_DOUBLE_VALUE_TYPE;
00141   description = "";
00142   name = n;
00143 
00144   get_int_function    = NULL;
00145   set_int_function    = NULL;
00146   get_double_function = getFn;
00147   set_double_function = setFn;
00148   get_bool_function   = NULL;
00149   set_bool_function   = NULL;
00150   get_string_function = NULL;
00151   set_string_function = NULL;
00152 
00153 }
00154 
00155 
00156 // constructor for boolean settings
00157 SettingHolder::SettingHolder(CubitString n, void (*setFn) (CubitBoolean),
00158                  CubitBoolean (*getFn)())
00159 {
00160   setting_type = SETTING_CUBITBOOLEAN_VALUE_TYPE;
00161   description = "";
00162   name = n;
00163 
00164   get_int_function    = NULL;
00165   set_int_function    = NULL;
00166   get_double_function = NULL;
00167   set_double_function = NULL;
00168   get_bool_function   = getFn;
00169   set_bool_function   = setFn;
00170   get_string_function = NULL;
00171   set_string_function = NULL;
00172 
00173 }
00174 
00175 // constructor for string settings
00176 SettingHolder::SettingHolder(CubitString n, void (*setFn) (CubitString),
00177                  CubitString (*getFn)())
00178 {
00179   setting_type = SETTING_CUBITSTRING_VALUE_TYPE;
00180   description = "";
00181   name = n;
00182 
00183   get_int_function   = NULL;
00184   set_int_function   = NULL;
00185   get_double_function = NULL;
00186   set_double_function = NULL;
00187   get_bool_function   = NULL;
00188   set_bool_function   = NULL;
00189   get_string_function = getFn;
00190   set_string_function = setFn;
00191 
00192 }
00193 
00194 
00195 SettingHolder::~SettingHolder() {}
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines