#include <TDBDiskIndex.h>
Inheritance diagram for Tagcoll::TDBDiskIndex< ITEM, TAG >:
Public Member Functions | |
TDBDiskIndex (const std::string &pkgidx, const std::string &tagidx, const Converter< ITEM, std::string > &fromitem, const Converter< TAG, std::string > &fromtag, const Converter< std::string, ITEM > &toitem, const Converter< std::string, TAG > &totag, bool write=true) | |
Create a new TDBDiskIndex. | |
virtual | ~TDBDiskIndex () |
virtual bool | hasTag (const TAG &tag) const |
Check if the collection contains a tag. | |
virtual OpSet< ITEM > | getTaggedItems () const |
Get the set of all the items that have tags according to this collection. | |
virtual OpSet< TAG > | getAllTags () const |
Get the set of all the tags in this collection. | |
virtual int | getCardinality (const TAG &tag) const |
Get the cardinality of tag `tag' (that is, the number of items who have it). | |
virtual void | output (Consumer< ITEM, TAG > &consumer) const |
Output all the contents of the collection to a Consumer. | |
virtual void | applyChange (const PatchList< ITEM, TAG > &change) |
Apply a patch to the collection. | |
template<> | |
OpSet< string > | getItemsHavingTag (const string &tag) const |
template<> | |
OpSet< string > | getTagsOfItem (const string &item) const |
Protected Member Functions | |
virtual void | consumeItem (const ITEM &item, const OpSet< TAG > &tags) |
Process a tagged item, with its tags. | |
virtual void | consumeItems (const OpSet< ITEM > &items, const OpSet< TAG > &tags) |
Process a set of items identically tagged, with their tags. | |
virtual OpSet< ITEM > | getItemsHavingTag (const TAG &tag) const |
Get the items which are tagged with at least the tag `tag'. | |
virtual OpSet< TAG > | getTagsOfItem (const ITEM &item) const |
Get the tags attached to an item. | |
Protected Attributes | |
TDBFile | pkgdb |
TDBFile | tagdb |
const Converter< ITEM, std::string > & | fromitem |
const Converter< TAG, std::string > & | fromtag |
const Converter< std::string, ITEM > & | toitem |
const Converter< std::string, TAG > & | totag |
It allows to efficiently query a collection without having to store it all into memory.
If used for heavy modifications, the performance is slower compared to other in-memory collections. If database writes are mainly used for populating the index, then TDBIndexer should be used to create the index and TDBDiskIndex to access it afterwards.
|
Create a new TDBDiskIndex.
|
|
|
|
Apply a patch to the collection. Example: void perform(const PatchList<ITEM, TAG>& change) { collection.applyChange(change); undo.push_back(change.getReverse()); } Implements Tagcoll::Collection< ITEM, TAG >. |
|
Process a tagged item, with its tags.
Implements Tagcoll::Consumer< ITEM, TAG >. |
|
Process a set of items identically tagged, with their tags.
Reimplemented from Tagcoll::Consumer< ITEM, TAG >. |
|
Get the set of all the tags in this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the cardinality of tag `tag' (that is, the number of items who have it).
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
|
|
Get the items which are tagged with at least the tag `tag'.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Get the set of all the items that have tags according to this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
|
|
Get the tags attached to an item.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Check if the collection contains a tag.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
Output all the contents of the collection to a Consumer.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >. |
|
|
|
|
|
|
|
|
|
|
|
|