|
From: Frank V. C. <fr...@us...> - 2001-02-27 13:49:55
|
Update of /cvsroot/corelinux/clfw/src/libs/clfw
In directory usw-pr-cvs1:/tmp/cvs-serv4163/src/libs/clfw
Modified Files:
Array.cpp FrameworkEntity.cpp Makefile.am
Added Files:
IncompatibleClassException.cpp
Log Message:
233863 Collections
***** Error reading new file: [Errno 2] No such file or directory: 'IncompatibleClassException.cpp'
Index: Array.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Array.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Array.cpp 2001/02/25 15:19:52 1.3
--- Array.cpp 2001/02/27 13:51:11 1.4
***************
*** 31,34 ****
--- 31,38 ----
#endif
+ #if !defined(__METACLASS_HPP)
+ #include <MetaClass.hpp>
+ #endif
+
#include <cstring>
***************
*** 111,115 ****
//
! CountCref Array::size( void ) const
{
return theCount;
--- 115,119 ----
//
! Count Array::size( void ) const
{
return theCount;
***************
*** 157,165 ****
}
//
// Add an entity to the array
//
! ArrayRef Array::operator=( FrameworkEntityPtr anEntity )
throw (NullPointerException,BoundsException)
{
--- 161,227 ----
}
+ // Does the entity exist in the collection
+
+ bool Array::containsElement( FrameworkEntityPtr aPtr ) const
+ throw (NullPointerException)
+ {
+ bool found( false );
+
+ if( aPtr == NULLPTR )
+ {
+ throw NullPointerException( LOCATION );
+ }
+
+ //
+ // Iterate through each, calling equal
+ //
+
+ else
+ {
+ GUARD;
+
+ for( Count x = 0; ( x < theCount ) && ( found == false ); ++x )
+ {
+ found = theEntities[x]->equals( aPtr );
+ }
+ }
+
+ return found;
+ }
+
+ // Does the type exist in the collection
+
+ bool Array::containsType( MetaClassPtr aPtr ) const
+ throw (NullPointerException)
+ {
+ bool found( false );
+ if( aPtr == NULLPTR )
+ {
+ throw NullPointerException( LOCATION );
+ }
+
+ //
+ // Iterate through each, calling equal
+ //
+
+ else
+ {
+ GUARD;
+
+ for( Count x = 0; ( x < theCount ) && ( found == false ); ++x )
+ {
+ found = *(MetaSpace::getClassForType(theEntities[x]->getType())) ==
+ *aPtr;
+ }
+ }
+
+ return found;
+ }
+
//
// Add an entity to the array
//
! ArrayRef Array::operator+=( FrameworkEntityPtr anEntity )
throw (NullPointerException,BoundsException)
{
***************
*** 189,193 ****
throw (NullPointerException,BoundsException)
{
! (*this)=anEntity;
}
--- 251,255 ----
throw (NullPointerException,BoundsException)
{
! (*this)+=anEntity;
}
***************
*** 195,199 ****
throw (NullPointerException,BoundsException)
{
! (*this)=anEntity;
}
--- 257,261 ----
throw (NullPointerException,BoundsException)
{
! (*this)+=anEntity;
}
***************
*** 376,380 ****
}
! /// Copy (append)
ArrayRef Array::operator+=( ArrayCptr anArrayPtr )
--- 438,442 ----
}
! // Copy (append)
ArrayRef Array::operator+=( ArrayCptr anArrayPtr )
***************
*** 392,395 ****
--- 454,533 ----
}
+
+ //
+ // Add all from one collection to this one
+ //
+
+ void Array::addAll( CollectionCref aCollection )
+ throw (BoundsException,IncompatibleClassException)
+ {
+ // Fast path
+
+ if( aCollection.getType()->isTypeOf( this->getType() ) == true )
+ {
+ (*this) += (ArrayCref)aCollection;
+ }
+
+ // Hmmm, can't work it reliably
+
+ else
+ {
+ throw IncompatibleClassException( LOCATION );
+ }
+ }
+
+ //
+ // Add all from a collection to this one at a specific point
+ //
+
+ void Array::addAll( Index offset, CollectionCref aCollection )
+ throw (BoundsException,IncompatibleClassException)
+ {
+
+ if( this->equals( &aCollection ) == false )
+ {
+ if( aCollection.getType()->isTypeOf( this->getType() ) == true )
+ {
+ if( checkBoundsForAdd(aCollection.size()) == false )
+ {
+ throw BoundsException( LOCATION );
+ }
+ else
+ {
+ GUARD;
+
+ //
+ // Using the information from the reference
+ // adjust and append
+ //
+
+ CountCref aSize( aCollection.size() );
+
+ this->increaseArraySize( aSize );
+ this->shiftForInsert( offset, aSize );
+
+ //
+ // Now insert the data from the reference
+ //
+
+ this->copyOverFromArray
+ (
+ offset,
+ ((ArrayCref)aCollection).getArray(),
+ aSize
+ );
+ this->increaseOccupancy( aSize );
+ }
+ }
+ else
+ {
+ throw IncompatibleClassException( LOCATION );
+ }
+ }
+ else
+ {
+ ; // do nothing
+ }
+ }
// Expose list
Index: FrameworkEntity.cpp
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/FrameworkEntity.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** FrameworkEntity.cpp 2001/02/24 04:18:49 1.9
--- FrameworkEntity.cpp 2001/02/27 13:51:11 1.10
***************
*** 101,105 ****
) const
{
! return ( this->getOid() == aFrameworkEntity.getOid() );
}
--- 101,105 ----
) const
{
! return equals( &aFrameworkEntity );
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/corelinux/clfw/src/libs/clfw/Makefile.am,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** Makefile.am 2001/02/24 04:32:31 1.17
--- Makefile.am 2001/02/27 13:51:11 1.18
***************
*** 14,17 ****
--- 14,18 ----
SRCS = clfw.cpp \
ClassException.cpp \
+ IncompatibleClassException.cpp \
UniversalIdentifier.cpp \
AbstractEntityException.cpp \
|