Federico Cavalieri has proposed merging lp:~zorba-coders/zorba/fix-boost-typedef into lp:zorba.
Commit message: Removed boost dependency Fixed typedef Requested reviews: Matthias Brantner (matthias-brantner) Federico Cavalieri (fcavalieri) Paul J. Lucas (paul-lucas) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/fix-boost-typedef/+merge/217976 Removed boost dependency Fixed typedef -- https://code.launchpad.net/~zorba-coders/zorba/fix-boost-typedef/+merge/217976 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/functions/cacheable_function.cpp' --- src/functions/cacheable_function.cpp 2014-04-16 18:23:55 +0000 +++ src/functions/cacheable_function.cpp 2014-05-01 19:54:22 +0000 @@ -41,8 +41,8 @@ ********************************************************************************/ FunctionCache::FunctionCache( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual, + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual, bool aAcrossSnapshots): FunctionCacheBaseMap(aSctx, aExcludeFromCacheKey, aCompareWithDeepEqual), theAcrossSnapshots(aAcrossSnapshots), @@ -173,9 +173,6 @@ if (theAreCacheSettingsComputed) return; - theExcludeFromCacheKey = boost::dynamic_bitset<>(theSignature.paramCount()); - theCompareWithDeepEqual = boost::dynamic_bitset<>(theSignature.paramCount()); - if (!theTypeManager) theTypeManager = getTypeManager(); @@ -368,13 +365,14 @@ /******************************************************************************* ********************************************************************************/ void cacheable_function::parseCachingAnnotation(AnnotationInternal* aAnnotation, - boost::dynamic_bitset<>& aBitset, + std::vector<bool>& aFlags, XQueryDiagnostics* aDiag) { if (!aAnnotation) return; - aBitset = boost::dynamic_bitset<>(theSignature.paramCount()); + aFlags.resize(theSignature.paramCount(), false); + csize lNum = aAnnotation->getNumLiterals(); if (lNum) { @@ -418,7 +416,7 @@ } else { - aBitset[lIndex-1] = 1; + aFlags[lIndex-1] = true; } } } @@ -432,30 +430,30 @@ /******************************************************************************* ********************************************************************************/ -void cacheable_function::saveDynamicBitset(const boost::dynamic_bitset<>& aBitset, ::zorba::serialization::Archiver& ar) +void cacheable_function::saveFlags(const std::vector<bool>& aFlags, ::zorba::serialization::Archiver& ar) { - size_t lSize = aBitset.size(); + std::vector<bool>::size_type lSize = aFlags.size(); ar & lSize; bool lValue; - for (boost::dynamic_bitset<>::size_type i = 0; i<lSize; ++i) + for (std::vector<bool>::size_type i = 0; i<lSize; ++i) { - lValue = (bool)aBitset[i]; + lValue = aFlags[i]; ar & lValue; } } /******************************************************************************* ********************************************************************************/ -void cacheable_function::loadDynamicBitset(boost::dynamic_bitset<>& aBitset, ::zorba::serialization::Archiver& ar) +void cacheable_function::loadFlags(std::vector<bool>& aFlags, ::zorba::serialization::Archiver& ar) { - size_t lSize = 0; + std::vector<bool>::size_type lSize = 0; ar & lSize; - aBitset.resize(lSize); + aFlags.resize(lSize, false); bool lValue; - for (boost::dynamic_bitset<>::size_type i = 0; i<lSize; ++i) + for (std::vector<bool>::size_type i = 0; i<lSize; ++i) { ar & lValue; - aBitset[i] = lValue; + aFlags[i] = lValue; } } === modified file 'src/functions/cacheable_function.h' --- src/functions/cacheable_function.h 2014-04-16 18:23:55 +0000 +++ src/functions/cacheable_function.h 2014-05-01 19:54:22 +0000 @@ -20,22 +20,22 @@ #include "functions/function.h" #include "zorbautils/hashmap_itemh_cache.h" #include "store/api/item_handle.h" -#include <boost/dynamic_bitset.hpp> +#include <vector> namespace zorba { class expr; -typedef typename zorba::ItemHandleCacheHashMap< std::vector<store::Item_t> > FunctionCacheBaseMap; +typedef zorba::ItemHandleCacheHashMap< std::vector<store::Item_t> > FunctionCacheBaseMap; class FunctionCache : public FunctionCacheBaseMap { public: - typedef typename FunctionCacheBaseMap::iterator iterator; + typedef FunctionCacheBaseMap::iterator iterator; FunctionCache(static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual, + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual, bool aAcrossSnapshots); FunctionCache::iterator find(const store::Item_t& aKey, PlanState& aPlanState); @@ -87,8 +87,8 @@ bool theCacheAcrossSnapshots; bool theIsCacheAutomatic; bool theAreCacheSettingsComputed; - boost::dynamic_bitset<> theExcludeFromCacheKey; - boost::dynamic_bitset<> theCompareWithDeepEqual; + std::vector<bool> theExcludeFromCacheKey; + std::vector<bool> theCompareWithDeepEqual; public: SERIALIZABLE_CLASS(cacheable_function) @@ -114,8 +114,8 @@ virtual void useDefaultCachingSettings(); virtual void useLegacyCache(XQueryDiagnostics* aDiag); virtual void useStrictlyDeterministicCache(XQueryDiagnostics* aDiag); - void saveDynamicBitset(const boost::dynamic_bitset<>& aBitset, ::zorba::serialization::Archiver& ar); - void loadDynamicBitset(boost::dynamic_bitset<>& aBitset, ::zorba::serialization::Archiver& ar); + void saveFlags(const std::vector<bool>& aFlags, ::zorba::serialization::Archiver& ar); + void loadFlags(std::vector<bool>& aFlags, ::zorba::serialization::Archiver& ar); private: virtual bool haveAtomicArgumentsAndReturnType() const; @@ -123,7 +123,7 @@ virtual bool haveAllArgumentOneCardinality() const; virtual void parseCachingAnnotations(XQueryDiagnostics* aDiag); virtual void parseCachingAnnotation(AnnotationInternal* aAnnotation, - boost::dynamic_bitset<>& aBitSet, + std::vector<bool>& aFlags, XQueryDiagnostics* aDiag); virtual TypeManager* getTypeManager(); === modified file 'src/functions/external_function.cpp' --- src/functions/external_function.cpp 2014-04-16 18:23:55 +0000 +++ src/functions/external_function.cpp 2014-05-01 19:54:22 +0000 @@ -100,18 +100,16 @@ ar & theLoc; ar & theHasCache; ar & theCacheAcrossSnapshots; - if (ar.is_serializing_out()) { - saveDynamicBitset(theExcludeFromCacheKey, ar); - saveDynamicBitset(theCompareWithDeepEqual, ar); + saveFlags(theExcludeFromCacheKey, ar); + saveFlags(theCompareWithDeepEqual, ar); } else { - loadDynamicBitset(theExcludeFromCacheKey, ar); - loadDynamicBitset(theCompareWithDeepEqual, ar); + loadFlags(theExcludeFromCacheKey, ar); + loadFlags(theCompareWithDeepEqual, ar); } - ar & theAreCacheSettingsComputed; ar & theIsCacheAutomatic; === modified file 'src/functions/udf.cpp' --- src/functions/udf.cpp 2014-04-16 18:23:55 +0000 +++ src/functions/udf.cpp 2014-05-01 19:54:22 +0000 @@ -181,13 +181,13 @@ ar & theCacheAcrossSnapshots; if (ar.is_serializing_out()) { - saveDynamicBitset(theExcludeFromCacheKey, ar); - saveDynamicBitset(theCompareWithDeepEqual, ar); + saveFlags(theExcludeFromCacheKey, ar); + saveFlags(theCompareWithDeepEqual, ar); } else { - loadDynamicBitset(theExcludeFromCacheKey, ar); - loadDynamicBitset(theCompareWithDeepEqual, ar); + loadFlags(theExcludeFromCacheKey, ar); + loadFlags(theCompareWithDeepEqual, ar); } ar & theAreCacheSettingsComputed; ar & theIsCacheAutomatic; === modified file 'src/zorbautils/hashmap_itemh_cache.h' --- src/zorbautils/hashmap_itemh_cache.h 2014-04-16 18:23:55 +0000 +++ src/zorbautils/hashmap_itemh_cache.h 2014-05-01 19:54:22 +0000 @@ -27,7 +27,7 @@ #include "system/globalenv.h" -#include <boost/dynamic_bitset.hpp> +#include <vector> namespace zorba { @@ -39,14 +39,14 @@ long theTimeZone; XQPCollator* theCollator; static_context* theSctx; - boost::dynamic_bitset<> theExcludeFromCacheKey; - boost::dynamic_bitset<> theCompareWithDeepEqual; + std::vector<bool> theExcludeFromCacheKey; + std::vector<bool> theCompareWithDeepEqual; public: ItemHandleCacheHashMapCmp( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual) + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual) : theTimeZone(0), theCollator(NULL), @@ -54,14 +54,12 @@ theExcludeFromCacheKey(aExcludeFromCacheKey), theCompareWithDeepEqual(aCompareWithDeepEqual) { - /*if (theSctx->get_local_typemanager() == NULL) - theSctx->set_typemanager(new TypeManagerImpl(&GENV_TYPESYSTEM));*/ } ItemHandleCacheHashMapCmp( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual, + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual, long aTimezone, XQPCollator* aCollator) : @@ -71,8 +69,6 @@ theExcludeFromCacheKey(aExcludeFromCacheKey), theCompareWithDeepEqual(aCompareWithDeepEqual) { - /*if (theSctx->get_local_typemanager() == NULL) - theSctx->set_typemanager(new TypeManagerImpl(&GENV_TYPESYSTEM));*/ } bool id_equal(const store::Item* t1, const store::Item* t2) const @@ -200,18 +196,18 @@ for (unsigned int i=0; i<lVector1->size(); ++i) { - if (!theExcludeFromCacheKey[i]) + if (!theExcludeFromCacheKey.size() || !theExcludeFromCacheKey[i]) { - if (theCompareWithDeepEqual[i]) + if (!theCompareWithDeepEqual.size() || !theCompareWithDeepEqual[i]) + { + if (!id_equal(lVector1->getItem(i), lVector2->getItem(i))) + return false; + } + else { if (!deep_equal(lVector1->getItem(i), lVector2->getItem(i))) return false; } - else - { - if (!id_equal(lVector1->getItem(i), lVector2->getItem(i))) - return false; - } } } return true; @@ -327,12 +323,12 @@ for (unsigned int i=0; i<lVector->size(); ++i) { - if (!theExcludeFromCacheKey[i]) + if (!theExcludeFromCacheKey.size() || !theExcludeFromCacheKey[i]) { - if (theCompareWithDeepEqual[i]) + if (!theCompareWithDeepEqual.size() || !theCompareWithDeepEqual[i]) + lInnerHash = id_hash(lVector->getItem(i)); + else lInnerHash = deep_hash(lVector->getItem(i)); - else - lInnerHash = id_hash(lVector->getItem(i)); } lHash = hashfun::h32(&lInnerHash, sizeof(lInnerHash), lHash); } @@ -368,8 +364,8 @@ public: ItemHandleCacheHashMap( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual) + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual) : theMap( ItemHandleCacheHashMapCmp(aSctx, aExcludeFromCacheKey, aCompareWithDeepEqual), @@ -380,8 +376,8 @@ ItemHandleCacheHashMap( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual, + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual, ulong aSize, bool aSync) : @@ -394,8 +390,8 @@ ItemHandleCacheHashMap( static_context* aSctx, - boost::dynamic_bitset<>& aExcludeFromCacheKey, - boost::dynamic_bitset<>& aCompareWithDeepEqual, + std::vector<bool>& aExcludeFromCacheKey, + std::vector<bool>& aCompareWithDeepEqual, long aTimezone, XQPCollator* aCollation, ulong aSize,
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp