00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _T_OPTION_H_
00011 #define _T_OPTION_H_
00012
00013 #include <rtworks/ipc.h>
00014 #include <rtworks/tex.h>
00015 #include <rtworks/types.h>
00016 #include <rtworks/tcallbck.h>
00017
00018 namespace SmartSockets {
00019
00026 class T_IPCX_API OptionException : public Exception {
00027
00028 public:
00032 OptionException () {}
00033
00037 virtual ~OptionException () throw() {}
00038 };
00039
00040 class T_IPCX_API Option;
00041
00046 class T_IPCX_API OptionChangeCallBack
00047 {
00048 public:
00049
00058 typedef void (OptionChangeCallBack::* Handler) (
00059 CallBack < OptionChangeCallBack > * callBack,
00060 void* newVal,
00061 Option & opt);
00062
00071 virtual void onChange (
00072 CallBack < OptionChangeCallBack > * callBack,
00073 void* newVal,
00074 Option& opt);
00075 };
00076
00077
00081 class T_IPCX_API Option
00082 {
00083
00084 public:
00086 Option (T_OPTION opt) throw (OptionException);
00087
00092 Option (const char* name) throw (OptionException);
00093
00109 static Option create(const char* name,T_OPT_TYPE optType )
00110 throw (OptionException);
00111
00113 virtual ~Option () throw() {}
00114
00116 static void destroyOption (const char* name) throw (OptionException);
00117
00119 bool getBool () const throw (OptionException);
00120
00122 void setBool (bool value) throw (OptionException);
00123
00125 const char *getEnum () const throw (OptionException);
00126
00128 void setEnum (const char * value) throw (OptionException);
00129
00131 T_STR_LIST getEnumList() const throw (OptionException);
00132
00134 void setEnumList (T_STR_LIST value) throw (OptionException);
00135
00137 real8 getReal8 () const throw (OptionException);
00138
00140 void setReal8 (real8 value) throw (OptionException);
00141
00143 int4 getInt4 () const throw (OptionException);
00144
00146 void setInt4 (int4 value) throw (OptionException);
00147
00149 const char * getString () const throw (OptionException);
00150
00152 void setString (const char * value) throw (OptionException);
00153
00167 T_STR_LIST getStringList () const throw (OptionException);
00168
00170 void setStringList (T_STR_LIST value) throw (OptionException);
00171
00178 T_OPT_TYPE getType () const throw (OptionException);
00179
00181 bool isKnown () const throw (OptionException);
00182
00184 void setUnKnown () throw (OptionException);
00185
00187 bool getReadOnly () const throw (OptionException);
00188
00190 void setReadOnly (bool is_read_only) throw (OptionException);
00191
00193 bool getRequired () const throw (OptionException);
00194
00196 void setRequired (bool is_required) throw (OptionException);
00197
00199 const char* getName () throw (OptionException);
00200
00202 void legValAdd (const char * value) throw (OptionException);
00203
00205 CallBack <OptionChangeCallBack> * optionChangeCbCreate(OptionChangeCallBack * impl,
00206 void* arg = NULL)
00207 throw (OptionException);
00208
00209 private:
00210
00211 T_OPTION _opt;
00212
00213 protected:
00215 static void T_ENTRY1 optionChangeCbDelegator(T_OPTION,
00216 T_OPTION_CHANGE_CB_DATA,
00217 T_CB_ARG);
00218 };
00219
00220 }
00221
00222 #endif //_T_OPTION_H_