oaPlugInScriptInterfaces.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaPlugInScriptInterfaces.h
00004 //
00005 // This file contains the definitions for script interface classes, and public
00006 // supporting objects. These include:
00007 //
00008 //  IBaseValue
00009 //     This abstract class is the base interface for all values used in 
00010 //     scripting. 
00011 //
00012 //  IScriptObserver
00013 //     This is the interface for observing a script engine. Objects that 
00014 //     this interface can be added as observers of an engine. 
00015 //
00016 //  IScriptEngine
00017 //     This is an abstract class which specifies the interface for the script 
00018 //     engine. This interface is used to perform actions by a script engine.
00019 //
00020 //  IValueTypeInfo
00021 //     This interface describes a value type. It has methods to bind a void C++ 
00022 //     pointer to a value object. 
00023 //
00024 //  IValueTypeLib
00025 //     This interface represents a library of value types. It has a method to 
00026 //     obtain the IValueTypeInfo object for a given type name. 
00027 //
00028 //  IValue
00029 //     This template interface is used for all primitive values in scripting. 
00030 //
00031 //  ITypeValue
00032 //     This interface is used for all values in scripting. 
00033 //
00034 // *****************************************************************************
00035 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00036 // Integration Initiative, this material may not be copied, modified,
00037 // re-published, uploaded, executed, or distributed in any way, in any medium,
00038 // in whole or in part, without prior written permission from Cadence.
00039 //
00040 //                Copyright 2002-2005 Cadence Design Systems, Inc.
00041 //                           All Rights Reserved.
00042 //
00043 //  $Author: icftcm $
00044 //  $Revision: #1 $
00045 //  $Date: 2010/08/09 $
00046 //  $State: Exp $
00047 // *****************************************************************************
00048 // *****************************************************************************
00049 
00050 
00051 
00052 #if !defined(oaPlugInScriptInterfaces_P)
00053 #define oaPlugInScriptInterfaces_P
00054 
00055 
00056 
00057 // *****************************************************************************
00058 // Nested includes
00059 // *****************************************************************************
00060 #include "oaPlugInTypes.h"
00061 #include "oaCommonSPtr.h"
00062 
00063 
00064 
00065 // *****************************************************************************
00066 // Declare and define types in the OpenAccess namespace.
00067 // *****************************************************************************
00068 BEGIN_OA_PLUGIN_NAMESPACE
00069 
00070 
00071 
00072 // *****************************************************************************
00073 // IBaseValue
00074 // *****************************************************************************
00075 extern OA_PLUGIN_DLL_API const Guid IID_IBaseValue;
00076 
00077 class OA_PLUGIN_DLL_API IBaseValue : public IBase {
00078 public:
00079     virtual const char      *getType() = 0;
00080 
00081     virtual SRef<IString>   toString() = 0;
00082 
00083 
00084     static const Guid       &getId();
00085 };
00086 
00087 
00088 
00089 // *****************************************************************************
00090 // IValueIter
00091 // *****************************************************************************
00092 extern OA_PLUGIN_DLL_API const Guid IID_IValueIter;
00093 
00094 // *****************************************************************************
00095 // IValueIter
00096 // *****************************************************************************
00097 extern OA_PLUGIN_DLL_API const Guid IID_IValueIter;
00098 
00099 class IValueIter : public IBase {
00100 public:
00101     typedef IBaseValue      *Type;
00102     typedef IBaseValue      IType;
00103 
00104     virtual bool            next(IBaseValue *&objOut) = 0;
00105     virtual void            reset() = 0;
00106 
00107     static const Guid       &getId();
00108 };
00109 
00110 
00111 
00112 // *****************************************************************************
00113 // IScriptObserver
00114 // *****************************************************************************
00115 class OA_PLUGIN_DLL_API IScriptObserver : public IBase {
00116 public:
00117     virtual void            onOutput(const char *out) = 0;
00118 };
00119 
00120 
00121 
00122 // *****************************************************************************
00123 // IScriptEngine
00124 // *****************************************************************************
00125 extern OA_PLUGIN_DLL_API const Guid IID_IScriptEngine;
00126 
00127 class OA_PLUGIN_DLL_API IScriptEngine : public IBase {
00128 public:
00129     typedef SRef<IBaseValue>    Value;
00130 
00131     virtual Value               eval(const char *code) = 0;
00132 
00133     virtual Value               eval(const char *fun,
00134                                      IValueIter *args) = 0;
00135 
00136     virtual void                setVariable(const char  *name,
00137                                             IBaseValue  *value) = 0;
00138 
00139     virtual Value               getVariable(const char *name) = 0;
00140 
00141     virtual void                defineProc(const char   *name,
00142                                            IBaseValue   *body) = 0;
00143 
00144     virtual void                undefineProc(const char *name) = 0;
00145 
00146     virtual void                addObserver(IScriptObserver *observer) = 0;
00147 
00148     virtual void                removeObserver(IScriptObserver *observer) = 0;
00149 
00150 
00151     static const Guid           &getId();
00152 };
00153 
00154 
00155 
00156 // *****************************************************************************
00157 // IValueTypeInfo
00158 // *****************************************************************************
00159 extern OA_PLUGIN_DLL_API const Guid IID_IValueInfo;
00160 
00161 class IValueTypeInfo : public IBase {
00162 public:
00163     virtual SRef<IBaseValue>    bind(void *ptr) = 0;
00164 
00165 
00166     static const Guid           &getId();
00167 };
00168 
00169 
00170 
00171 // *****************************************************************************
00172 // IValueTypeLib
00173 // *****************************************************************************
00174 extern OA_PLUGIN_DLL_API const Guid IID_IValueTypeLib;
00175 
00176 class IValueTypeLib : public IBase {
00177 public:
00178     virtual SRef<IValueTypeInfo>    getValueInfo(const char *name) = 0;
00179 
00180 
00181     static const Guid               &getId();
00182 };
00183 
00184 
00185 
00186 // *****************************************************************************
00187 // IValue<T>
00188 // *****************************************************************************
00189 template<class T>
00190 class IValue : public IBaseValue {
00191 public:
00192     virtual T               getValue() = 0;
00193 
00194     virtual void            setValue(T value) = 0;
00195 
00196 
00197     static const Guid       &getId();
00198 };
00199 
00200 
00201 
00202 // *****************************************************************************
00203 // ITypeValue
00204 // *****************************************************************************
00205 extern OA_PLUGIN_DLL_API const Guid IID_ITypeValue;
00206 
00207 class ITypeValue : public IBaseValue {
00208 public:
00209     virtual void            *getValue() = 0;
00210 
00211     virtual void            setValue(void *value) = 0;
00212 
00213 
00214     static const Guid       &getId();
00215 };
00216 
00217 
00218 
00219 // *****************************************************************************
00220 // Value Interface GUID identifiers
00221 // *****************************************************************************
00222 extern OA_PLUGIN_DLL_API const Guid IID_ICharValue;
00223 extern OA_PLUGIN_DLL_API const Guid IID_IByteValue;
00224 extern OA_PLUGIN_DLL_API const Guid IID_IInt16Value;
00225 extern OA_PLUGIN_DLL_API const Guid IID_IUInt16Value;
00226 extern OA_PLUGIN_DLL_API const Guid IID_IInt32Value;
00227 extern OA_PLUGIN_DLL_API const Guid IID_IUInt32Value;
00228 extern OA_PLUGIN_DLL_API const Guid IID_IInt64Value;
00229 extern OA_PLUGIN_DLL_API const Guid IID_IUInt64Value;
00230 
00231 extern OA_PLUGIN_DLL_API const Guid IID_IStringValue;
00232 
00233 
00234 
00235 // *****************************************************************************
00236 // Type definitions for value interfaces
00237 // *****************************************************************************
00238 typedef IValue<char> ICharValue;
00239 typedef IValue<unsigned char> IByteValue;
00240 typedef IValue<oa::oaInt2> IInt16Value;
00241 typedef IValue<oa::oaUInt2> IUInt16Value;
00242 typedef IValue<oa::oaInt4> IInt32Value;
00243 typedef IValue<oa::oaUInt4> IUInt32Value;
00244 typedef IValue<oa::oaInt8> IInt64Value;
00245 typedef IValue<oa::oaUInt8> IUInt64Value;
00246 
00247 typedef IValue<const char*> IStringValue;
00248 
00249 
00250 END_OA_PLUGIN_NAMESPACE
00251 
00252 #endif

Return to top of page