CAEngine
ADE 用户指南 > ADE服务器类型参考 >
分类CAEngine(ADE)
进程内和进程外实例化
建立
ADE的使用从建立CAEngine对象开始,其它一切都从它开始产生。如果你使用ADEW.dll进程内服务器,你只能建立和使用一个CAEngine实例,如果你使用ADE.exe进程外服务器,你想建立多少个CAEngine实例都可以,每一个实例作为一个单一进程允许。在基于网络的应用程序里面,对于每一个用户会话都建立了一个单独的CAEngine实例。每一个CAEngine实例每次都可以载入一个模型。
你可以直接建立一个CAEngine实例,或者通过调用 CALicense::NewCAEngine()。后一方法需要你先建立一个 CALicense实例,其优点就是能够获得关于建立实例失败原因的更多信息。如果ADE使用许可证在指定计算机上无效,或者到期,直接建立CAEngine实例将失败。
Visual Basic.NET
C++
VBScript
属性
{get,put} string Command
在 Send()方法被调用时,将保持被执行的typescrip指令。
{get,put} CAObject CurrentModule
新建立的对象放在 CurrentModule中;一次,在建立任何新对象钱,你应该设定 CurrentModule。设置:CurrentModule = Nothing
表示没有模块打开,所有新对象都在顶层模块或者当前已经打开的模型中建立。
{get,put} CARenderingStyle DefaultDefTableRenderingStyle
控制定义表格值如何传入和传出ADE的默认风格类型。所有从 CAObject::DefTable返回的定义表在建立之初都继承这些设置。
{get,put} long DefaultEvaluationTimeLimit
对于 CAEngine中的方法, SendCommand, Send, OpenModel和 AddModule,以及对于任何实例化的 CAObject的 CAObject::MethodEvaluationTimeLimit默认值,求值计算都强加了最大时间限制(毫秒)。
{get,put} CARenderingStyle DefaultRenderingStyle
默认显示风格控制结果值如何从ADE返回。所有 实例在建立的时候都继承该显示风格。
{get} short int ErrorCode
返回最近一次与ADE服务器通讯产生的错误代码。 ErrorCode属性应该在设置和检索关键 CAEngine属性和CAEngine方法后检查。零错误代码表示最后的动作是成功的。
{get} string ErrorText
来自于 ErrorCode的短文本错误解释。
{get,put} unsigned long Flags
A bit field of flags that control certain behaviors within ADE.
{get} string Log
A record of all commands sent to the ADE typescript and the results received from those commands, when the Photo property is true.
{get} string OutputBuffer
A text string buffer that contains the result of the last typescript (i.e., using the Command property and Send method) interaction with the ADE.
{get,put} bool Photo
When Photo is True, ADE records all typescript commands and results into the Log property.
方法
string AddModule(string filePath,bool Merge)
Adds a module from file fileName into the CurrentModule. The merge parameter currently has no effect and should be set to True.
bool CloseModel()
关闭模型
CAObject CreateObject(string objName, string objType)
Creates a new Analytica object with identifier objName and class objClass in the CurrentModule and returns it as a CAObject.
bool CreateModel(string newModelName)
Creates a new Analytica model with identifier modelName.
bool DeleteObject( CAObject aObject )
Deletes CAObject obj from the current model.
CAObject Get(string objName)
与 GetObjectByName等同
CAObject GetObjectByName(string objName)
Returns an object of type CAObject for an existing Analytica object with identifier objName.
bool MonitorProcess(long pid)
(requires ADE 4.3 or greater) Instructs ADE to terminate (kill itself) if the indicated process terminates before it. Useful when debugging code that uses ADE to prevent zombie ADE processes when your code is terminated prematurely without having a chance to correctly release its objects.
string OpenModel(string filepath)
Reads a model from a disk file and opens it as the current model.
bool ReadScript(string filePath)
Reads and executes an Analytica script file.
void ResetError()
Resets the error code, error text string associated with the error code, and the output buffer to default values. This function is normally used internally, but could be useful in other circumstances as well.
bool SaveModel(string filePath)
Saves the model to file «filePath».
bool SaveModuleFile(string moduleName, string filePath)
Saves module with identifier «moduleName» into file «filePath».
bool Send()
Sends the string contained in the Command property as a command to be executed by ADE. See the Analytica Scripting Guide for details of commands and syntax.
bool SendCommand(string command)
Sends the string command property as a typescript command to be executed by ADE. See the Analytica Scripting Guide for details of commands and syntax.
bool SetCallbackObject(IUnknown* pCallbackObj)
ADE 4.6新特征
You call this to provide an object that implements various callback interfaces, such as IAdeUICallbacks, to enable interaction with end-users while evaluation is in-progress.
See Also
ADE Server Class Reference <- | CAEngine | -> CAObject |
Enable comment auto-refresher