|
From: Frank V. C. <fr...@us...> - 2000-10-09 12:40:18
|
Update of /cvsroot/corelinux/clfw/clfw In directory slayer.i.sourceforge.net:/tmp/cvs-serv818 Modified Files: MetaType.hpp Log Message: 116226 Added Type declarations, definitions, and descriptors Index: MetaType.hpp =================================================================== RCS file: /cvsroot/corelinux/clfw/clfw/MetaType.hpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** MetaType.hpp 2000/10/04 05:20:26 1.10 --- MetaType.hpp 2000/10/09 12:40:11 1.11 *************** *** 30,35 **** namespace corelinux { DECLARE_CLASS( MetaType ); ! /*! \def DECLARE_METATYPEMEMBERS( className ) --- 30,36 ---- namespace corelinux { + DECLARE_CLASS( FrameworkEntity ); DECLARE_CLASS( MetaType ); ! /*! \def DECLARE_METATYPEMEMBERS( className ) *************** *** 67,70 **** --- 68,72 ---- */ \ static void destroy( className##Ptr aPointer ); \ + static className##Ptr castDown( FrameworkEntityPtr ); \ /** \ redefine the operator new[] \ *************** *** 105,113 **** } ! /*! \def _DEFINE_FACTORY( className ) \brief Define the factory allocator. \arg className: the class name to define the factory for ! */ #define _DEFINE_FACTORY( className ) \ CORELINUX_DEFAULT_ALLOCATOR( className##Allocator, className ) \ --- 107,246 ---- } ! ! ! typedef void * (*PfnGet)( FrameworkEntityPtr ); ! typedef void (*PfnSet)( FrameworkEntityPtr, VoidPtr ); ! ! struct _InstanceMemberDescriptor ! { ! char *theTypeName; ! char *theTypeVariableName; ! Dword theSizeInBytes; ! MetaTypeCptr theTypePointer; ! PfnGet theGetter; ! PfnSet theSetter; ! } ; ! ! DECLARE_TYPE(struct _InstanceMemberDescriptor, MemberDescriptor ); ! ! /*! def DECLARE_INSTANCEDATA( type, name ) ! \brief Declare data members that object instances expose by ! generating accessors and mutators ! \arg type : the member data type ! \arg type : the member instance variable name ! */ ! ! #define DECLARE_INSTANCEDATA( type, dataName ) \ ! public: \ ! static MemberDescriptor the##dataName##Descriptor; \ ! type get##dataName( void ) const \ ! { \ ! return the##dataName; \ ! } \ ! const type & get##dataName##AsReference( void ) const \ ! { \ ! return the##dataName; \ ! } \ ! const type * get##dataName##AsPointer( void ) const \ ! { \ ! return &the##dataName; \ ! } \ ! void * get##dataName##AsVoidPtr( void ) const \ ! { \ ! return (VoidPtr)get##dataName##AsPointer(); \ ! } \ ! static void *get##dataName##AsVPtr \ ! ( \ ! FrameworkEntityPtr \ ! ); \ ! /** \ ! Mutators \ ! */ \ ! void set##dataName( const type &aType ) \ ! { \ ! the##dataName = aType; \ ! } \ ! void set##dataName##FromPointer( type *aType ) \ ! { \ ! the##dataName = *aType; \ ! } \ ! void set##dataName##FromVPtr( void *aType ) \ ! { \ ! the##dataName = *((type *)aType); \ ! } \ ! static void set##dataName##AsVPtr \ ! ( \ ! FrameworkEntityPtr , \ ! VoidPtr \ ! ); \ ! private: \ ! type the##dataName ! ! /*! ! Structure for managing use defined data members ! */ ! ! ! #define _DEFINE_INSTANCE_STATICS( className, dataName ) \ ! void *className::get##dataName##AsVPtr \ ! ( \ ! FrameworkEntityPtr aSelf \ ! ) \ ! { \ ! return \ ! castDown(aSelf)->get##dataName##AsVoidPtr(); \ ! } \ ! void className::set##dataName##AsVPtr \ ! ( \ ! FrameworkEntityPtr aSelf, \ ! VoidPtr aType \ ! ) \ ! { \ ! castDown(aSelf)->set##dataName##FromVPtr(aType); \ ! } \ ! ! #define DEFINE_INSTANCEDATA_DESCRIPTOR( className, type, dataName ) \ ! _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_CLASSINSTANCE_DESCRIPTOR( className, type, typeClass, dataName ) \ ! _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 OPEN_INSTANCEDATA( className ) \ ! MemberDescriptor const *className##Type##Members[] = \ ! { \ ! ! #define DEFINE_INSTANCEDATA( className, dataName ) \ ! &className::the##dataName##Descriptor, \ ! ! #define CLOSE_INSTANCEDATA \ ! MemberDescriptorCptr( NULLPTR ) \ ! } ! ! ! /*! \def _DEFINE_FACTORY( className ) \brief Define the factory allocator. \arg className: the class name to define the factory for ! */ ! #define _DEFINE_FACTORY( className ) \ CORELINUX_DEFAULT_ALLOCATOR( className##Allocator, className ) \ *************** *** 117,121 **** static className##Allocator the##className##Allocator; ! /*! \def _DEFINE_ENTITY(className) \brief Defines the factory methods for the type. --- 250,254 ---- static className##Allocator the##className##Allocator; ! /*! \def _DEFINE_ENTITY(className) \brief Defines the factory methods for the type. *************** *** 124,128 **** and delete operators which call create and destroy() \arg className: the class name ! */ #define _DEFINE_ENTITY(className) \ /** \ --- 257,262 ---- and delete operators which call create and destroy() \arg className: the class name ! */ ! #define _DEFINE_ENTITY(className) \ /** \ *************** *** 154,157 **** --- 288,295 ---- aAlPtr->destroyType(aPtr); \ } \ + className##Ptr className::castDown( FrameworkEntityPtr aP ) \ + { \ + return dynamic_cast<className##Ptr>(aP); \ + } \ /** \ redefine the operator new for className \ *************** *** 189,193 **** ,version \ ,className##Size \ ! ,className##MetaType##Parents --- 327,332 ---- ,version \ ,className##Size \ ! ,className##MetaType##Parents \ ! ,className##Type##Members *************** *** 287,294 **** @param UniversalIdentifier a Unique ID @param Dword MetaType version number - @param Char pointer to type instance (class) name - @param Char pointer to MetaType name @param Dword size of class @param MetaType pointer to array of parents */ --- 426,434 ---- @param UniversalIdentifier a Unique ID @param Dword MetaType version number @param Dword size of class @param MetaType pointer to array of parents + @param MemberDescriptor pointer to array of members, + @param Char pointer to type instance (class) name + @param Char pointer to MetaType name */ *************** *** 296,303 **** ( UniversalIdentifierCref , ! DwordCref , ! DwordCref , ! MetaTypeCptr *, ! CharCptr , CharCptr ) throw ( Assertion ); --- 436,444 ---- ( UniversalIdentifierCref , ! DwordCref , ! DwordCref , ! MetaTypeCptr *, ! MemberDescriptorCptr *, ! CharCptr , CharCptr ) throw ( Assertion ); *************** *** 308,315 **** @param UniversalIdentifier a Unique ID @param Dword MetaType version number - @param Char pointer to type instance (class) name - @param Char pointer to MetaType name @param Dword size of class @param MetaType pointer to array of parents @param Allocator pointer to instance allocator */ --- 449,457 ---- @param UniversalIdentifier a Unique ID @param Dword MetaType version number @param Dword size of class @param MetaType pointer to array of parents + @param MemberDescriptor pointer to array of members, + @param Char pointer to type instance (class) name + @param Char pointer to MetaType name @param Allocator pointer to instance allocator */ *************** *** 318,326 **** ( UniversalIdentifierCref , ! DwordCref , ! DwordCref , ! MetaTypeCptr *, ! CharCptr , ! CharCptr , AllocatorPtr ) throw ( Assertion ); --- 460,469 ---- ( UniversalIdentifierCref , ! DwordCref , ! DwordCref , ! MetaTypeCptr *, ! MemberDescriptorCptr *, ! CharCptr , ! CharCptr , AllocatorPtr ) throw ( Assertion ); *************** *** 365,368 **** --- 508,518 ---- /** + get the instance member descriptors + @return an array of MemberDescriptors + */ + + MemberDescriptorCptr * const getInstanceMembers( void ) const; + + /** get the name of the instance of this MetaType. @return the name of the instance of this MetaType *************** *** 430,440 **** private: ! DwordCref theVersion; ! DwordCref theInstanceSize; ! UniversalIdentifierCref theTypeId; ! MetaTypeCptr *const theBaseClasses; ! CharCptr theInstanceTypeName; ! CharCptr theMetaTypeName; ! AllocatorPtr theFactoryAllocator; }; --- 580,591 ---- private: ! DwordCref theVersion; ! DwordCref theInstanceSize; ! UniversalIdentifierCref theTypeId; ! MetaTypeCptr *const theBaseClasses; ! MemberDescriptorCptr *const theInstanceMembers; ! CharCptr theInstanceTypeName; ! CharCptr theMetaTypeName; ! AllocatorPtr theFactoryAllocator; }; |