VR-Link API Documentation for DIS
lispEnv.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 
00006 
00007 #ifndef lispEnv_H_
00008 #define lispEnv_H_
00009 
00013 
00014 #include "mtl.h"
00015 #include "mtlenv.h"
00016 #include <vlutil/vlString.h>
00017 
00019 #include <cmdLine/cmdLine.h>
00020 #include <cmdLine/cmdSwitchArg.h>
00021 #include <cmdLine/cmdUnlabeledValueArg.h>
00022 #include <cmdLine/cmdUnlabeledMultiArg.h>
00023 
00024 #include "configVar.h"
00025 
00028 #if defined(_WIN32) && _MSC_VER==1200
00029 #define registerCmdLineVar(x) \
00030    registerVar(x.getName().c_str(), x.getInternalPtrValue())
00031 #endif
00032 
00033 #ifdef DtUSE_UTILITIES_NAMESPACE
00034 namespace DtUSE_UTILITIES_NAMESPACE
00035 {
00036 #endif
00037 
00042 class DT_DLL_MTL DtMtlEnvironment
00043 {
00044 public:
00045 
00047    DtMtlEnvironment();
00048 
00050    virtual ~DtMtlEnvironment();
00051 
00053    virtual DtlObjPtr lookup(const DtString& name);
00054    
00063    virtual int registerVar(const char* name, float* addr);
00064    virtual int registerVar(const char* name, double* addr);
00065    virtual int registerVar(const char* name, int* addr);
00066    virtual int registerVar(const char* name, unsigned long* addr);
00067    virtual int registerVar(const char* name, char** addr);
00068    virtual int registerVar(const char* name, DtString* addr);
00069    virtual int registerVar(const char* name, long* addr);
00070    virtual int registerVar(const char* name, short* addr);
00071    virtual int registerVar(const char* name, unsigned short* addr);
00072 #if DT_HAVE_64BIT_LONGS
00073    virtual int registerVar(const char* name, unsigned int* addr);
00074 #endif  
00075 
00076 #if defined(_WIN32) && _MSC_VER==1200
00077 
00078 #else
00079 
00080    template<class T>
00081    int registerCmdLineVar(DtCmdLine::ValueArg<T> &arg);
00082 
00083    template<class T>
00084    int registerConfigVar(DtConfigVariable<T>& arg);
00085 #endif
00086 
00091    virtual DtlObjPtr loadLispFile(char* filename, int complain = 1);
00092    virtual DtlObjPtr loadLispFile(
00093       const DtlObjPtr& pathlist, char* filename, int complain = 1);
00094    virtual DtlObjPtr loadLispFileOrExpr(char* arg, int complain = 1);
00095    virtual DtlObjPtr loadLispExpr(char* lispLine, int complain = 1);
00096 
00102    virtual DtlObjPtr setParameter(
00103       const DtString& name, const DtlObjPtr& value);
00104    virtual DtlObjPtr setFunction(const DtString& name, DtlFcn func);
00105 
00109    virtual DtlObjPtr& env();
00110    
00111 protected:
00112 
00114    DtMtlEnvironment(const DtMtlEnvironment& orig);
00115    
00117    DtMtlEnvironment& operator=(const DtMtlEnvironment& orig);
00118 
00120    virtual DtlObjPtr setSpecialForm(const DtString& name, DtlFcn func);
00121 
00124    void initEnv();
00125 
00126 protected:
00127    
00128    DtlObjPtr myEnv;
00129 
00132    DtList* myParams;
00133 };
00134 
00136 #define DtREGISTER(var) registerVar((char *)#var, &var)
00137 
00138 inline DtlObjPtr& DtMtlEnvironment::env()
00139 {
00140    return myEnv;
00141 }
00142 
00145 #if defined(_WIN32) && _MSC_VER==1200
00146    //use macro...
00147 #else
00148 template<class T>
00149 int DtMtlEnvironment::registerCmdLineVar(DtCmdLine::ValueArg<T> &arg)
00150 {
00151    return registerVar(arg.getName().c_str(), arg.getInternalPtrValue());
00152 }
00153 
00154 template<class T>
00155 int DtMtlEnvironment::registerConfigVar(DtConfigVariable<T>& arg)
00156 {
00157    return registerVar(arg.name().c_str(), arg.getInternalPtrValue());
00158 }
00159 
00160 #endif
00161 
00162 #ifdef DtUSE_UTILITIES_NAMESPACE
00163 } 
00164 #endif
00165 
00166 #endif
00167 
00168 
00169 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)