![]() |
VR-Link API Documentation for HLA 1.3
|
00001 /****************************************************************************** 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00006 00008 00009 #ifndef configVar_H_ 00010 #define configVar_H_ 00011 00012 #include "baseConfigVar.h" 00013 #include "varGroup.h" 00014 #include "varType.h" 00015 00016 #include <mtl/env.h> 00017 #include <vlutil/vlExceptions.h> 00018 #include <cmdLine/cmdLine.h> 00019 00020 #ifdef DtUSE_UTILITIES_NAMESPACE 00021 namespace DtUSE_UTILITIES_NAMESPACE 00022 { 00023 #endif 00024 00025 00026 class DtVector; 00027 class DtTaitBryan; 00028 00029 DtDeclareVarType(DtString,DtString) 00030 DtDeclareVarType(int,int) 00031 DtDeclareVarType(unsigned int,unsigned int) 00032 DtDeclareVarType(double,double) 00033 DtDeclareVarType(float,float) 00034 DtDeclareVarType(DtVector,DtString) 00035 DtDeclareVarType(bool,bool) 00036 DtDeclareVarType(DtTaitBryan,DtString) 00037 00038 template <typename T> 00039 class DtConfigVariable : public DtBaseConfigVariable 00040 { 00041 public: 00042 00044 DtConfigVariable(DtVariableGroup* group, const DtString& aName,T aDefault, 00045 const DtString& aDescription = "", 00046 DtVariableScope aScope = DtBaseConfigVariable::DtScopeBoth, 00047 bool isRequired = false, 00048 const DtString& aShortcut = ""); 00049 00051 DtConfigVariable(DtVariableGroup& group, const DtString& aName, T aDefault, 00052 const DtString& aDescription = "", 00053 DtVariableScope aScope = DtBaseConfigVariable::DtScopeBoth, 00054 bool isRequired = false, 00055 const DtString& aShortcut = ""); 00056 00058 virtual ~DtConfigVariable(); 00059 00061 virtual void getCommandLineArg(DtCmdLine::CmdLine&); 00062 00064 virtual void updateFromCommandLineArg(); 00065 00067 virtual void getEnvironmentSchemaType(DtEnvironment env,TypeSet& usedTypes) const; 00068 00070 virtual DtEnvValueSP getEnvironmentValue(DtEnvironment env); 00071 00073 virtual void updateFromEnvironment(DtEnvironment env); 00074 00076 virtual DtString type() const; 00077 00079 virtual bool isRequired() const; 00080 00081 // \brief Get/Set the variable name. 00083 virtual const DtString& name() const; 00084 00085 void setName(const DtString& name); 00087 00088 // \brief Get/Set the variable value. 00090 T value() const; 00091 void setValue(T aValue); 00093 00094 // \brief Get/Set the variable's shortcut 00096 const DtString& shortcut() const; 00097 void setShortcut(const DtString& aShortcut); 00099 00101 00102 T defaultValue() const; 00103 void setDefaultValue(T aDefault); 00105 00106 T* getInternalPtrValue(); 00107 00108 protected: 00109 00110 //Internal Type 00111 typedef typename DtVarType<T>::ArgType ArgType; 00112 00113 DtString myName; 00114 DtString myShortcut; 00115 bool myRequiredFlag; 00116 00117 DtVariableGroup* myGroup; 00118 00119 T myDefault; 00120 T myValue; 00121 }; 00122 00123 template <> 00124 DT_DLL_MTL void DtConfigVariable<bool>::updateFromCommandLineArg(); 00125 00126 template <> 00127 DT_DLL_MTL void DtConfigVariable<bool>::getCommandLineArg(DtCmdLine::CmdLine& cmdLine); 00128 00129 #include "configVar.inl" 00130 00131 #ifdef DtUSE_UTILITIES_NAMESPACE 00132 } 00133 #endif 00134 00135 #endif