All managed classes defined in the C++ must be described in the IDL. This section documents class description (also reffered to as class definition) syntax.
As in C++, classes in IDL can be forward declared using the following syntax:
(25) <class_fwd> ::= "class" <identifier> ";" |
Class attributes are not specified in a forward declaration.
Class definition consists of a class header and a class body. Classes are defined (or described) using the following syntax:
(26) <class_dcl> ::= <class_header> "{" <class_body> "}" (27) <class_header> ::= "class" [ "<" [ <classattr_vals> ] ">" ] <identifier> [ <class_inheritance> ] (35) <class_body> ::= <in_class>* (36) <in_class> ::= <enum> | <attr_default> | <class> | <property> | <method> | ";" |
The class header specifies an optional list of class attribute values, the class name and an optional class inheritance specification.
The class body can contain definitions of enumeration types and subclasses, attribute default overrides and declarations of class properties and methods.
Class attribute value assignments satisfy the following syntax:
(28) <classattr_vals> ::= <classattr_val> { "," <classattr_val> }* (29) <classattr_val> ::= <boolclassattr_name> | <classattr_name> "=" <const_expr> (30) <boolclassattr_name> ::= <scoped_name> (31) <classattr_name> ::= <scoped_name> |
The following table lists all class attributes defined in src/core/object/object.idl:
Name | Type | Default | Description |
---|---|---|---|
abstract | bool | false | If true, the class is abstract and can't be instantiated. |
assignable | bool | false | If true, the class implements the assignment operator. |
client_server_migrate | bool | false | If true, the client can migrate objects of this type to servers. |
comparable | bool | false | If true, the class implements the == operator. |
has_strong_pointer | bool | false | If true, the class contains a strong pointer. This attribute is automatically set by the factgen, you should not assign it a value. However, you can query its value at run-time. |
kind[a] | ClassKind | SHARED | Kind of the class. It can be SHARED, SERVER or CLIENT. See Section 4.3.7, “Class Kinds” for more info. |
no_archive[a] | bool | false | If true, the instances of the class won't be archived. Class Massiv::Core::Lib::NodeObjectInterface has this attribute set to true. You should not change value of this attribute: all node objects should be non-archivable, other objects should be archivable. |
no_balance[a] | bool | false | If true, objects of this class will not be migrated by the load balancer. |
no_migrate[a] | bool | false | If true, the instances of the class won't be allowed to migrate. Class Massiv::Core::Lib::NodeObjectInterface has this attribute set to true. You should not change the value. |
node_object[a] | bool | false | Specifies whether the class true is a node object class. Class Massiv::Core::Lib::NodeObjectInterface has this attribute set to true. You should not change the value. |
root[a] | bool | false | If true, the instances of the class will be permanent GC roots. See Section 5.4, “Garbage Collector” for more information about the garbage collector. |
simulation_startup_notify[a] | bool | false | If true, the instances of the class will be notified when the simulation is restored from an archive. The object_updated() will be called, with reason set to SIMULATION_STARTUP. Setting this attribute to true is useful when an object needs to perform special initialization on simulation startup. For example, active account objects probably contain information about the connected client. Because account objects are archived as any other objects, this information is stored in the archive. When a new simulation is started, no clients are connected, but account objects that were active when the startup archive was created may contain obsolete information about clients. Therefore the class Massiv::Core::Lib::AccountObjectInterface has this attribute set to true. The system ensures that all server nodes are running when the object_updated() is called. The order of object notifications is undefined. You must not use the synchronous RPC from the object_updated() callback. |
throwable[a] | bool | false | If true, the instances of the class can be thrown as an exception using the C++ throw. |
tracked | bool | false | If true, the instances of the class will be tracked by their object provider. This will make migrations of objects to the instances, including remote class to the instances, more efficient, and migration of the instances themselves a bit less efficient. |
value_type[a] | bool | false | If true, the instances of the class are value types. You should not set this attribute directly. Inherit the class Massiv::Core::Lib::ValueType which sets the attribute automatically instead. Value types are described in Section 4.3.4, “ValueTypes”. |
[a] This class attribute has the “inherit” attribute flag set. Different attribute value lookup rules apply it the value is not specified in the class definition. See Section 10.8.6, “Attribute Value Lookup”. |
Class inheritance is specified using the following syntax:
(32) <class_inheritance> ::= ":" <base_class_name> { "," <base_class_name> }* (33) <base_class_name> ::= [ "virtual" ] <class_name> (34) <class_name> ::= <scoped_name> |
All base classes must be defined at the scope of the definition of the derived classes. Forward declaration won't suffice. All base classes must be inherited as public in the C++ definition of the class.
Each managed class must inherit Massiv::Core::Object exactly once.