← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/cleanup-collection_iteration into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/cleanup-collection_iteration into lp:zorba.

Commit message:
removed obsolete store internal function that allowed iterating over collections (instead of names of collections)

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Till Westmann (tillw)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/cleanup-collection_iteration/+merge/144369
-- 
https://code.launchpad.net/~zorba-coders/zorba/cleanup-collection_iteration/+merge/144369
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/collection_set.h'
--- src/store/naive/collection_set.h	2012-09-19 21:16:15 +0000
+++ src/store/naive/collection_set.h	2013-01-22 18:45:26 +0000
@@ -25,9 +25,6 @@
   
 namespace simplestore {
 
-class CollectionIterator;
-
-
 /*******************************************************************************
   Collections container to ease the implementation of stores which contain 
   a different kind of memory management.
@@ -54,35 +51,7 @@
   
   virtual store::Iterator_t
   names(bool dynamic) = 0;
-    
-  virtual CollectionSetIterator_t
-  
-  collections(bool dynamic) = 0;
-};
-    
-
-/*******************************************************************************
-  Collection set iterator
-  Returned by the CollectionSet::collections function
-********************************************************************************/
-class CollectionSetIterator : public SimpleRCObject
-{
-public:
-  virtual ~CollectionSetIterator() {}
-
-  virtual void
-  open() = 0;
-    
-  virtual bool
-  next(store::Collection_t&) = 0;
-    
-  virtual void
-  reset() = 0;
-    
-  virtual void
-  close() throw() = 0;
-};
-
+};
 
 } /* namespace simplestore */
 } /* namespace zorba */

=== modified file 'src/store/naive/simple_collection_set.cpp'
--- src/store/naive/simple_collection_set.cpp	2012-09-19 21:16:15 +0000
+++ src/store/naive/simple_collection_set.cpp	2013-01-22 18:45:26 +0000
@@ -25,74 +25,6 @@
 /*******************************************************************************
 
 ********************************************************************************/
-SimpleCollectionSetIterator::SimpleCollectionSetIterator(
-    SimpleCollectionSet::Set* aCollections,
-    bool aDynamicCollection) 
-  : 
-  theCollections(aCollections),
-  theOpened(false),
-  theDynamicCollections(aDynamicCollection)
-{ 
-}
-
-
-SimpleCollectionSetIterator::~SimpleCollectionSetIterator()
-{
-  close();
-}
-
-
-void
-SimpleCollectionSetIterator::open()
-{
-  theIterator = theCollections->begin();
-  theOpened = true;
-}
-
-
-bool
-SimpleCollectionSetIterator::next(zorba::store::Collection_t& aResult) 
-{
-  while (theIterator != theCollections->end()) 
-  {
-    aResult = (*theIterator).second;
-    if (aResult->isDynamic() != theDynamicCollections) 
-    {
-      ++theIterator;
-      continue;
-    }
-    else
-    {
-      ++theIterator;
-      return true;
-    }
-  }
-  aResult = NULL;
-  return false;
-}
-
-
-void
-SimpleCollectionSetIterator::reset()
-{
-  theIterator = theCollections->begin();
-}
-
-
-void
-SimpleCollectionSetIterator::close() throw()
-{
-  if (!theOpened) 
-  {
-    return;
-  }
-  theOpened = false;
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
 const ulong SimpleCollectionSet::DEFAULT_COLLECTION_MAP_SIZE = 32;
 
 
@@ -162,12 +94,6 @@
 }
 
 
-CollectionSetIterator_t SimpleCollectionSet::collections(bool dynamic) 
-{
-  return new SimpleCollectionSetIterator(&theCollections, dynamic);
-}
-
-
 // specialize the next function of the NameIterator for
 // the SimpleCollectionSet in order to be able to handle dynamic collections
 template<> bool

=== modified file 'src/store/naive/simple_collection_set.h'
--- src/store/naive/simple_collection_set.h	2012-09-19 21:16:15 +0000
+++ src/store/naive/simple_collection_set.h	2013-01-22 18:45:26 +0000
@@ -24,8 +24,6 @@
   
 namespace simplestore {
 
-class CollectionIterator;
-    
 /*******************************************************************************
   Collections container to ease the implementation of stores which contain 
   a different kind of memory management. For the simplestore, the Collections
@@ -64,43 +62,6 @@
     
   virtual zorba::store::Iterator_t
   names(bool isDynamic);
-    
-  // needs to be virtual to allow implementation of additional stores
-  virtual CollectionSetIterator_t
-  collections(bool isDynamic);  
-};
-
-
-/*******************************************************************************
-  Collection iterator
-  Returned by the CollectionSet::collections function
-********************************************************************************/
-class SimpleCollectionSetIterator : public CollectionSetIterator
-{
-protected:
-  SimpleCollectionSet::Set*          theCollections;
-  SimpleCollectionSet::Set::iterator theIterator;
-  bool                               theOpened;
-  bool                               theDynamicCollections;
-  
-public:
-  SimpleCollectionSetIterator(
-      SimpleCollectionSet::Set* aCollections,
-      bool aDynamicCollections);
-
-  virtual ~SimpleCollectionSetIterator();
-    
-  virtual void
-  open();
-    
-  virtual bool
-  next(zorba::store::Collection_t&);
-    
-  virtual void
-  reset();
-    
-  virtual void
-  close() throw();
 };
 
 


Follow ups