C++98 Mapping for Operations on Local Types
An operation on a local interface or a local class is mapped to a pure virtual member function with the same name. The mapping of operation parameters to C++ is identical to the Client-Side Mapping for these parameters:
- in parameters are passed by value (for simple types such as integers), or by const reference (for other types)
- out parameters are passed by reference
- return values are mapped to return values in C++
However, unlike the Client-Side mapping, there is no trailing Ice::Context
parameter in the mapped member functions.
The type of a parameter can be a local interface or class. Such a parameter is passed as a <mapped C++ class>
Ptr
.
A LocalObject
parameter is mapped to a parameter of type Ice::LocalObjectPtr. You can also create constructed types (such as local sequences and local dictionaries) with local types.
For example:
Slice
module M { local interface L; // forward declared local sequence<L> LSeq; local interface L { string op(int n, string s, LocalObject any, out int m, out string t, out LSeq newLSeq); } }
is mapped to:
C++
namespace M { class L; typedef IceInternal::Handle<L> LPtr; typedef std::vector<LPtr> LSeq; class L : public virtual Ice::Object { public: virtual ~L(); virtual std::string op(int n, const std::string&, const Ice::LocalObjectPtr& any, int& m, std::string& t, LSeq& newLSeq) = 0; }; }