Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

MetaType.hpp File Reference

#include <corelinux/AbstractAllocator.hpp>
#include <AbstractEntityException.hpp>
#include <corelinux/Iterator.hpp>
#include <cstdio>

Namespaces

namespace  corelinux

Compounds

struct  __DispatchDescriptor
struct  _InstanceMemberDescriptor
class  corelinux::MetaType

Defines

#define __METATYPE_HPP
#define DECLARE_METATYPEMEMBERS( className )
 define the metaType member for className. More...

#define OPEN_METATYPE_PARENTS( className )
 \ the MetaType descriptor \. More...

#define DEFINE_METATYPE_PARENT( parentName )
 \ array storing the parents descriptors \. More...

#define CLOSE_METATYPE_PARENT
 \ parentName type descriptor \. More...

#define _DECLARE_INSTANCEDATA_STATICS(dataName)
 Declare static members and methods for supporting type instance access by MetaType instance
  • dataName : the member instance variable name.
More...


#define DECLARE_INSTANCEDATA( type, dataName )
 Declare data members that object instances expose by generating accessors and mutators
  • type : the member data type
  • dataName : the member instance variable name.
More...


#define DECLARE_INSTANCEDATA_FROMBASE( type, dataName, baseType, baseClass )
 \ Mutators \ Declare data members that object instances expose by generating accessors and mutators
  • type : the member data type
  • dataName : the member instance variable name
  • baseType : the base member variable type for coercion
  • baseClass : the base class.
More...


#define _DEFINE_INSTANCE_STATICS( className, dataName )
 \ Mutators \. More...

#define DEFINE_INSTANCEDATA_DESCRIPTOR( className, type, dataName )
#define DEFINE_CLASSINSTANCE_DESCRIPTOR( className, type, typeClass, dataName )
#define OPEN_INSTANCEDATA( className )
 Each attribute in a type can be exposed to it's MetaType for reasoning and access in the user space
  • className: the class used as part of the unique array name.
More...


#define DEFINE_INSTANCEDATA( className, dataName )
 \ Array storing the attribute descriptors \ Creates the MemberDescriptor entry in the array
  • className: used to reference the static descriptor
  • dataName : the instance data member variable name.
More...


#define CLOSE_INSTANCEDATA
 \ Attribute descriptor \. More...

#define DISPATCH_FUNCTION( className, methName )
 Opens the standard header, body required to do something
  • className : base name for method
  • methName : unique name identifier.
More...


#define DISPATCH_FUNCTION_NORETURN( className, methName )
 Opens the standard header, body required to do something but ignores return value
  • className : base name for method
  • methName : unique name identifier.
More...


#define DISPATCH_STATIC_FUNCTION( className, methName )
#define CLOSE_DISPATCH_FUNCTION
#define DEFINE_DISPATCH_DESCRIPTOR( className, classMethName, methName )
 Defines a dispatch descriptor for a specific call
  • className : identifies the class
  • classMethName : identifies the class method that is called
  • methName : identifies the dispatch function.
More...


#define DEFINE_DISPATCH_ENTRY( className, methName )
#define OPEN_DISPATCH_TABLE( className )
#define CLOSE_DISPATCH_TABLE
#define DEFINE_DUMMY_DISPATCHTABLE( className )
#define _DEFINE_FACTORY( className )
 Define the factory allocator.
  • className: the class name to define the factory for.
More...


#define _DEFINE_ENTITY(className)
 \ the className Allocator \ Defines the factory methods for the type. Define the create(), destroy() functions to create and destroy entities and also overload the new and delete operators which call create and destroy()
  • className: the class name.


#define _DEFINE_ENTITY_WITH_FACTORY(className)
#define _DEFINE_ABSTRACT_ENTITY(className)
 \ redefine the operator delete for className\this operator use the className::destroy() \ function \
  • the pointer aVoidPtr \ Defines the methods for the abstract type. Define the create(), destroy() functions to throw a abstract class exception
  • className: the class name.


#define _DEFINE_ENTITY_ALWAYS_PARMS(className,identification,version,domain, description )
 \ redefine the operator delete for className\this operator use the className::destroy() \ function \
  • the pointer aVoidPtr \.
More...


#define _DEFINE_SINGLE_STRINGID( className )
 \ construct the theTypeDesc \. More...

#define _DEFINE_DUAL_STRINGID( className, metaName )
#define _DEFINE_ENTITY_ALWAYS(className)
#define DEFINE_ABSTRACT_METATYPE( className, identifier, version, domain, description )
 \ implements the equals upcalls \. More...

#define DEFINE_ABSTRACT_METATYPE1( className, metaName, identifier, version, domain, description )
#define DEFINE_METATYPE( className, identifier, version, domain, description )
#define DEFINE_METATYPE_WITH_FACTORY( className, identifier, version, domain, description )
#define DEFINE_METATYPE1( className, metaName, identifier, version, domain, description )
#define DEFINE_METATYPE1_WITH_FACTORY( className, metaName, identifier, version, domain, description )

Typedefs

typedef void* (* PfnGet )( corelinux::FrameworkEntityPtr )
 \ The parent type descriptor array must be termined by the NULLPTR \.

typedef void (* PfnSet )( corelinux::FrameworkEntityPtr, corelinux::VoidPtr )
typedef struct _InstanceMemberDescriptor MemberDescriptor
typedef struct _InstanceMemberDescriptorMemberDescriptorPtr
typedef const MemberDescriptorMemberDescriptorCptr
typedef MemberDescriptorMemberDescriptorRef
typedef const MemberDescriptorMemberDescriptorCref
typedef void (* DispatchFunction )( corelinux::FrameworkEntityPtr, void **, void * )
 \ Close the attribute descriptor array \.

typedef struct __DispatchDescriptor DispatchDescriptor
typedef struct __DispatchDescriptorDispatchDescriptorPtr
typedef const DispatchDescriptorDispatchDescriptorCptr
typedef DispatchDescriptorDispatchDescriptorRef
typedef const DispatchDescriptorDispatchDescriptorCref

Define Documentation

CLOSE_DISPATCH_FUNCTION
 

Initializer:

\
      }

#define CLOSE_DISPATCH_TABLE
 

Initializer:

\
           0 }

#define CLOSE_INSTANCEDATA
 

Initializer:

\
                                                              \
      MemberDescriptorCptr( NULLPTR )                          \
      }
\ Attribute descriptor \.

#define CLOSE_METATYPE_PARENT
 

Initializer:

\
                                                        \
      corelinux::MetaTypePtr(NULLPTR)                   \
      }
\ parentName type descriptor \.

#define DECLARE_INSTANCEDATA( type, dataName )
 

Declare data members that object instances expose by generating accessors and mutators

  • type : the member data type
  • dataName : the member instance variable name.

def DECLARE_INSTANCEDATA( type, dataName )

#define DECLARE_INSTANCEDATA_FROMBASE( type, dataName, baseType, baseClass )
 

\ Mutators \ Declare data members that object instances expose by generating accessors and mutators

  • type : the member data type
  • dataName : the member instance variable name
  • baseType : the base member variable type for coercion
  • baseClass : the base class.

def DECLARE_INSTANCEDATA_FROMBASE( type, dataName, baseType, baseClass )

#define DECLARE_METATYPEMEMBERS( className )
 

Initializer:

\
   public:                                               \
                                                        \
      static corelinux::MetaTypePtr getTypeDescriptor( void );     \
                                                        \
      virtual corelinux::MetaTypePtr getType( void ) const;        \
                                                        \
      virtual bool  equals( corelinux::FrameworkEntityCptr ) const; \
                                                        \
      static className##Ptr create( void  );             \
                                                        \
      static className##Ptr create( corelinux::UniversalIdentifierCref );    \
                                                        \
      static void destroy( className##Ptr aPointer );    \
      static className##Cptr  castDown( corelinux::FrameworkEntityCptr ) ; \
      static className##Ptr   castDown( corelinux::FrameworkEntityPtr ); \
      static className##Ref   castDown( corelinux::FrameworkEntityRef ); \
      static className##Cref  castDown( corelinux::FrameworkEntityCref ); \
                                                        \
      void * operator new(size_t aSize);                 \
                                                        \
      void operator delete(void * aVoidPtr);             \
   protected:                                            \
   private:                                              \
                                                       \
      static corelinux::MetaType   theTypeDesc;
define the metaType member for className.

This must be located within the class interface.

Attention:
this macro defines public, protected and private members therefore if you do not call this macro at the end of the class interface you may have some surprises about the visiblity of your own class members.

  • className the class name

#define DEFINE_ABSTRACT_METATYPE( className, identifier, version, domain, description )
 

Initializer:

\
       _DEFINE_ABSTRACT_ENTITY( className )                             \
       _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )        \
       _DEFINE_SINGLE_STRINGID(className)                               \
       _DEFINE_ENTITY_ALWAYS(className)
\ implements the equals upcalls \.

define a new abstract MetaType

  • className: the class name
  • identifier: the identifier, typically a UniversalIdentifier
  • version: the version number of the MetaType

#define DEFINE_ABSTRACT_METATYPE1( className, metaName, identifier, version, domain, description )
 

Initializer:

\
       _DEFINE_ABSTRACT_ENTITY( className )                             \
       _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )        \
       _DEFINE_DUAL_STRINGID(className,metaName)                        \
       _DEFINE_ENTITY_ALWAYS(className)

#define DEFINE_CLASSINSTANCE_DESCRIPTOR( className, type, typeClass, dataName )
 

Initializer:

\
      _DEFINE_INSTANCE_STATICS(className,dataName)             \
      MemberDescriptor  className::the##dataName##Descriptor = \
         {                                                     \
            #type,                                             \
            #dataName,                                         \
            sizeof(type),                                      \
            typeClass::getTypeDescriptor(),                    \
            &className::get##dataName##AsVPtr,                 \
            &className::set##dataName##AsVPtr                  \
         }

#define DEFINE_DISPATCH_DESCRIPTOR( className, classMethName, methName )
 

Initializer:

\
      static DispatchDescriptor className##Dispatch##methName = \
      { #classMethName, className##methName }
Defines a dispatch descriptor for a specific call
  • className : identifies the class
  • classMethName : identifies the class method that is called
  • methName : identifies the dispatch function.

#define DEFINE_DISPATCH_ENTRY( className, methName )
 

Initializer:

\
           &className##Dispatch##methName,

#define DEFINE_DUMMY_DISPATCHTABLE( className )
 

Initializer:

\
   static void className##ConstructImplicit        \
      (                                            \
         corelinux::FrameworkEntityPtr,            \
         void  **,                                 \
         void  *ret                                \
      )                                            \
   {                                               \
      *((FrameworkEntityPtr *)ret) = className::create();        \
   }                                               \
   static void className##DestructImplicit         \
      (                                            \
         corelinux::FrameworkEntityPtr aClass,     \
         void  **,                                 \
         void  *                                   \
      )                                            \
   {                                               \
      className##Ptr myPointer = className::castDown( aClass );   \
      className::destroy( myPointer );             \
   }                                               \
   static DispatchDescriptor className##Dispatch##ConstructImplicit =  \
      {"Construct",className##ConstructImplicit};                 \
   static DispatchDescriptor className##Dispatch##DestructImplicit =    \
      {"Destruct",className##DestructImplicit};                   \
    static DispatchDescriptor const *className##DispatchTable[] = \
    {                                                             \
      DEFINE_DISPATCH_ENTRY( className,ConstructImplicit )  \
      DEFINE_DISPATCH_ENTRY( className,DestructImplicit )   \
      0                                                     \
    }

#define DEFINE_INSTANCEDATA( className, dataName )
 

Initializer:

\
                                                              \
      &className::the##dataName##Descriptor,                   \
\ Array storing the attribute descriptors \ Creates the MemberDescriptor entry in the array
  • className: used to reference the static descriptor
  • dataName : the instance data member variable name.

#define DEFINE_INSTANCEDATA_DESCRIPTOR( className, type, dataName )
 

Initializer:

\
      _DEFINE_INSTANCE_STATICS(className,dataName)             \
      MemberDescriptor  className::the##dataName##Descriptor = \
         {                                                     \
            #type,                                             \
            #dataName,                                         \
            sizeof(type),                                      \
            NULLPTR,                                           \
            &className::get##dataName##AsVPtr,                 \
            &className::set##dataName##AsVPtr                  \
         }

#define DEFINE_METATYPE( className, identifier, version, domain, description )
 

Initializer:

\
      _DEFINE_FACTORY( className )                                      \
      _DEFINE_ENTITY( className )                                       \
      _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )         \
      _DEFINE_SINGLE_STRINGID(className)                                \
      ,&the##className##Allocator                                       \
      _DEFINE_ENTITY_ALWAYS(className)
define a new MetaType
  • className: the class name
  • identifier: the identifier, typically a UniversalIdentifier
  • version: the version number of the MetaType

#define DEFINE_METATYPE1( className, metaName, identifier, version, domain, description )
 

Initializer:

\
      _DEFINE_FACTORY( className )                                      \
      _DEFINE_ENTITY( className )                                       \
      _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )         \
      _DEFINE_DUAL_STRINGID(className,metaName)                         \
      ,&the##className##Allocator                                       \
      _DEFINE_ENTITY_ALWAYS(className)
define a new MetaType but gives a name to the metatype. For example, the FrameworkEntity passes MetaTypeRoot which is destined to be the root of all MetaTypes
  • className: the class name
  • metaName: the meta class name
  • identifier: the identifier, typically a UniversalIdentifier
  • version: the version number of the MetaType

#define DEFINE_METATYPE1_WITH_FACTORY( className, metaName, identifier, version, domain, description )
 

Initializer:

\
      _DEFINE_ENTITY_WITH_FACTORY( className )                          \
      _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )         \
      _DEFINE_DUAL_STRINGID(className,metaName)                         \
      ,&the##className##Allocator                                       \
      _DEFINE_ENTITY_ALWAYS(className)
define a new MetaType but gives a name to the metatype. For example, the FrameworkEntity passes MetaTypeRoot which is destined to be the root of all MetaTypes, and assume the user has defined the factory
  • className: the class name
  • metaName: the meta class name
  • identifier: the identifier, typically a UniversalIdentifier
  • version: the version number of the MetaType

#define DEFINE_METATYPE_PARENT( parentName )
 

Initializer:

\
                                                        \
      parentName::getTypeDescriptor(),                   \
\ array storing the parents descriptors \.

#define DEFINE_METATYPE_WITH_FACTORY( className, identifier, version, domain, description )
 

Initializer:

\
      _DEFINE_ENTITY_WITH_FACTORY( className )                             \
      _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version,domain, description )         \
      _DEFINE_SINGLE_STRINGID(className)                                \
      ,&the##className##Allocator                                       \
      _DEFINE_ENTITY_ALWAYS(className)
define a new MetaType and assume the user has defined the factory
  • className: the class name
  • identifier: the identifier, typically a UniversalIdentifier
  • version: the version number of the MetaType

#define DISPATCH_FUNCTION( className, methName )
 

Initializer:

\
      static void className##methName              \
         (                                         \
            corelinux::FrameworkEntityPtr aClass,  \
            void **args,                           \
            void *ret                              \
         )                                         \
      {                                            \
         className##Ptr myPointer = className::castDown( aClass );
Opens the standard header, body required to do something
  • className : base name for method
  • methName : unique name identifier.

#define DISPATCH_FUNCTION_NORETURN( className, methName )
 

Initializer:

\
      static void className##methName              \
         (                                         \
            corelinux::FrameworkEntityPtr aClass,  \
            void **args,                           \
            void *                                 \
         )                                         \
      {                                            \
         className##Ptr myPointer = className::castDown( aClass );
Opens the standard header, body required to do something but ignores return value
  • className : base name for method
  • methName : unique name identifier.

#define DISPATCH_STATIC_FUNCTION( className, methName )
 

Initializer:

\
      static void className##methName              \
         (                                         \
            corelinux::FrameworkEntityPtr ,        \
            void **args,                           \
            void *ret                              \
         )                                         \
      {

#define OPEN_DISPATCH_TABLE( className )
 

Initializer:

\
      static void className##ConstructImplicit        \
         (                                            \
            corelinux::FrameworkEntityPtr,            \
            void  **,                                 \
            void  *ret                                \
         )                                            \
      {                                               \
         *((FrameworkEntityPtr *)ret) = className::create();        \
      }                                               \
      static void className##DestructImplicit         \
         (                                            \
            corelinux::FrameworkEntityPtr aClass,     \
            void  **,                                 \
            void  *                                   \
         )                                            \
      {                                               \
         className##Ptr myPointer = className::castDown( aClass );   \
         className::destroy( myPointer );             \
      }                                               \
      static DispatchDescriptor className##Dispatch##ConstructImplicit =  \
         {"Construct",className##ConstructImplicit};                \
      static DispatchDescriptor className##Dispatch##DestructImplicit =    \
         {"Destruct",className##DestructImplicit};                \
       static DispatchDescriptor const *className##DispatchTable[] = \
       { \
         DEFINE_DISPATCH_ENTRY( className,ConstructImplicit ) \
         DEFINE_DISPATCH_ENTRY( className,DestructImplicit )

#define OPEN_INSTANCEDATA( className )
 

Initializer:

\
                                                              \
      static MemberDescriptor  const *className##Type##Members[] =    \
      {                                                        \
Each attribute in a type can be exposed to it's MetaType for reasoning and access in the user space
  • className: the class used as part of the unique array name.

#define OPEN_METATYPE_PARENTS( className )
 

Initializer:

\
                                                       \
      corelinux::MetaType const * className##MetaType##Parents[] =  \
      {                                                  \
\ the MetaType descriptor \.

#define _DECLARE_INSTANCEDATA_STATICS( dataName )
 

Initializer:

\
         static   MemberDescriptor  the##dataName##Descriptor;       \
         static   void *get##dataName##AsVPtr( corelinux::FrameworkEntityPtr );  \
         static   void set##dataName##AsVPtr                         \
            (                                                        \
               corelinux::FrameworkEntityPtr ,                       \
               corelinux::VoidPtr                                    \
            );                                                       \
Declare static members and methods for supporting type instance access by MetaType instance
  • dataName : the member instance variable name.

def _DECLARE_INSTANCEDATA_STATICS( dataName )

#define _DEFINE_ABSTRACT_ENTITY( className )
 

\ redefine the operator delete for className\this operator use the className::destroy() \ function \

  • the pointer aVoidPtr \ Defines the methods for the abstract type. Define the create(), destroy() functions to throw a abstract class exception
  • className: the class name.

#define _DEFINE_DUAL_STRINGID( className, metaName )
 

Initializer:

\
            className##Name                             \
            ,#metaName

#define _DEFINE_ENTITY( className )
 

\ the className Allocator \ Defines the factory methods for the type. Define the create(), destroy() functions to create and destroy entities and also overload the new and delete operators which call create and destroy()

  • className: the class name.

#define _DEFINE_ENTITY_ALWAYS( className )
 

#define _DEFINE_ENTITY_ALWAYS_PARMS( className, identification, version, domain, description )
 

Initializer:

\
                                                                         \
      MetaType className::theTypeDesc                                      \
         (                                                                 \
            identification,                                                \
            version,                                                       \
            className##Size,                                               \
            className##MetaType##Parents,                                  \
            className##Type##Members,                                      \
            className##DispatchTable,                                      \
            domain,                                                        \
            description,                                                   \
\ redefine the operator delete for className\this operator use the className::destroy() \ function \
  • the pointer aVoidPtr \.

calls the constructor of theTypeDesc and implements the getTypeDescriptor() and getType() functions

#define _DEFINE_ENTITY_WITH_FACTORY( className )
 

#define _DEFINE_FACTORY( className )
 

Initializer:

\
      CORELINUX_DEFAULT_ALLOCATOR( className##Allocator, className ) \
                                                                   \
      static   className##Allocator    the##className##Allocator;
Define the factory allocator.
  • className: the class name to define the factory for.

#define _DEFINE_INSTANCE_STATICS( className, dataName )
 

Initializer:

\
       void *className::get##dataName##AsVPtr                  \
          (                                                    \
             corelinux::FrameworkEntityPtr aSelf               \
          )                                                    \
       {                                                       \
          return                                               \
             castDown(aSelf)->get##dataName##AsVoidPtr();      \
       }                                                       \
       void className::set##dataName##AsVPtr                   \
          (                                                    \
             corelinux::FrameworkEntityPtr aSelf,              \
             corelinux::VoidPtr aType                          \
          )                                                    \
       {                                                       \
          castDown(aSelf)->set##dataName##FromVPtr(aType);     \
       }                                                       \
\ Mutators \.

Structure for managing use defined data members

#define _DEFINE_SINGLE_STRINGID( className )
 

Initializer:

\
            className##Name                             \
            ,MetaType##className##Name
\ construct the theTypeDesc \.

#define __METATYPE_HPP
 


Typedef Documentation

typedef struct __DispatchDescriptor DispatchDescriptor
 

typedef const DispatchDescriptor* DispatchDescriptorCptr
 

typedef const DispatchDescriptor& DispatchDescriptorCref
 

typedef struct __DispatchDescriptor* DispatchDescriptorPtr
 

typedef DispatchDescriptor& DispatchDescriptorRef
 

typedef void (* DispatchFunction)( corelinux::FrameworkEntityPtr, void **, void * )
 

\ Close the attribute descriptor array \.

typedef struct _InstanceMemberDescriptor MemberDescriptor
 

typedef const MemberDescriptor* MemberDescriptorCptr
 

typedef const MemberDescriptor& MemberDescriptorCref
 

typedef struct _InstanceMemberDescriptor* MemberDescriptorPtr
 

typedef MemberDescriptor& MemberDescriptorRef
 

typedef void* (* PfnGet)( corelinux::FrameworkEntityPtr )
 

\ The parent type descriptor array must be termined by the NULLPTR \.

typedef void (* PfnSet)( corelinux::FrameworkEntityPtr, corelinux::VoidPtr )
 


This is the CoreLinux++ Framework reference manual
Provided by The CoreLinux Consortium