All EAServer component interfaces are defined in standard CORBA IDL, and C++ stubs and skeletons use the standard CORBA IDL-to-C++ type mappings.
For local variables that map to constructed C++ types and do not represent an IDL interface, use the C++ datatype that is appended with _var. _var variables are automatically freed when they are out of scope. If you do not use the _var type, references must be freed with the C++ delete operator. In Table 13-1, string, binary, decimal, money, date, time, timestamp, ResultSet, and ResultSets have _var types. Other types listed in Table 13-1 map to fixed-length C++ types. For fixed-length types, use the base C++ type.
IDL interfaces map to C++ classes that extend the CORBA::Object class. These object reference types have a _var form for references with automatic memory management, and a _ptr form for references that must remain valid after the reference variable goes out of scope. _ptr references must be freed by calling CORBA::release.
You must pass values in a _var type as follows:
MyType_var v; .... v.in() // Passes v as an in // parameter. v.inout() // Passes v as an inout // parameter. v.out() // Passes v as an out // parameter. return v._retn() // Passes v as a return value.
Do not use the C++ _out types for local variables; these types are reserved for method signatures.
For out and inout parameters of IDL type string, use CORBA::string_alloc or CORBA::string_dup to allocate memory for them. For example:
ItemName = CORBA::string_dup("Dummy Item Name"); ItemData = CORBA::string_dup("Dummy Item Data");
In C++, if you declare string variables as type CORBA::String_var, memory allocated by CORBA::string_dup or CORBA::string_alloc is freed automatically. Otherwise, declare as char * and free the memory explicitly by calling CORBA::string_free.
You can pass a null value as a parameter type only with the object reference type Module::Interface::_nil().
Copyright © 2005. Sybase Inc. All rights reserved. |