|
From: Frank V. C. <fr...@us...> - 2001-04-11 01:39:28
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw
In directory usw-pr-cvs1:/tmp/cvs-serv11136/src/libs/clfw
Modified Files:
Ontology.cpp
Log Message:
Getting ready for gdbm in the schema catalog implementation
Index: Ontology.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Ontology.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Ontology.cpp 2000/11/15 23:07:21 1.6
--- Ontology.cpp 2001/04/11 01:39:25 1.7
***************
*** 24,38 ****
#if !defined(__ONTOLOGY_HPP)
! #include <Ontology.hpp>
#endif
#if !defined(__METASPACE_HPP)
! #include <MetaSpace.hpp>
#endif
#if !defined(__METACLASS_HPP)
! #include <MetaClass.hpp>
#endif
#if !defined(__CORELINUXASSOCIATIVEITERATOR_HPP)
#include <corelinux/CoreLinuxAssociativeIterator.hpp>
--- 24,46 ----
#if !defined(__ONTOLOGY_HPP)
! #include <clfw/Ontology.hpp>
#endif
#if !defined(__METASPACE_HPP)
! #include <clfw/MetaSpace.hpp>
#endif
#if !defined(__METACLASS_HPP)
! #include <clfw/MetaClass.hpp>
#endif
+ #if !defined(__FRAMEWORKSTRING_HPP)
+ #include <clfw/FrameworkString.hpp>
+ #endif
+
+ #if !defined(__DESCRIPTORNOTFOUND_HPP)
+ #include <clfw/DescriptorNotFound.hpp>
+ #endif
+
#if !defined(__CORELINUXASSOCIATIVEITERATOR_HPP)
#include <corelinux/CoreLinuxAssociativeIterator.hpp>
***************
*** 139,142 ****
--- 147,202 ----
}
+ MetaClassPtr Ontology::getClassFor
+ (
+ CharCptr aClassName,
+ CharCptr anOntology
+ )
+ throw ( NullPointerException, DescriptorNotFound )
+ {
+ MetaClassPtr aPtr( NULLPTR );
+
+ if( aClassName == NULLPTR )
+ {
+ throw NullPointerException( LOCATION );
+ }
+ else
+ {
+ OntologyPtr aOPtr =
+ MetaSpace::getOntology
+ (
+ ( anOntology == NULLPTR ? "corelinux" : anOntology )
+ );
+ if( aOPtr != NULLPTR )
+ {
+ Iterator<MetaClassCptr> *aIterator( aOPtr->createIterator() );
+
+ while( aIterator->isValid() == true && aPtr == NULLPTR )
+ {
+ MetaClassPtr aClass = (MetaClassPtr) aIterator->getElement();
+ if( std::strcmp(aClassName,aClass->getInstanceTypeName()) == 0 )
+ {
+ aPtr = aClass;
+ }
+ else
+ {
+ ; // do nothing
+ }
+ aIterator->setNext();
+ }
+ aOPtr->destroyIterator( aIterator );
+
+ if( aPtr == NULLPTR )
+ {
+ throw DescriptorNotFound(aClassName, LOCATION );
+ }
+ }
+ else
+ {
+ throw DescriptorNotFound("Ontology not found", LOCATION );
+ }
+ }
+
+ return aPtr;
+ }
//
// Add a new type to the ontology
|