VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtlEnvironment.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 
7 #ifndef mtlEnvironment_H_
8 #define mtlEnvironment_H_
9 
13 
14 #include "mtl.h"
15 #include "mtlenv.h"
16 #include <vlutil/vlString.h>
17 
19 #include <cmdLine/cmdLine.h>
20 #include <cmdLine/cmdSwitchArg.h>
23 
24 #include "configVariable.h"
25 
28 #if defined(_WIN32) && _MSC_VER==1200
29 #define registerCmdLineVar(x) \
30  registerVar(x.getName().c_str(), x.getInternalPtrValue())
31 #endif
32 
33 #ifdef DtUSE_UTILITIES_NAMESPACE
34 namespace DtUSE_UTILITIES_NAMESPACE
35 {
36 #endif
37 
43 {
44 public:
45 
48 
50  virtual ~DtMtlEnvironment();
51 
53  virtual DtlObjPtr lookup(const DtString& name);
54 
63  virtual int registerVar(const char* name, float* addr);
64  virtual int registerVar(const char* name, double* addr);
65  virtual int registerVar(const char* name, int* addr);
66  virtual int registerVar(const char* name, unsigned long* addr);
67  virtual int registerVar(const char* name, char** addr);
68  virtual int registerVar(const char* name, DtString* addr);
69  virtual int registerVar(const char* name, long* addr);
70  virtual int registerVar(const char* name, short* addr);
71  virtual int registerVar(const char* name, unsigned short* addr);
72 #if DT_HAVE_64BIT_LONGS
73  virtual int registerVar(const char* name, unsigned int* addr);
74 #endif
75 
76 #if defined(_WIN32) && _MSC_VER==1200
77 #else
79  template<class T>
81  int registerCmdLineVar(DtCmdLine::ValueArg<T> &arg);
82 
83  template<class T>
84  int registerConfigVar(DtConfigVariable<T>& arg);
85 #endif
86 
91  virtual DtlObjPtr loadLispFile(char* filename, int complain = 1);
92  virtual DtlObjPtr loadLispFile(
93  const DtlObjPtr& pathlist, char* filename, int complain = 1);
94  virtual DtlObjPtr loadLispFileOrExpr(char* arg, int complain = 1);
95  virtual DtlObjPtr loadLispExpr(char* lispLine, int complain = 1);
96 
102  virtual DtlObjPtr setParameter(
103  const DtString& name, const DtlObjPtr& value);
104  virtual DtlObjPtr setFunction(const DtString& name, DtlFcn func);
105 
109  virtual DtlObjPtr& env();
110 
111 protected:
112 
114  DtMtlEnvironment(const DtMtlEnvironment& orig);
115 
117  DtMtlEnvironment& operator=(const DtMtlEnvironment& orig);
118 
120  virtual DtlObjPtr setSpecialForm(const DtString& name, DtlFcn func);
121 
124  void initEnv();
125 
126 protected:
127 
129 
133 };
134 
136 #define DtREGISTER(var) registerVar((char *)#var, &var)
137 
139 {
140  return myEnv;
141 }
142 
145 #if defined(_WIN32) && _MSC_VER==1200
146  //use macro...
147 #else
148 template<class T>
150 {
151  return registerVar(arg.getName().c_str(), arg.getInternalPtrValue());
152 }
153 
154 template<class T>
156 {
157  return registerVar(arg.name().c_str(), arg.getInternalPtrValue());
158 }
159 
160 #endif
161 
162 #ifdef DtUSE_UTILITIES_NAMESPACE
163 }
164 #endif
165 
166 #endif
167 
168 
169 
Definition: configVariable.h:39
command line support
Definition: mtlEnvironment.h:42
int registerConfigVar(DtConfigVariable< T > &arg)
Definition: mtlEnvironment.h:155
T * getInternalPtrValue()
T * getInternalPtrValue()
Returns a pointer to the internal storage for this class This is useful for MTL and other not so smar...
Contains the DtString class declaration.
Definition: mtl.h:70
const std::string & getName() const
Returns the argument name.
Definition: cmdArg.h:473
virtual DtlObjPtr & env()
Used to get the actual lisp environment object.
Definition: mtlEnvironment.h:138
DtlObjPtr(* DtlFcn)(const DtlObjPtr &args, const DtlObjPtr &env)
Definition: mtl.h:102
The basic labeled argument that parses a value.
Definition: cmdValueArg.h:63
DtList is deprecated, please use std::list&lt;T&gt;.
Definition: vlList.h:71
Contains the DtConfigVariable class declaration.
This class declares DtlHashTable.
virtual const DtString & name() const
Get the Var&#39;s name.
This file declares the class DtCmdLine::CmdLine.
DtlObjPtr myEnv
Definition: mtlEnvironment.h:128
This file declares the class DtCmdLine::SwitchArg.
This file declares the class DtCmdLine::UnlabeledValueArg.
virtual const char * c_str() const
Returns a char* representation of the DtString;.
This file contains common methods for parsing mtl files.
int registerCmdLineVar(DtCmdLine::ValueArg< T > &arg)
Registers command line arguments.
Definition: mtlEnvironment.h:149
#define DT_DLL_MTL
Definition: vlMachineTypes.h:106
DtList * myParams
List of DtcParam*&#39;s representing C variables that have been registered with us.
Definition: mtlEnvironment.h:132
Instances of DtString are used to represent strings.
Definition: vlString.h:29
This file declares the class DtCmdLine::UnlabeledMultiArg.

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)