maxon.ClassInterface¶
Description¶
maxon.ClassInterface
object represents an object class at runtime.MAXON_DECLARATION()
, and it is then typically defined by
MAXON_COMPONENT_CLASS_REGISTER()
.ComponentDescriptor()
).ObjectInterface.GetClassInfo()
.ClassInterface.AddComponent()
or ClassInterface.AddComponents()
.ClassInterface.Finalize()
to make the class ready for use.maxon.GenericClass
or maxon.Class
to access a class,
this is automatically guaranteed as those are const references.ClassInterface.Finalize()
,
this will be done implicitly when the first instance of the class is allocated.MAXON_COMPONENT_CLASS_REGISTER()
and MAXON_COMPONENT_OBJECT_REGISTER()
macros greatly
simplify the setup of a class.maxon.ClassInterface
objects are automatically registered in the maxon.Classes
registry.Warning
Attributes¶
Stores the passed reference type if created e.g. |
Methods Signature¶
|
Constructs a new instance of this class.
|
|
Finalizes this class so that it can be used afterwards.
|
Returns the data type corresponding to the set of implemented interfaces of this class. |
|
|
|
|
Returns the identifier of this object class. |
Returns True if the class has been finalized successfully before. |
Methods Definition¶
-
ClassInterface.
Create
(type=None)¶ - Constructs a new instance of this class.This will invoke the constructors of each component in the order of addition, and then the ComponentRoot.InitComponent functions of each component.When one of the
ComponentRoot.InitComponent()
functions fails with an error,ComponentRoot.FreeComponent()
will be invoked on the previous (already initialized) components, the component destructors will be invoked, the memory will by freed, andClassInterface.Create()
returns the error.For a singleton class, this doesn’t create a new instance, but returns the singleton instance of this class.This instance is automatically created on finalization of the class.For an abstract class, this will always raise an error.- Parameters
type – The expected type of object to create.
type – maxon API type.
- Returns
Reference to new instance, or an error if the allocation or initialization failed.
- Return type
Any.
-
ClassInterface.
Finalize
()¶ - Finalizes this class so that it can be used afterwards.The class has to be built before by
ClassInterface.AddComponent()
.Some internal data will be set-up for the class so that it is ready for use.If you don’t invokeClassInterface.Finalize()
, it will be done implicitly when an object of the class is instantiated for the first time.
-
ClassInterface.
GetDataType
()¶ Returns the data type corresponding to the set of implemented interfaces of this class.
Note
For an abstract class this will return None.
- Returns
Data type of this class.
- Return type
-
ClassInterface.
GetId
()¶ - Returns
-
ClassInterface.
GetKind
()¶ Returns the identifier of this object class. Class identifiers are unique.
- Returns
maxon.Class
identifier.- Return type
-
ClassInterface.
IsFinalized
()¶ Returns True if the class has been finalized successfully before.
- Returns
True if the class is finalized.
- Return type
bool