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

#define INLINE_INTERFACE_CAST_START

Value:

NAMESPACE_Zeus::Retval MQUALIFIER askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface)\
  { \
    NAMESPACE_Zeus::Retval retVal; \
    switch(rInterfaceID) \
    {

#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
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 INTERFACE_CAST_START ( classid   ) 

Value:

NAMESPACE_Zeus::Retval MQUALIFIER classid::askForInterface(const NAMESPACE_Zeus::InterfaceID& rInterfaceID, NAMESPACE_Zeus::IZUnknown*& rpIface)\
  { \
    NAMESPACE_Zeus::Retval retVal; \
    switch(rInterfaceID) \
    {

#define INTERFACE_CAST_VAR ( interface_type,
interface_id,
variable_   ) 

Value:

case interface_id : \
        rpIface = (interface_type*)variable_; \
        variable_->addRef(); \
        retVal = RET_NOERROR; \
      break;\

#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:

default: \
        typedef parent TempParent;\
        retVal = TempParent::askForInterface(rInterfaceID, rpIface); \
      break; \
    } \
    return retVal; \
  }\

 
#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:
classid : ID of the class
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;\
}\

#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);\
}\

#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;\
}\



Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Wed Oct 28 21:42:32 2009