|
From: Frank V. C. <fr...@us...> - 2000-11-15 01:14:36
|
Update of /cvsroot/corelinux/clfw/src/testdrivers/exf1 In directory slayer.i.sourceforge.net:/tmp/cvs-serv20673/src/testdrivers/exf1 Modified Files: UserType.cpp examp1.cpp Log Message: 116737 Ontology Index: UserType.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/testdrivers/exf1/UserType.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** UserType.cpp 2000/11/11 17:45:54 1.2 --- UserType.cpp 2000/11/15 01:14:32 1.3 *************** *** 115,119 **** //! version for the UserType MetaType ! const DwordCref version(1); //! Define the dispatch function with the no return value option --- 115,120 ---- //! version for the UserType MetaType ! const DwordCref version(1); ! const UniversalIdentifier myId; //! Define the dispatch function with the no return value option *************** *** 162,166 **** ( UserType, ! UniversalIdentifier::getZeroUid(), version, "exf1", --- 163,167 ---- ( UserType, ! myId, version, "exf1", Index: examp1.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/testdrivers/exf1/examp1.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** examp1.cpp 2000/11/12 03:22:06 1.19 --- examp1.cpp 2000/11/15 01:14:32 1.20 *************** *** 77,80 **** --- 77,88 ---- #endif + #if !defined(__ONTOLOGY_HPP) + #include <clfw/Ontology.hpp> + #endif + + #if !defined(__METACLASS_HPP) + #include <clfw/MetaClass.hpp> + #endif + using namespace corelinux; *************** *** 102,105 **** --- 110,114 ---- void testDispatch( void ); + void dumpOntology( void ); // *************** *** 152,155 **** --- 161,165 ---- testDispatch(); //dumpFundementals(); + dumpOntology(); } *************** *** 227,230 **** --- 237,287 ---- delete aType; delete aValue; + } + + void walkOntology( MetaClassPtr aMetaClass, int indent ) + { + for( int x = 0; x != indent ; ++x ) + { + cout << "\t"; + } + + cout << aMetaClass->getType()->getMetaTypeName() << " (" + << aMetaClass->getType()->getDomainName() << ")" << endl; + + Iterator<MetaClassCptr> *aIterator( aMetaClass->createIterator()); + + while( aIterator->isValid() == true ) + { + walkOntology( (MetaClassPtr)aIterator->getElement(), indent+1 ); + aIterator->setNext(); + } + aMetaClass->destroyIterator( aIterator ); + } + + void dumpOntology( void ) + { + // + // We start by resolving the root of roots :) + // + + Ontology *aOntology( MetaSpace::getOntology("corelinux") ); + + if( aOntology != NULLPTR ) + { + cout << "Have ontology " << aOntology->getDomainName() << endl; + Iterator<MetaClassCptr> *aIterator( aOntology->createRootIterator()); + + while( aIterator->isValid() == true ) + { + walkOntology( (MetaClassPtr)aIterator->getElement(),0 ); + aIterator->setNext(); + } + + aOntology->destroyIterator( aIterator ); + } + else + { + throw NullPointerException( LOCATION ); + } } |