|
From: Frank V. C. <fr...@us...> - 2000-11-12 03:22:09
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw In directory slayer.i.sourceforge.net:/tmp/cvs-serv25497/src/libs/clfw Modified Files: MetaSpace.cpp Ontology.cpp Log Message: 116737 Ontology work Index: MetaSpace.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/MetaSpace.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** MetaSpace.cpp 2000/11/11 17:45:54 1.1 --- MetaSpace.cpp 2000/11/12 03:22:06 1.2 *************** *** 32,37 **** --- 32,65 ---- #endif + #if !defined(__MAP_HPP) + #include <corelinux/Map.hpp> + #endif + + #include <cstring> + namespace corelinux { + struct _MetaSpaceLink + { + void *data; + void *next; + }; + + DECLARE_TYPE( struct _MetaSpaceLink, MetaSpaceLink ); + + struct KeyComp + { + bool operator()(CharCptr s1, CharCptr s2) const + { + return strcmp(s1, s2) < 0; + } + }; + + + CORELINUX_MAP( CharCptr, OntologyPtr, KeyComp, OntologyMap ); + + VoidPtr MetaSpace::theHead( NULLPTR ); + bool MetaSpace::theInitializedFlag( false ); + CharCptr MetaSpace::theDefaultDomain( "corelinux" ); // // Never used, private *************** *** 82,86 **** void MetaSpace::storeType( MetaTypeCptr aMetaType ) { ! ; } --- 110,137 ---- void MetaSpace::storeType( MetaTypeCptr aMetaType ) { ! if( MetaSpace::theInitializedFlag == false ) ! { ! MetaSpaceLinkPtr aLink = new MetaSpaceLink; ! aLink->data = (VoidPtr )aMetaType; ! ! if( MetaSpace::theHead == NULLPTR ) ! { ! aLink->next = NULLPTR; ! } ! else ! { ! aLink->next = MetaSpace::theHead; ! } ! ! MetaSpace::theHead = (VoidPtr) aLink; ! } ! else ! { ! // ! // Because we are initialized, either ! // this type has a domain waiting for it, ! // or we need to create one. ! // ! } } *************** *** 89,98 **** // ! bool MetaSpace::initialize( void ) { ! bool isInitialized( false ); ! return isInitialized; } - } --- 140,209 ---- // ! void MetaSpace::initialize( void ) { ! if( MetaSpace::theInitializedFlag == false ) ! { ! MetaSpace::theInitializedFlag = true; ! ! OntologyMapPtr theMap = new OntologyMap; ! ! MetaSpaceLinkPtr aLink = (MetaSpaceLinkPtr)MetaSpace::theHead; ! ! // ! // For each link, get the domain name and if there is no ontology ! // then create, then add the node to the ontology ! // ! ! OntologyPtr aOntology( NULLPTR ); ! OntologyMapIterator aFItr; ! ! while( aLink != NULLPTR ) ! { ! MetaTypeCptr aMT = ( MetaTypeCptr ) aLink->data; ! ! aFItr = theMap->find(aMT->getDomainName()); ! ! if( aFItr == theMap->end() ) ! { ! OntologyPtr aOntology = new Ontology( aMT->getDomainName() ); ! (*theMap)[aOntology->getDomainName()] = aOntology; ! } ! else ! { ! aOntology = (*aFItr).second; ! } ! ! aOntology->addMetaType( aMT ); ! MetaSpaceLinkPtr aTmp = aLink; ! aLink = (MetaSpaceLinkPtr)aLink->next; ! delete aTmp; ! } ! ! // ! // Now go and initialize the corelinux first before the others ! // ! ! aFItr = theMap->find(MetaSpace::theDefaultDomain); ! if( aFItr != theMap->end() ) ! { ! ! } ! else ! { ! throw NullPointerException(LOCATION); ! } ! ! aFItr = theMap->begin(); ! while( aFItr != theMap->end() ) ! { ! ! } ! ! } ! else ! { ! ; // do nothing, already initialized ! } } } Index: Ontology.cpp =================================================================== RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Ontology.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Ontology.cpp 2000/11/11 17:45:54 1.2 --- Ontology.cpp 2000/11/12 03:22:06 1.3 *************** *** 79,83 **** } ! void Ontology::addType( MetaTypeCptr aMetaType ) { } --- 79,83 ---- } ! void Ontology::addMetaType( MetaTypeCptr aMetaType ) { } *************** *** 86,89 **** --- 86,94 ---- { ; // do nothing + } + + CharCptr Ontology::getDomainName( void ) const + { + return theDomainName; } } |