ObjectInterface Class Reference 系统

#include <objectbase.h>

Inheritance diagram for ObjectInterface:

详细描述

ObjectInterface is the root of the interface hierarchy of the MAXON API. As a C++ class, each virtual interface is directly derived from ObjectInterface , but as an interface a virtual interface may have an arbitrary number of base interfaces, all of which have ObjectInterface as direct or indirect base interface. The interface hierarchy is reflected by the Ptr, ConstPtr and reference classes of the interfaces: They have conversion operators to all base interfaces, and they contain functions for all methods of the interface and its base interfaces.

ObjectInterface provides some general inheritance-related functions such as GetClass() and IsInstanceOf() , data-related functions such as Clone() and CopyFrom() , and virtual methods such as ToString() which are required for each object.

所有 ObjectInterface instances are reference-counted. Within the declaration of an interface you may choose the reference behaviour on invocation of a non-const method (normal, const, copy-on-write).

Classes

struct   PrivateSuperMTable
struct   ReferenceFunctions

Public Types

using  接口 = ObjectInterface
using  IsAllocType = std::true_type
using  Ptr = maxon::ReferenceBase< ReferenceFunctions < maxon::RefBaseFunctions< maxon::DirectRef< ObjectInterface , maxon::PointerHandler , void > >> >
using  ConstPtr = maxon::ReferenceBase< ReferenceFunctions < maxon::RefBaseFunctions< maxon::DirectRef< const ObjectInterface , maxon::PointerHandler , void > >> >
using  BaseInterface = ObjectInterface

公共成员函数

Ptr   GetPtr ()
ConstPtr   GetPtr () const
template<typename INTERFACE = ObjectInterface>
const MAXON_FUNCTION maxon::Class < typename INTERFACE::Hxx1::ReferenceClass > &  GetClass () const
const MAXON_FUNCTION ClassInfo *  GetClassInfo () const
template<typename REF >
const ComponentInfo &  GetComponentInfoOfSuper (const REF *sptr, OverloadRank0 ) const MAXON_IF_TARGET_DEBUG (
template<typename REF , typename = typename REF::Component::ComponentClass>
const ComponentInfo &  GetComponentInfoOfSuper (const REF *sptr, OverloadRank1 ) const
MAXON_FUNCTION Bool   HasSameClass (const ObjectInterface *obj) const
Result < void >  CopyFrom (const ObjectInterface * src )
Result < ObjectInterface * >  Clone () const
template<typename REFCLASS >
MAXON_FUNCTION Result < REFCLASS >  Clone () const
template<typename I >
MAXON_FUNCTION Bool   IsInstanceOf () const
MAXON_FUNCTION Bool   IsInstanceOf (const DataType &type) const
MAXON_METHOD String   ToString (const FormatStatement *formatStatement=nullptr) const
MAXON_METHOD Result < void >  InitObject (const void *argument)
MAXON_METHOD Result < void >  HandleMessage (const InternedId &message, const void *argument)
MAXON_METHOD Bool   IsEqual (const maxon::ObjectInterface *other) const
MAXON_METHOD COMPARERESULT   比较 (const maxon::ObjectInterface *other) const
MAXON_FUNCTION HashInt   GetHashCode () const
MAXON_METHOD HashInt   GetHashCodeImpl () const
MAXON_METHOD HashValue   GetHashValueImpl () const
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator==(std::nullptr_t) const { return RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), nullptr);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!=(std::nullptr_t) const { return ! RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), nullptr);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator==(const ObjectInterface *ref) const { return RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!=(const ObjectInterface *ref) const { return ! RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator==( ObjectInterface *ref) const { return RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!=( ObjectInterface *ref) const { return ! RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS (template< typename T > Bool operator==(T *ref) const { return RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
  MAXON_ADD_TO_CONST_REFERENCE_CLASS (template< typename T > Bool operator!=(T *ref) const { return ! RefCompare < MAXON_IS_COW_KIND (S::Handler::KIND), true >::template IsEqual < const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);})
Bool   PrivateIsInstanceOf (const DataType &type) const

静态公共成员函数

static maxon::Id   GetInterfaceId ()
static ObjectInterface Alloc ( MAXON_SOURCE_LOCATION_DECLARATION , const ObjectInterface & src )
template<typename DUMMY >
static maxon::Int   PrivateInstantiateNullValueHelper ()
static maxon::InterfaceReference *  PrivateGetInterface ()
static std::nullptr_t  NullValuePtr ()
static void  PrivateFreeInstance ( ObjectInterface *o)

Public Attributes

maxon::ObjectInterface::ReferenceFunctions   MAXON_ENUM_LIST_CLASS

静态公共属性

static maxon::InterfaceReference  _interface
static maxon::NonvirtualInterfaceReference  _staticInterface
static const maxon::EntityBase::FLAGS  REFERENCE_KIND
static const EntityBase::FLAGS  INTERFACE_FLAGS

Protected Member Functions

  ~ ObjectInterface ()
void  RemoveReference () const

私有成员函数

  ObjectInterface ()
  ObjectInterface (const ObjectInterface &)
void  operator= (const ObjectInterface &)
void  PrivateCheckClass ()
  ObjectInterface (const ClassInfo *tbl)

Static Private Member Functions

static ObjectInterface Alloc ( MAXON_SOURCE_LOCATION_DECLARATION )
static maxon::Int   GetInfoOffset ()
static void  PrivateDestructInstance ( ObjectInterface *o)

Friends

class  maxon::ClassInterface
class  maxon::ComponentDescriptor
class  maxon::StrongCOWRefHandler
template<typename >
class  ComponentWrapper
class  StrongRefHandler
class  ClassImpl

Member Typedef Documentation

◆  接口

using 接口 = ObjectInterface

◆  IsAllocType

using IsAllocType = std::true_type

◆  Ptr

using Ptr = maxon::ReferenceBase< ReferenceFunctions <maxon::RefBaseFunctions<maxon::DirectRef< ObjectInterface , maxon::PointerHandler , void> >> >

◆  ConstPtr

using ConstPtr = maxon::ReferenceBase< ReferenceFunctions <maxon::RefBaseFunctions<maxon::DirectRef<const ObjectInterface , maxon::PointerHandler , void> >> >

◆  BaseInterface

using BaseInterface = ObjectInterface

构造函数 & 析构函数文档编制

◆  ~ ObjectInterface()

~ ObjectInterface ( )
protected

◆  ObjectInterface() [1/3]

ObjectInterface () private

◆  ObjectInterface() [2/3]

ObjectInterface ( const ObjectInterface )
private

◆  ObjectInterface() [3/3]

ObjectInterface ( const ClassInfo *  tbl )
explicit private

成员函数文档编制

◆  GetInterfaceId()

static maxon::Id GetInterfaceId ( )
static

◆  Alloc() [1/2]

static ObjectInterface * Alloc ( MAXON_SOURCE_LOCATION_DECLARATION   ,
const ObjectInterface src  
)
static

◆  GetPtr() [1/2]

Ptr GetPtr ( )

◆  GetPtr() [2/2]

ConstPtr GetPtr ( ) const

◆  PrivateInstantiateNullValueHelper()

static maxon::Int PrivateInstantiateNullValueHelper ( )
static

◆  PrivateGetInterface()

static maxon::InterfaceReference* PrivateGetInterface ( )
static

◆  Alloc() [2/2]

static ObjectInterface * Alloc ( MAXON_SOURCE_LOCATION_DECLARATION   )
static private

◆  GetInfoOffset()

static maxon::Int GetInfoOffset ( )
static private

◆  operator=()

void operator= ( const ObjectInterface )
private

◆  PrivateCheckClass()

void PrivateCheckClass ( )
private

◆  NullValuePtr()

static std::nullptr_t NullValuePtr ( )
static

◆  GetClass()

const MAXON_FUNCTION maxon::Class <typename INTERFACE::Hxx1::ReferenceClass>& GetClass ( ) const

Returns the class of this object. Each object holds a strong reference on its class.

返回
Class of this object. @MAXON_ANNOTATION{interfaceParameter=INTERFACE}

◆  GetClassInfo()

const MAXON_FUNCTION ClassInfo* GetClassInfo ( ) const

Returns the class information of this object.

返回
Class information of this object.

◆  GetComponentInfoOfSuper() [1/2]

const ComponentInfo& GetComponentInfoOfSuper ( const REF *  sptr ,
OverloadRank0    
) const

◆  GetComponentInfoOfSuper() [2/2]

const ComponentInfo& GetComponentInfoOfSuper ( const REF *  sptr ,
OverloadRank1    
) const

◆  HasSameClass()

MAXON_FUNCTION Bool HasSameClass ( const ObjectInterface obj ) const

Tests if this object has the same class as another object obj.

参数
[in] obj Another object.
返回
True if both objects have the same class.

◆  CopyFrom()

Result <void> CopyFrom ( const ObjectInterface src )

Copies the data from a source object to this object. This object needs to have a matching component for each component of the source (there may be additional components). Copying is done per component by the CopyFrom function of components.

参数
[in] src Source object.
返回
OK on success (for each component of src there is a matching component in this object, and copying the component data succeeded).

◆  Clone() [1/2]

Result < ObjectInterface *> Clone ( ) const

Clones this object. The result is a new object of the same class where each component is a copy of the corresponding component of this object (as implemented by the CopyFrom function of components).

返回
Clone of this object.

◆  Clone() [2/2]

MAXON_FUNCTION Result <REFCLASS> Clone ( ) const

Clones this object. The result is a reference to a new object of the same class where each component is a copy of the corresponding component of this object (as implemented by the CopyFrom function of components).

返回
Clone of this object. @MAXON_ANNOTATION{refclassParameter=REFCLASS}

◆  IsInstanceOf() [1/2]

MAXON_FUNCTION Bool IsInstanceOf ( ) const

Checks if this object is an instance of the given interface I . This is the case if the class of this object has a component which implements I .

Template Parameters
I The interface to check.
返回
True if this object is an instance of #I, false otherwise.

◆  IsInstanceOf() [2/2]

MAXON_FUNCTION Bool IsInstanceOf ( const DataType type ) const

Checks if this object is an instance of the given data type. This is the case if the type is an object type and if the class of this object implements each interface of the object type.

参数
[in] type The data type to check.
返回
True if this object is an instance of #type, false otherwise.

◆  ToString()

MAXON_METHOD String ToString ( const FormatStatement formatStatement = nullptr ) const

Returns a readable string of the content.

参数
[in] formatStatement Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
返回
The converted result. By default, this is the name of the class, followed by @, followed by the hexadecimal memory address of this object.

◆  InitObject()

MAXON_METHOD Result <void> InitObject ( const void *  argument )

Initializes the object. This method is invoked implicitly when a new object is created (after InitComponent has been invoked for each component). When the initialization fails, the new object is deleted immediately.

参数
[in] argument Unused for now.
返回
Success of initialization.

◆  HandleMessage()

MAXON_METHOD Result <void> HandleMessage ( const InternedId message ,
const void *  argument  
)

Handles a generic message. The supported messages are defined by the class of the object. The default implementation returns UnsupportedOperationError.

参数
[in] message The message identifier.
[in] argument A message-specific argument.
返回
Success of message handling.

◆  IsEqual()

MAXON_METHOD Bool IsEqual ( const maxon::ObjectInterface other ) const

Compares this and #other for equality. If you implement this method in a component, make sure to incorporate the result of the super implementation in the result.

参数
[in] other Another object.
返回
True if both object are equal, false otherwise.

◆  Compare()

MAXON_METHOD COMPARERESULT 比较 ( const maxon::ObjectInterface other ) const

Compares this and #other. If you implement this method in a component, make sure to incorporate the result of the super implementation in the result.

参数
[in] other Another object.
返回
Result of the comparison.

◆  GetHashCode()

MAXON_FUNCTION HashInt GetHashCode ( ) const

Returns a hash code for this object.

返回
Hash code for this object. @MAXON_ANNOTATION{refclass=false}

◆  GetHashCodeImpl()

MAXON_METHOD HashInt GetHashCodeImpl ( ) const

Returns a hash code for this object. If you implement this method in a component, make sure to incorporate the result of the super implementation in the result.

返回
Hash code for this object.

◆  GetHashValueImpl()

MAXON_METHOD HashValue GetHashValueImpl ( ) const

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [1/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool   operator = =(std::nullptr_t) const { return RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), nullptr);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [2/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!  = (std::nullptr_t) const { return !RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), nullptr);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [3/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool   operator = =(const ObjectInterface *ref) const { return RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [4/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!  = (const ObjectInterface *ref) const { return !RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [5/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool   operator = =(ObjectInterface *ref) const { return RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [6/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( Bool operator!  = (ObjectInterface *ref) const { return !RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [7/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( template< typename T > Bool   operator = =(T *ref) const { return RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  MAXON_ADD_TO_CONST_REFERENCE_CLASS() [8/8]

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( template< typename T > Bool operator!  = (T *ref) const { return !RefCompareMAXON_IS_COW_KIND(S::Handler::KIND), true >::template IsEqual< const ObjectInterface *, const ObjectInterface * >(this->GetPointer(), ref);} )

◆  PrivateIsInstanceOf()

Bool PrivateIsInstanceOf ( const DataType type ) const

◆  PrivateFreeInstance()

static void PrivateFreeInstance ( ObjectInterface o )
static

◆  RemoveReference()

void RemoveReference ( ) const
protected

◆  PrivateDestructInstance()

static void PrivateDestructInstance ( ObjectInterface o )
static private

Friends And Related Function Documentation

◆  maxon::ClassInterface

friend class maxon::ClassInterface
friend

◆  maxon::ComponentDescriptor

friend class maxon::ComponentDescriptor
friend

◆  maxon::StrongCOWRefHandler

friend class maxon::StrongCOWRefHandler
friend

◆  ComponentWrapper

friend class ComponentWrapper friend

◆  StrongRefHandler

friend class StrongRefHandler
friend

◆  ClassImpl

friend class ClassImpl friend

Member Data Documentation

◆  _interface

maxon::InterfaceReference _interface static

◆  _staticInterface

maxon::NonvirtualInterfaceReference _staticInterface static

◆  MAXON_ENUM_LIST_CLASS

maxon::ObjectInterface::ReferenceFunctions MAXON_ENUM_LIST_CLASS

◆  REFERENCE_KIND

const maxon::EntityBase::FLAGS REFERENCE_KIND static

◆  INTERFACE_FLAGS

const EntityBase::FLAGS INTERFACE_FLAGS static