|
From: Frank V. C. <fr...@us...> - 2000-10-22 16:36:04
|
Update of /cvsroot/corelinux/clfw/clfw In directory slayer.i.sourceforge.net:/tmp/cvs-serv7484/clfw Modified Files: MetaType.hpp Added Files: AbstractEntityException.hpp Log Message: 117408 Abstract type support ***** Error reading new file: (2, 'No such file or directory') Index: MetaType.hpp =================================================================== RCS file: /cvsroot/corelinux/clfw/clfw/MetaType.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** MetaType.hpp 2000/10/21 16:10:17 1.14 --- MetaType.hpp 2000/10/22 14:49:16 1.15 *************** *** 26,29 **** --- 26,33 ---- #endif + #if !defined(__ABSTRACTENTITYEXCEPTION_HPP) + #include <AbstractEntityException.hpp> + #endif + #include <cstdio> *************** *** 34,37 **** --- 38,42 ---- DECLARE_CLASS( DescriptorNotFound ); DECLARE_CLASS( AccessorNotFound ); + /*! *************** *** 390,393 **** --- 395,475 ---- className::destroy(aPtr); \ } \ + + /*! + \def _DEFINE_ABSTRACT_ENTITY(className) + \brief Defines the methods for the abstract type. + Define the create(), destroy() functions to throw + a abstract class exception + \arg className: the class name + */ + + #define _DEFINE_ABSTRACT_ENTITY(className) \ + /** \ + the size of the class object \ + */ \ + const DwordCref className##Size(sizeof(className)); \ + const CharPtr className##Name = #className; \ + const CharPtr MetaType##className##Name = "MetaType"#className; \ + const CharPtr className##AllocExc = "Can't allocate abstract type "#className; \ + const CharPtr className##DeAllocExc = "Can't deallocate abstract type "#className; \ + /** \ + create a new pointer to className \ + \return the allocated pointer \ + */ \ + className##Ptr className::create( void ) \ + { \ + throw AbstractEntityException \ + ( \ + className##AllocExc, \ + LOCATION \ + ); \ + return (className##Ptr)NULLPTR; \ + } \ + /** \ + destroy a pointer to className \ + \arg the pointer aPtr \ + */ \ + void className::destroy( className##Ptr ) \ + { \ + throw AbstractEntityException \ + ( \ + className##DeAllocExc, \ + LOCATION \ + ); \ + } \ + className##Ptr className::castDown( FrameworkEntityPtr aP ) \ + { \ + return dynamic_cast<className##Ptr>(aP); \ + } \ + /** \ + redefine the operator new for className \ + this operator use the className::create() \ + function \ + \return a VoidPtr \ + */ \ + VoidPtr className::operator new( size_t ) \ + { \ + throw AbstractEntityException \ + ( \ + className##AllocExc, \ + LOCATION \ + ); \ + return (className##Ptr)NULLPTR; \ + } \ + /** \ + redefine the operator delete for className \ + this operator use the className::destroy() \ + function \ + \arg the pointer aVoidPtr \ + */ \ + void className::operator delete( VoidPtr ) \ + { \ + throw AbstractEntityException \ + ( \ + className##DeAllocExc, \ + LOCATION \ + ); \ + } \ + /*! \def _DEFINE_ENTITY_ALWAYS_PARMS(className,identification,version) *************** *** 445,453 **** */ #define DEFINE_ABSTRACT_METATYPE( className, identifier, version ) \ ! _DEFINE_ENTITY( className ) \ _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version) \ _DEFINE_SINGLE_STRINGID(className) \ _DEFINE_ENTITY_ALWAYS(className) /*! \def DEFINE_METATYPE( className, identifier, version ) --- 527,548 ---- */ #define DEFINE_ABSTRACT_METATYPE( className, identifier, version ) \ ! _DEFINE_ABSTRACT_ENTITY( className ) \ _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version) \ _DEFINE_SINGLE_STRINGID(className) \ _DEFINE_ENTITY_ALWAYS(className) + /*! + \def DEFINE_ABSTRACT_METATYPE( className, metaName, identifier, version ) + define a new abstract MetaType but gives a metatype name + \arg className: the class name + \arg metaName: the meta class name + \arg identifier: the identifier, typically a UniversalIdentifier + \arg version: the version number of the MetaType + */ + #define DEFINE_ABSTRACT_METATYPE1( className, metaName, identifier, version ) \ + _DEFINE_ABSTRACT_ENTITY( className ) \ + _DEFINE_ENTITY_ALWAYS_PARMS(className,identifier,version) \ + _DEFINE_DUAL_STRINGID(className,metaName) \ + _DEFINE_ENTITY_ALWAYS(className) /*! \def DEFINE_METATYPE( className, identifier, version ) *************** *** 466,470 **** /*! ! \def DEFINE_METATYPE( className, metaName, identifier, version ) define a new MetaType but gives a name to the metatype. For example, the FrameworkEntity passes MetaTypeRoot which is destined to be the --- 561,565 ---- /*! ! \def DEFINE_METATYPE1( className, metaName, identifier, version ) define a new MetaType but gives a name to the metatype. For example, the FrameworkEntity passes MetaTypeRoot which is destined to be the *************** *** 475,479 **** \arg version: the version number of the MetaType */ ! #define DEFINE_METATYPE1( className, metaName,identifier, version ) \ _DEFINE_FACTORY( className ) \ _DEFINE_ENTITY( className ) \ --- 570,574 ---- \arg version: the version number of the MetaType */ ! #define DEFINE_METATYPE1( className, metaName, identifier, version ) \ _DEFINE_FACTORY( className ) \ _DEFINE_ENTITY( className ) \ |