|
From: Frank V. C. <fr...@us...> - 2001-05-25 04:10:12
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw
In directory usw-pr-cvs1:/tmp/cvs-serv31015/src/libs/clfw
Modified Files:
MetaSpace.cpp Ontology.cpp
Log Message:
425600 Improve MetaClass resolution
Index: MetaSpace.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/MetaSpace.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** MetaSpace.cpp 2000/11/15 23:07:21 1.5
--- MetaSpace.cpp 2001/05/25 04:10:08 1.6
***************
*** 25,37 ****
#if !defined(__METASPACE_HPP)
! #include <MetaSpace.hpp>
#endif
#if !defined(__ONTOLOGY_HPP)
! #include <Ontology.hpp>
#endif
#if !defined(__METACLASS_HPP)
! #include <MetaClass.hpp>
#endif
--- 25,37 ----
#if !defined(__METASPACE_HPP)
! #include <clfw/MetaSpace.hpp>
#endif
#if !defined(__ONTOLOGY_HPP)
! #include <clfw/Ontology.hpp>
#endif
#if !defined(__METACLASS_HPP)
! #include <clfw/MetaClass.hpp>
#endif
***************
*** 40,43 ****
--- 40,48 ----
#endif
+ #if !defined(__CORELINUXASSOCIATIVEITERATOR_HPP)
+ #include <corelinux/CoreLinuxAssociativeIterator.hpp>
+ #endif
+
+
#include <cstring>
***************
*** 296,299 ****
--- 301,351 ----
}
}
+
+ //
+ // Create iterator for ontologies
+ //
+
+ AssociativeIterator<CharCptr,OntologyPtr> *MetaSpace::createIterator( void )
+ {
+
+ AssociativeIterator<CharCptr,OntologyPtr> *aItrPtr( NULLPTR );
+
+ if( MetaSpace::theInitializedFlag == true )
+ {
+ OntologyMapPtr theMap( (OntologyMapPtr)MetaSpace::theHead );
+ aItrPtr = new
+ CoreLinuxAssociativeIterator<OntologyMapIterator,CharCptr,OntologyPtr>
+ (
+ theMap->begin(),
+ theMap->end()
+ );
+
+ }
+ else
+ {
+ ; // good question
+ }
+
+ return aItrPtr;
+ }
+
+
+ void MetaSpace::destroyIterator
+ (
+ AssociativeIterator<CharCptr,OntologyPtr> *aItrPtr
+ )
+ throw ( NullPointerException )
+ {
+ if( aItrPtr == NULLPTR )
+ {
+ throw NullPointerException( LOCATION );
+ }
+ else
+ {
+ delete (CoreLinuxAssociativeIterator<OntologyMapIterator,CharCptr,OntologyPtr>*)aItrPtr;
+
+ }
+ }
+
}
Index: Ontology.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Ontology.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Ontology.cpp 2001/05/20 10:03:47 1.9
--- Ontology.cpp 2001/05/25 04:10:08 1.10
***************
*** 173,197 ****
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
--- 173,186 ----
if( aOPtr != NULLPTR )
{
! aPtr = aOPtr->getClass( aClassName );
if( aPtr == NULLPTR )
{
throw DescriptorNotFound(aClassName, LOCATION );
}
+ else
+ {
+ ; // do nothing
+ }
}
else
***************
*** 230,254 ****
if( aOPtr != NULLPTR )
{
! Iterator<MetaClassCptr> *aIterator( aOPtr->createIterator() );
- while( aIterator->isValid() == true && aPtr == NULLPTR )
- {
- MetaClassPtr aClass = (MetaClassPtr) aIterator->getElement();
- if( aClass->getIdentifier() == aClassId )
- {
- aPtr = aClass;
- }
- else
- {
- ; // do nothing
- }
- aIterator->setNext();
- }
- aOPtr->destroyIterator( aIterator );
-
if( aPtr == NULLPTR )
{
throw DescriptorNotFound( LOCATION );
}
}
else
--- 219,232 ----
if( aOPtr != NULLPTR )
{
! aPtr = aOPtr->getClass( aClassId );
if( aPtr == NULLPTR )
{
throw DescriptorNotFound( LOCATION );
}
+ else
+ {
+ ; // do nothing
+ }
}
else
***************
*** 434,438 ****
Iterator<MetaClassCptr> *Ontology::createIterator( void )
{
! return new CoreLinuxAssociativeIterator<ClassMapIterator,MetaTypeCptr,MetaClassCptr>
(
theClassMap.begin(),
--- 412,417 ----
Iterator<MetaClassCptr> *Ontology::createIterator( void )
{
! return new CoreLinuxAssociativeIterator
! <ClassMapIterator,MetaTypeCptr,MetaClassCptr>
(
theClassMap.begin(),
***************
*** 443,447 ****
Iterator<MetaClassCptr> *Ontology::createRootIterator( void )
{
! return new CoreLinuxAssociativeIterator<ClassMapIterator,MetaTypeCptr,MetaClassCptr>
(
theRootMap.begin(),
--- 422,427 ----
Iterator<MetaClassCptr> *Ontology::createRootIterator( void )
{
! return new CoreLinuxAssociativeIterator
! <ClassMapIterator,MetaTypeCptr,MetaClassCptr>
(
theRootMap.begin(),
***************
*** 455,459 ****
void Ontology::destroyIterator( Iterator<MetaClassCptr> *anIterator )
{
! delete (CoreLinuxAssociativeIterator<ClassMapIterator,MetaTypeCptr,MetaClassCptr>*)anIterator;
}
--- 435,440 ----
void Ontology::destroyIterator( Iterator<MetaClassCptr> *anIterator )
{
! delete (CoreLinuxAssociativeIterator
! <ClassMapIterator,MetaTypeCptr,MetaClassCptr>*)anIterator;
}
|