|
From: Frank V. C. <fr...@us...> - 2000-11-15 12:29:34
|
Update of /cvsroot/corelinux/clfw/src/testdrivers/exf1 In directory slayer.i.sourceforge.net:/tmp/cvs-serv6176/src/testdrivers/exf1 Modified Files: examp1.cpp Log Message: 116737 Ontology Support - Added Iterators to MetaType Index: examp1.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/testdrivers/exf1/examp1.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** examp1.cpp 2000/11/15 04:33:02 1.21 --- examp1.cpp 2000/11/15 12:29:31 1.22 *************** *** 106,118 **** void dumpTypeInformation( FrameworkEntityPtr ); - void dumpInstanceMembers( MetaTypeCptr ); - void dumpInstanceMembers( MetaClassPtr ); - - void dumpInstanceFunctions( MetaTypeCptr ); - void dumpInstanceFunctions( MetaClassPtr ); - - void dumpParents( MetaTypeCptr ); - void dumpParents( MetaClassPtr ); - void testDispatch( void ); void walkOntology( MetaClassPtr , int ); --- 106,109 ---- *************** *** 126,130 **** // ! // Template function // --- 117,121 ---- // ! // Templated function // *************** *** 152,155 **** --- 143,239 ---- } + // MetaType or MetaClass parents + + template < class T > void dumpParents( T *aMPtr ) + { + Iterator<T const *> *aIterator(aMPtr->createParentIterator()); + + cout << endl << "Meta Parent List : " << endl; + + while( aIterator->isValid() ) + { + cout + << "\tClass = " << aIterator->getElement()->getInstanceTypeName() + << endl + << "\tMetaType = " << aIterator->getElement()->getMetaTypeName() + << endl; + aIterator->setNext(); + } + + aMPtr->destroyIterator( aIterator ); + + } + + // MetaType or MetaClass Members + + template < class T > void dumpInstanceMembers( T *aMPtr ) + { + Iterator<MemberDescriptorCptr> *aIterator + ( + aMPtr->createMemberIterator() + ); + + while( aIterator->isValid() ) + { + MemberDescriptorCptr anElement( aIterator->getElement() ); + + cout << "\tVar name = " << anElement->theTypeVariableName + << endl; + cout << "\tVar type = " << anElement->theTypeName + << endl; + cout << "\tVar size = " << anElement->theSizeInBytes + << endl; + + if( anElement->theTypePointer != NULLPTR ) + { + cout << "\tClass type = " + << anElement->theTypePointer->getInstanceTypeName() + << endl; + } + else + { + cout << "\tNot a FrameworkEntity" << endl; + } + + if( anElement->theGetter != NULLPTR ) + { + cout << "\tHas getter " << endl; + } + else + { + ; // do nothing + } + if( anElement->theSetter != NULLPTR ) + { + cout << "\tHas setter " << endl; + } + else + { + ; // do nothing + } + aIterator->setNext(); + } + + aMPtr->destroyIterator( aIterator ); + } + + template < class T > void dumpInstanceFunctions( T *aMPtr ) + { + Iterator<DispatchDescriptorCptr> *aIterator + ( + aMPtr->createMethodIterator() + ); + + while( aIterator->isValid() ) + { + cout << "\tFunction name = " << + aIterator->getElement()->theClassMethodName << endl; + aIterator->setNext(); + } + + aMPtr->destroyIterator( aIterator ); + } + + // // Main entry point *************** *** 420,424 **** // ! dumpParents( aMTPtr ); // --- 504,508 ---- // ! dumpParents<MetaType>( MetaTypePtr(aMTPtr) ); // *************** *** 426,430 **** // ! dumpInstanceMembers( aMTPtr ); // --- 510,514 ---- // ! dumpInstanceMembers<MetaType>( MetaTypePtr(aMTPtr) ); // *************** *** 432,436 **** // ! dumpInstanceFunctions( aMTPtr ); } --- 516,520 ---- // ! dumpInstanceFunctions<MetaType>( MetaTypePtr(aMTPtr) ); } *************** *** 442,662 **** { dumpMetaTypeInformation( anFEPtr->getType() ); - } - - // - // Parent information - // - - void dumpParents( MetaTypeCptr aMTPtr ) - { - MetaTypeCptr * const parents = aMTPtr->getParentTypes(); - - cout << endl << "MetaType Parent List : " << endl; - if( parents == NULLPTR ) - { - cout << "Internal class error for parents : " << - aMTPtr->getInstanceTypeName() << endl; - } - else - { - if( parents[0] != NULLPTR ) - { - for( int x = 0; parents[x] != NULLPTR; ++x ) - { - cout - << "\tClass = " << parents[x]->getInstanceTypeName() - << endl - << "\tMetaType = " << parents[x]->getMetaTypeName() - << endl; - } - } - else - { - cout << "\tType is root" << endl; - } - } - - } - - void dumpParents( MetaClassPtr aMCPtr ) - { - Iterator<MetaClassCptr> *aIterator - ( - aMCPtr->createParentIterator() - ); - - while( aIterator->isValid() ) - { - cout - << "\tClass = " << aIterator->getElement()->getTypeName() - << endl - << "\tMetaType = " << aIterator->getElement()->getMetaName() - << endl; - aIterator->setNext(); - } - - aMCPtr->destroyIterator( aIterator ); - - } - - - // - // Data member information - // - - void dumpInstanceMembers( MetaTypeCptr aMTPtr ) - { - MemberDescriptorCptr * const aMDescs = aMTPtr->getInstanceMembers(); - - cout << endl << "Instance Data Member List : " << endl; - if( aMDescs == NULLPTR ) - { - cout << "Internal class error for members : " << - aMTPtr->getInstanceTypeName() << endl; - } - else - { - if( aMDescs[0] != NULLPTR ) - { - for( int x = 0; aMDescs[x] != NULLPTR; ++x ) - { - cout << "\tVar name = " << aMDescs[x]->theTypeVariableName - << endl; - cout << "\tVar type = " << aMDescs[x]->theTypeName - << endl; - cout << "\tVar size = " << aMDescs[x]->theSizeInBytes - << endl; - - if( aMDescs[x]->theTypePointer != NULLPTR ) - { - cout << "\tClass type = " - << aMDescs[x]->theTypePointer->getInstanceTypeName() - << endl; - } - else - { - cout << "\tNot a FrameworkEntity" << endl; - } - - if( aMDescs[x]->theGetter != NULLPTR ) - { - cout << "\tHas getter " << endl; - } - else - { - ; // do nothing - } - if( aMDescs[x]->theSetter != NULLPTR ) - { - cout << "\tHas setter " << endl; - } - else - { - ; // do nothing - } - } - } - else - { - cout << "\tNo data members" << endl; - } - } - - } - - void dumpInstanceMembers( MetaClassPtr aMCPtr ) - { - Iterator<MemberDescriptorCptr> *aIterator - ( - aMCPtr->createMemberIterator() - ); - - while( aIterator->isValid() ) - { - MemberDescriptorCptr anElement( aIterator->getElement() ); - - cout << "\tVar name = " << anElement->theTypeVariableName - << endl; - cout << "\tVar type = " << anElement->theTypeName - << endl; - cout << "\tVar size = " << anElement->theSizeInBytes - << endl; - - if( anElement->theTypePointer != NULLPTR ) - { - cout << "\tClass type = " - << anElement->theTypePointer->getInstanceTypeName() - << endl; - } - else - { - cout << "\tNot a FrameworkEntity" << endl; - } - - if( anElement->theGetter != NULLPTR ) - { - cout << "\tHas getter " << endl; - } - else - { - ; // do nothing - } - if( anElement->theSetter != NULLPTR ) - { - cout << "\tHas setter " << endl; - } - else - { - ; // do nothing - } - aIterator->setNext(); - } - - aMCPtr->destroyIterator( aIterator ); - - } - - void dumpInstanceFunctions( MetaTypeCptr aMTPtr ) - { - DispatchDescriptorCptr * const aMDescs = aMTPtr->getInstanceFunctions(); - - cout << endl << "Instance Function List : " << endl; - if( aMDescs == NULLPTR ) - { - cout << "Internal class error for functions : " << - aMTPtr->getInstanceTypeName() << endl; - } - else - { - if( aMDescs[0] != NULLPTR ) - { - for( int x = 0; aMDescs[x] != NULLPTR; ++x ) - { - cout << "\tFunction name = " << - aMDescs[x]->theClassMethodName << endl; - } - } - else - { - cout << "\tNo function members" << endl; - } - } - } - - void dumpInstanceFunctions( MetaClassPtr aMCPtr ) - { - Iterator<DispatchDescriptorCptr> *aIterator - ( - aMCPtr->createMethodIterator() - ); - - while( aIterator->isValid() ) - { - cout << "\tFunction name = " << - aIterator->getElement()->theClassMethodName << endl; - aIterator->setNext(); - } - - aMCPtr->destroyIterator( aIterator ); } --- 526,529 ---- |