Entry
When do I use TCSI_static_language or TCSI_language MOSU properties?
Oct 14th, 2004 07:30
Kalu Ral, Engineer TCSI, http://www.consolidate-loan-student.com , http://www.0-apr-credit-card.biz , http://www.clearpathoverseas.com
When writing a MOSU definition, you can choose to implement an
operation
in python, by specifying the implementation language as "python".
There
are two scenarios:
1. You are developing a new component with Component Generator, and
the
MOSU is the "Default" package, which defines the "hard-wired" classes
in
the unit.
If operations of these classes are to be implemented in python, the
%TCSI_static_language="Python" property:
CLASS MyClass
{
....
VIRTUAL SELECTOR MyStaticOp() % TCSI_static_language = "Python";
....
};
2. You are developing a new dynamic package for a pre-built MOSU unit.
In the case, the operations are purely dynamic, and the "static"
property must not be used: use %TCSI_language="Python" instead.
CLASS MyClass
{
....
VIRTUAL SELECTOR MyDynamicOp() % TCSI_language = "Python";
....
};
The difference between these two cases is that the "static" version
generates a C++ stub function (about 20 lines long) in the MyClass.C
file, which packages up the arguments, and invokes a python function
of
the same name. As far as the OSP infrastructure is concerned, it
treats
it as a standard C++ implementation.
The dynamic version does not generate any C++ code, and uses the
dynamic
functions of OSP to invoke the python function directly.
If make use "TCSI_static_language" in a dynamic package, you get a
"Dynamic executor missing" error when you invoke the operation.
Likewise, if you use "TCSI_language" in a Default package, you get a
similar error.