cgma
SettingHolder.hpp
Go to the documentation of this file.
00001 //- Class: SettingHolder
00002 //- Description: SettingHolder class - used for save and restore settings
00003 //- Owner: Wesley Gill
00004 //- Checked By:
00005 //- Version
00006 
00007 #ifndef SETTINGHOLDER_HPP
00008 #define SETTINGHOLDER_HPP
00009 
00010 #include "CubitString.hpp"
00011 #include "CubitDefines.h"
00012 #include "CGMUtilConfigure.h"
00013 
00014 typedef enum SETTING_TYPE
00015 {
00016   SETTING_UNKNOWN_VALUE_TYPE = -1,
00017   SETTING_INT_VALUE_TYPE = 0,
00018   SETTING_DOUBLE_VALUE_TYPE = 1,
00019   SETTING_CUBITBOOLEAN_VALUE_TYPE = 2,
00020   SETTING_CUBITSTRING_VALUE_TYPE = 3
00021                         // int = 0, double = 1, CubitBoolean = 2, CubitString = 3, debug = 4
00022 } SettingType;
00023 
00024 
00025 class CUBIT_UTIL_EXPORT SettingHolder
00026 {
00027   friend class SettingHandler;
00028 public:
00029   SettingHolder();
00030   ~SettingHolder();
00031  
00032   //- constructor for int settings
00033   SettingHolder(CubitString, void (*)(int), int (*)(), int);
00034   
00035   //- constructor for double settings
00036   SettingHolder(CubitString, void (*)(double), double (*)(), double);
00037  
00038   //- constructor for CubitBoolean settings
00039   SettingHolder(CubitString, void (*setFn)(CubitBoolean),
00040                 CubitBoolean (*getFn)(), CubitBoolean);
00041 
00042   //- constructor for CubitString settings
00043   SettingHolder(CubitString n, void (*setFn) (CubitString), 
00044                 CubitString (*getFn)(), char* value);
00045 
00046   //- constructor for int settings
00047   SettingHolder(CubitString, void (*)(int), int (*)());
00048   
00049   //- constructor for double settings
00050   SettingHolder(CubitString, void (*)(double), double (*)());
00051  
00052   //- constructor for CubitBoolean settings
00053   SettingHolder(CubitString, void (*)(CubitBoolean), CubitBoolean (*)());
00054 
00055   //- constructor for CubitString settings
00056   SettingHolder(CubitString n, void (*setFn) (CubitString),
00057                  CubitString (*getFn)());
00058 
00059 
00060 private:
00061 
00062   //Use an enum for setting_type??
00063 
00064   SettingType setting_type;     // Defines the type of setting 
00065                         // int = 0, double = 1, CubitBoolean = 2, CubitString = 3, debug = 4
00066   
00067   CubitString name;               // Name of the setting
00068   CubitString description;        // Description of the setting
00069   int int_value;                    
00070   double double_value;
00071   CubitString string_value;
00072 
00073   int (*get_int_function) ();            // Pointer to get int function
00074   double (*get_double_function) ();      // Pointer to get double function
00075   CubitBoolean (*get_bool_function) ();  // Pointer to get boolean function
00076   CubitString (*get_string_function) (); // Pointer to get string function
00077 
00078   void (*set_int_function) (int);            // Pointer to set int function
00079   void (*set_double_function) (double);      // Pointer to set double function
00080   void (*set_bool_function) (CubitBoolean);  // Pointer to set bool function
00081   void (*set_string_function) (CubitString); // Pointer to set string function 
00082 
00083 };
00084 
00085 #endif
00086 
00087 
00088 
00089 
00090 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines