diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Freeze/Map.h | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/cpp/include/Freeze/Map.h b/cpp/include/Freeze/Map.h index 1429b4fb46c..f91a10c8606 100644 --- a/cpp/include/Freeze/Map.h +++ b/cpp/include/Freeze/Map.h @@ -942,99 +942,6 @@ protected: }; -// -// ReverseMapIndex is used when the map's value is the secondary key -// - -template <typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec> -class ReverseMapIndex : public MapIndexBase -{ -protected: - - ReverseMapIndex(const std::string& name) : - MapIndexBase(name) - { - } - - virtual void marshalKey(const Value& v, Key& k) const - { - k = v; - } -}; - - -template <typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec> -class MapWithReverseIndex : public Map<key_type, mapped_type, KeyCodec, ValueCodec> -{ -public: - - typedef std::pair<const key_type, const mapped_type> value_type; - typedef Iterator<key_type, mapped_type, KeyCodec, ValueCodec > iterator; - typedef ConstIterator<key_type, mapped_type, KeyCodec, ValueCodec > const_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - - // - // Constructors - // - MapWithReverseIndex(const Freeze::ConnectionPtr& connection, - const std::string& dbName, - bool createDb = true) : - Map<key_type, mapped_type, KeyCodec, ValueCodec>(connection->getCommunicator()) - { - std::vector<MapIndexBasePtr> indices; - indices.push_back(new ReverseMapIndex<key_type, mapped_type, KeyCodec, ValueCodec>("index")); - - _helper.reset(MapHelper::create(connection, dbName, indices, createDb)); - } - - template <class _InputIterator> - MapWithReverseIndex(const Freeze::ConnectionPtr& connection, - const std::string& dbName, - bool createDb, - _InputIterator first, _InputIterator last) : - Map<key_type, mapped_type, KeyCodec, ValueCodec>(connection->getCommunicator()) - { - std::vector<MapIndexBasePtr> indices; - indices.push_back(new ReverseMapIndex<key_type, mapped_type, KeyCodec, ValueCodec>("index")); - - while(first != last) - { - put(*first); - ++first; - } - } - - // - // Extra functions - // - - iterator reverseFind(const mapped_type& k) - { - Key bytes; - ValueCodec::write(k, bytes, _communicator); - - return iterator(_helper->index("index")->untypedFind(bytes, false), _communicator); - } - - const_iterator reverseFind(const mapped_type& k) const - { - Key bytes; - ValueCodec::write(k, bytes, _communicator); - - return const_iterator(_helper->index("index")->untypedFind(bytes, true), _communicator); - } - - int valueCount(const mapped_type& k) const - { - Key bytes; - ValueCodec::write(k, bytes, _communicator); - - return _helper->index("index")->untypedCount(bytes); - } -}; - } // |