On this page:
General Metadata Directives
This directive applies to interfaces, classes, and individual operations. It enable code generation for asynchronous method invocation.
This directive applies to the deprecated AMI mapping. For the new AMI mapping there is no need for this directive.
This directive applies to interfaces, classes, and individual operations. It enables code generation for asynchronous method dispatch. (See the relevant language mapping chapter for details.)
This directive allows you to emit a deprecation warning for Slice constructs .
This directive applies to data members of classes and changes code generation to make these members protected. See class mapping of the relevant language mapping chapter for more information.
This directive applies only to operations on local interfaces. The metadata directive indicates that the operation can throw any user exception, regardless of its specific definition. (This directive is used for the
finished operations on servant locators, which can throw any user exception.)
Metadata Directives for C++
These directives apply to sequences. They direct the code generator to create zerocopy APIs for passing sequences as parameters.
This directive applies to structures. It directs the code generator to create a C++ class (instead of a C++ structure) to represent a Slice structure.
This directive applies to operations. It directs the code generator to create a
const pure virtual member function for the skeleton class.
This directive applies to data members of type string as well as to containers, such as structures, classes, and exceptions. It changes the default mapping for strings from
This global directive allows you to use a file extension for C++ header files other than the default
This global directive allows you inject additional #include directives into the generated code. This is useful for custom types.
This directive applies to classes. If the directive is present and a class has base classes, the generated C++ class derives virtually from its bases; without this directive, slice2cpp generates the class so it derives non-virtually from its bases.
This directive is useful if you use Slice classes as servants and want to inherit the implementation of operations in the base class in the derived class. For example:
The metadata directive causes slice2cpp to generate the class definition for
Derived using virtual inheritance:
This allows you to reuse the implementation of
baseOp in the servant for
Derived using ladder inheritance:
Note that, if you have data member in classes and use virtual inheritance, you need to take care to correctly call base class constructors if you implement your own one-shot constructor. For example:
The generated one-shot constructor for
Derived initializes both
If you derive your own class from
Derived and add a one-shot constructor to your class, you must explicitly call the constructor of all the base classes, including
Base. Failure to call the
Base constructor will result in
Base being default-constructed instead of getting a defined value. For example:
This code correctly initializes the
baseInt member of the
Base part of the class. Note that the following does not work as intended and leaves the
Base part default-constructed (meaning that
baseInt is not initialized):
Metadata Directives for Java
This global directive instructs the code generator to place the generated classes into a specific package.
This directive applies to data members and structures, classes, and exceptions. It adds accessor and modifier methods (JavaBean methods) for data members.
This directive allows you to use Ice to transmit serializable Java classes as native objects, without having to define corresponding Slice definitions for these classes.
This directive allows to use custom types for sequences and dictionaries.
Metadata Directives for C#
Note that C# (and other Common Language Runtime languages) are also affected by metadata with a
clr: prefix. (See #Metadata Directives for .NET and Mono.)
This directive can be used both as a global directive and as directive for specific Slice constructs. It injects C# attribute definitions into the generated code. (See C-Sharp Specific Metadata Directives.)
Metadata Directives for .NET and Mono
This directive applies to Slice structures. It directs the code generator to emit a C# class instead of a structure.
These directives apply to sequences and map them to the specified sequence type.
This directive applies to dictionaries and maps them to
This directive applies to sequences and allows you map them to custom types.
This directive applies to Slice structures and classes. It directs the code generator to create C# property definitions for data members.
This directive allows you to use Ice to transmit serializable CLR classes as native objects, without having to define corresponding Slice definitions for these classes.
Metadata Directives for Objective-C
This directive applies to modules and changes the default mapping for modules to use a specified prefix.
Metadata Directives for Python
This global directive instructs the code generator to place the generated code into a specified Python package.
These directives allow you to change the mapping for Slice sequences.
Metadata Directives for Freeze
These directives inform a Freeze evictor whether an operation updates the state of an object, so the evictor knows whether it must save an object before evicting it.