#include <TDBIndexer.h>
Inheritance diagram for Tagcoll::TDBIndexer< ITEM, TAG >:
Public Member Functions | |
virtual | ~TDBIndexer () |
virtual bool | hasItem (const ITEM &item) const |
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 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. | |
void | writeIndex (Converter< ITEM, std::string > &itemconv, Converter< TAG, std::string > &tagconv, const std::string &pkgidx, const std::string &tagidx) const |
Write all collected informations to a disk index. | |
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 | |
std::map< ITEM, OpSet< TAG > > | items |
std::map< TAG, OpSet< ITEM > > | tags |
It can be used as a working collection, and it can also write its contents into an on-disk index that can later be used by TDBDiskIndex.
On-disk indexes produced by TDBIndexer are written in a single, optimised run and tend to be more compact than the ones created by TDBDiskIndex.
virtual Tagcoll::TDBIndexer< ITEM, TAG >::~TDBIndexer | ( | ) | [inline, virtual] |
void TDBIndexer::consumeItem | ( | const ITEM & | item, | |
const OpSet< TAG > & | tags | |||
) | [protected, virtual] |
void TDBIndexer::consumeItems | ( | const OpSet< ITEM > & | items, | |
const OpSet< TAG > & | tags | |||
) | [protected, virtual] |
Process a set of items identically tagged, with their tags.
Reimplemented from Tagcoll::Consumer< ITEM, TAG >.
OpSet< ITEM > TDBIndexer::getItemsHavingTag | ( | const TAG & | tag | ) | const [protected, virtual] |
Get the items which are tagged with at least the tag `tag'.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
OpSet< TAG > TDBIndexer::getTagsOfItem | ( | const ITEM & | item | ) | const [protected, virtual] |
Get the tags attached to an item.
item | The item to query |
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
virtual bool Tagcoll::TDBIndexer< ITEM, TAG >::hasItem | ( | const ITEM & | item | ) | const [inline, virtual] |
virtual bool Tagcoll::TDBIndexer< ITEM, TAG >::hasTag | ( | const TAG & | tag | ) | const [inline, virtual] |
Check if the collection contains a tag.
tag | The tag to look for |
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >.
OpSet< ITEM > TDBIndexer::getTaggedItems | ( | ) | const [virtual] |
Get the set of all the items that have tags according to this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
OpSet< TAG > TDBIndexer::getAllTags | ( | ) | const [virtual] |
Get the set of all the tags in this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
void TDBIndexer::output | ( | Consumer< ITEM, TAG > & | consumer | ) | const [virtual] |
Output all the contents of the collection to a Consumer.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
void TDBIndexer::applyChange | ( | const PatchList< ITEM, TAG > & | change | ) | [virtual] |
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 >.
std::map<ITEM, OpSet<TAG> > Tagcoll::TDBIndexer< ITEM, TAG >::items [protected] |
std::map<TAG, OpSet<ITEM> > Tagcoll::TDBIndexer< ITEM, TAG >::tags [protected] |