Modeling Services > Rogue Wave Script Integration > Implementing Dynamic Functions Using Scripts
 
Implementing Dynamic Functions Using Scripts
You can provide a script implementation of your dynamic methods by using the API of the dynamic model interpreter or by loading a script file to a dynamic server. As member functions are not supported “as is” by Rogue Wave® Script the name of the Rogue Wave Script function must be built both from the class name and the method name, as follows:
<class_name>_<method_name>(obj)
where the value passed to the first argument of the function will be the class instance on which the method is called.
The syntax for declaring a dynamic method using Rogue Wave Script is shown in the following example.
Example
Let us assume you have defined a dynamic class Network; do the following to implement the dynamic method display(string title):
function Network_display(obj, title) {
....
}
The first argument, obj, is the instance of your dynamic class Network on which the method is called. You can also invoke this method using the member function IlsDynObject::callFunction from your C++ code or using an execCallback from a component.
Important: Rogue Wave Server Script integration does not support overloading of functions with the same name but with a different number of arguments. Only the last definition of the Rogue Wave Script function in the file will be taken into account.
Rogue Wave Script Implementation and Static Classes
It is possible to declare a dynamic function with a static class ( inheriting from IlsDynObject) and to provide a script implementation for this function. To do so, use the function IlsDynModelInterpreter::DeclScriptFun. Note that this declaration should be performed before Script proxies are built, that is before any script file is loaded. This method should be passed an Rogue Wave Script implementation in a script file using the standard notation (className_funcName).

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.