How to use Metainfo


| Introduction | How to use | ClassLoader | Serialization | Reflection | Attributes | Mechanism |

How to create Metainfo for C++ classes and Scripting ACDK classes, like CfgScript COM objects, etc.

Content of this chapter:

   Level of Metainfo
     No Metainfo
     Basic Metainfo
     Extended Metainfo
     DmiProxy Metainfo
   Create basic and extended Metainfo for C++

 Level of Metainfo

ACDK classes can have multiple levels of Metainfo attached.

 No Metainfo

For pure ordinary C++ usage of ACDK classes you don't need Metainfo at all:


class MyClass 
: extends acdk::lang::Object
, implements acdk::lang::Comparable
  RString _myString;
	: _myString("hello")
	int compareTo(IN(RObject) other) 
		return 0; // always equal
	int foo() { return _myString->length(); }

// using it
RMyClass myClass = new MyClass();

There is no problem with this code. Standard operations, including  instanceof will work.
As long the class does not contain any cyclic reference, the reference count based garbage collector works.

 Basic Metainfo

Basic Metainfo attaches additional information to a class:
  • Derivation graph (MyClass is derived from Object and implements the Comparable interface)
  • Possibility to resolve cyclic reference in garbace collecting.
  • Basic  ClassLoader ability.

 Extended Metainfo

Extended Metainfo enables following features

 DmiProxy Metainfo

  • Allows to implement C++ interfaces in a scripting language
  • Allows to derive C++ classes, including overwriting virtual methods.

 Create basic and extended Metainfo for C++

To create basic and/or extended Metainfo for a C++ class you have to put the C++ class definition into a header file (MyClass.h) and enrich the sample C++ class.

Please refer to  DMI Server Objects how a C++ class with Metainfo looks like, and how generate the Metainfo using acdkmc.