Defines

IZUnknownImplHelper.hpp File Reference

#include <zeusbase/Config/PlatformDefines.hpp>

Go to the source code of this file.

Defines

#define MEMORY_MANAGER_DECL
#define INTERFACE_CAST_START(classid)
#define INLINE_INTERFACE_CAST_START
#define MEMORY_MANAGER_IMPL_PARENT(classid, parent)
#define MEMORY_MANAGER_INLINEIMPL_PARENT(parent)
#define MEMORY_MANAGER_IMPL(classid)   MEMORY_MANAGER_IMPL_PARENT(classid, NAMESPACE_Zeus::TZObject)
#define MEMORY_MANAGER_INLINEIMPL()   MEMORY_MANAGER_INLINEIMPL_PARENT(NAMESPACE_Zeus::TZObject)
#define MEMORY_MANAGER_IMPL_LOCK(classid, lock)
#define INTERFACE_CAST(interface_type, interface_id)   INTERFACE_CAST_VAR(interface_type, interface_id, this)
#define INTERFACE_CAST_VAR(interface_type, interface_id, variable_)
#define MEMORY_MANAGER_IMPL_PARENT_END(parent)
#define MEMORY_MANAGER_IMPL_END   MEMORY_MANAGER_IMPL_PARENT_END(NAMESPACE_Zeus::TZObject)
#define ICAST(variable)   (NAMESPACE_Zeus::IZUnknown*&)variable
#define HIDE_MEMORY_MANAGER_DEF
#define MExportObjectFactory(InterFace, ClassName)
#define MExportSerializableObject(InterFace, ClassName)
#define MExportSingletonObject(InterFace, SingletonObj)
#define HIDE_ASSIGNMENT_OPERATOR(class_type)
#define HIDE_DESTRUCTOR(class_type)

Define Documentation

#define HIDE_ASSIGNMENT_OPERATOR (   class_type )

This macro hides the assignment operator of a class given an object of the same class.

Parameters:
class_type,:Class type.
#define HIDE_DESTRUCTOR (   class_type )

This macro hides the destructor of a class given an object of the same class.

Parameters:
class_type,:Class type.
#define HIDE_MEMORY_MANAGER_DEF
Value:
protected: \
    virtual NAMESPACE_Zeus::Retval MQUALIFIER askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface)=0;\
    virtual void MQUALIFIER addRef() const=0;\
    virtual void MQUALIFIER release() const=0;

This macro hides the declaration part of the memory management for stack objects

#define ICAST (   variable )    (NAMESPACE_Zeus::IZUnknown*&)variable

This macro is used to call askForInterface without writing casts directly in your code. askForInterface(INTERFACE_ISerializable, ICAST(pSerialObj)).

Parameters:
variable: Variable to cast
#define INLINE_INTERFACE_CAST_START
Value:
NAMESPACE_Zeus::Retval MQUALIFIER askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface)\
  {
#define INTERFACE_CAST (   interface_type,
  interface_id 
)    INTERFACE_CAST_VAR(interface_type, interface_id, this)

This macro is used to cast the object according the interface_id. The casting class must be specified and inherited.

Parameters:
interface_type: Class id of the interface
interface_id: Nummeric value representing an interface
#define INTERFACE_CAST_START (   classid )
Value:
NAMESPACE_Zeus::Retval MQUALIFIER classid::askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface)\
  {
#define INTERFACE_CAST_VAR (   interface_type,
  interface_id,
  variable_ 
)
Value:
typedef NAMESPACE_Zeus::TGUIDWrapper TempTGUIDWrapper;\
      if (TempTGUIDWrapper::isEqual(rInterfaceID, interface_id)) \
      {\
        rpIface = (interface_type*)variable_; \
        variable_->addRef(); \
        return RET_NOERROR; \
      }\

This macro is used to cast the object according the interface_id. The casting class must be specified and inherited.

Parameters:
interface_type: Class id of the interface
interface_id: Nummeric value representing an interface
variable_: variable to cast. normally its the this ptr
#define MEMORY_MANAGER_DECL
Value:
virtual NAMESPACE_Zeus::Retval MQUALIFIER askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface);\
    virtual void MQUALIFIER addRef() const;\
    virtual void MQUALIFIER release() const;

This macro defines the declaration part of the memory management.

#define MEMORY_MANAGER_IMPL (   classid )    MEMORY_MANAGER_IMPL_PARENT(classid, NAMESPACE_Zeus::TZObject)

This macro is similar to the MEMORY_MANAGER_IMPL_PARENT macro. It uses the TZObject as parent class.

Parameters:
classid: ID of the class
#define MEMORY_MANAGER_IMPL_END   MEMORY_MANAGER_IMPL_PARENT_END(NAMESPACE_Zeus::TZObject)
#define MEMORY_MANAGER_IMPL_LOCK (   classid,
  lock 
)

Implementation of memorymanagement using a lock object. It uses the TZObject as a parent class. if the lock object is NULL, it works like the macro MEMORY_MANAGER_IMPL

Parameters:
classid: ID of the class
lock: Lock object
#define MEMORY_MANAGER_IMPL_PARENT (   classid,
  parent 
)
Value:
typedef parent TempParent;\
  void MQUALIFIER classid::addRef() const\
  { \
    TempParent::addRef(); \
  } \
  void MQUALIFIER classid::release() const\
  { \
    TempParent::release(); \
  } \
  INTERFACE_CAST_START(classid)

Implementation of the memory management. This part of the memory management delegates it to a parent class.

Parameters:
classid: ID of the class
parent: ID of the parent class
#define MEMORY_MANAGER_IMPL_PARENT_END (   parent )
Value:
typedef parent TempParent;\
    return TempParent::askForInterface(rInterfaceID, rpIface); \
  }
#define MEMORY_MANAGER_INLINEIMPL (  )    MEMORY_MANAGER_INLINEIMPL_PARENT(NAMESPACE_Zeus::TZObject)
#define MEMORY_MANAGER_INLINEIMPL_PARENT (   parent )
Value:
typedef parent TempParent;\
  void MQUALIFIER addRef() const\
  { \
    TempParent::addRef(); \
  } \
  void MQUALIFIER release() const\
  { \
    TempParent::release(); \
  } \
  INLINE_INTERFACE_CAST_START

Inline implementation of the memory management. This part of the memory management delegates it to a parent class.

Parameters:
parent: ID of the parent class
#define MExportObjectFactory (   InterFace,
  ClassName 
)
Value:
MODULE_EXPORT_PRE NAMESPACE_Zeus::Retval MODULE_EXPORT MQUALIFIER create##InterFace(NAMESPACE_Zeus::IZUnknown*& rpIface)\
{\
  rpIface = (InterFace*)new ClassName();\
  return RET_NOERROR;\
}\

Defines a factory method which will be exported by the library and creates a new Object from ClassName

Parameters:
InterFace: interface type
ClassName: Name of the class
#define MExportSerializableObject (   InterFace,
  ClassName 
)
Value:
MExportObjectFactory(InterFace, ClassName)\
MODULE_EXPORT_PRE NAMESPACE_Zeus::Retval MODULE_EXPORT MQUALIFIER deserialize##ClassName(Uint uiObjectID, IInputStream* pStream, IZUnknown*& rpObj)\
{\
  return ClassName::createObject(uiObjectID, pStream, rpObj);\
}\

Defines two methods for serialisation handling. The first factory method will be used to create a serializable object. The second method is used for deserializing the object from a stream.

Parameters:
InterFace: interface type
ClassName: Name of the class
#define MExportSingletonObject (   InterFace,
  SingletonObj 
)
Value:
MODULE_EXPORT_PRE NAMESPACE_Zeus::Retval MODULE_EXPORT MQUALIFIER create##InterFace(NAMESPACE_Zeus::IZUnknown*& rpIface)\
{\
  rpIface = (InterFace*)&SingletonObj;\
  SingletonObj.addRef(); \
  return RET_NOERROR;\
}\

Defines a method which will be exported by the library to access singleton objects by other modules

Parameters:
InterFace: interface type
SingletonObj: single object type
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:20