![]() |
VR-Link API Documentation for HLA 1516
|
00001 /****************************************************************************** 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00006 00008 00009 #ifndef baseConfigVar_H_ 00010 #define baseConfigVar_H_ 00011 00012 00013 #include <mtl/env.h> 00014 #include <list> 00015 #include <set> 00016 00017 00018 #ifdef DtUSE_UTILITIES_NAMESPACE 00019 namespace DtUSE_UTILITIES_NAMESPACE 00020 { 00021 #endif 00022 00023 namespace DtCmdLine 00024 { 00025 class Arg; 00026 class CmdLine; 00027 } 00028 00029 // Forward declarations 00030 class DtVariableGroup; 00031 class DtString; 00032 00033 00035 class DT_DLL_MTL DtBaseConfigVariable 00036 { 00037 public: 00038 00039 typedef std::set<DtString> TypeSet; 00040 00041 enum DtVariableScope 00042 { 00043 DtScopeInternal, 00044 DtScopeConfigFile, 00045 DtScopeCommandLine, 00046 DtScopeBoth 00047 }; 00048 00050 DtBaseConfigVariable(DtVariableGroup* settings, 00051 DtVariableScope aScope, const DtString& aDescription); 00052 00054 virtual ~DtBaseConfigVariable(); 00055 00057 inline DtVariableScope scope() const 00058 { 00059 return myScope; 00060 } 00061 00062 inline const DtString& description() const 00063 { 00064 return myDescription; 00065 } 00066 00068 inline bool inConfigFile() const 00069 { 00070 return scope() == DtScopeConfigFile || scope() == DtScopeBoth; 00071 } 00072 00074 inline bool inCommandLine() const 00075 { 00076 return scope() == DtScopeCommandLine || scope() == DtScopeBoth; 00077 } 00078 00080 inline bool isSet() const { return mySetFlag; } 00081 00082 //@name Abstract Interface 00084 00086 virtual const DtString& name() const = 0; 00087 00089 virtual bool isRequired() const = 0; 00090 00093 virtual void getCommandLineArg(DtCmdLine::CmdLine& cmdLine) = 0; 00094 00097 virtual void updateFromCommandLineArg() = 0; 00098 00102 virtual void getEnvironmentSchemaType(DtEnvironment env, 00103 TypeSet& usedTypes) const = 0; 00104 00108 virtual DtEnvValueSP getEnvironmentValue(DtEnvironment env) = 0; 00109 00112 virtual void updateFromEnvironment(DtEnvironment env) = 0; 00113 00115 virtual DtString type() const = 0; 00116 00118 00119 static DtEnvValueSP createSchemaDeclaration(DtEnvironment env, 00120 const DtString& name,const DtString& type); 00121 00123 static DtEnvValueSP createSimpleSchemaType(DtEnvironment env, 00124 const DtString& typeName, 00125 const DtString& xsType ); 00126 00128 static DtEnvValueSP createComplexSchemaType(DtEnvironment env, 00129 const DtString& typeName,bool ordered, 00130 const std::list<DtBaseConfigVariable*>& members); 00131 00132 00133 protected: 00134 00136 DtVariableScope myScope; 00137 00139 bool mySetFlag; 00140 00142 DtCmdLine::Arg* myArg; 00143 00145 DtString myDescription; 00146 }; 00147 00148 00149 #ifdef DtUSE_UTILITIES_NAMESPACE 00150 } 00151 #endif 00152 00153 00154 #endif