#include <IntDiskIndex.h>
Inheritance diagram for Tagcoll::IntDiskIndex< ITEM, TAG >:


Public Member Functions | |
| IntDiskIndex () | |
| Create a new IntDiskIndex. | |
| IntDiskIndex (const MasterMMapIndex &master, int pkgindex, int tagindex, const Converter< ITEM, int > *fromitem, const Converter< TAG, int > *fromtag, const Converter< int, ITEM > *toitem, const Converter< int, TAG > *totag) | |
| virtual | ~IntDiskIndex () |
| void | init (const MasterMMapIndex &master, int pkgindex, int tagindex, const Converter< ITEM, int > *fromitem, const Converter< TAG, int > *fromtag, const Converter< int, ITEM > *toitem, const Converter< int, TAG > *totag) |
| void | init (const MasterMMapIndex &master, int pkgindex, int tagindex) |
| 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 OpSet< TAG > | getCompanionTags (const OpSet< TAG > &tags) const |
| Get the set of all tags in this collection that appear in tagsets containing `tags'. | |
| virtual void | output (Consumer< ITEM, TAG > &consumer) const |
| Output all the contents of the collection to a Consumer. | |
Protected Member Functions | |
| int | fromitem (const ITEM &tag) const |
| int | fromtag (const TAG &tag) const |
| ITEM | toitem (const int &tag) const |
| TAG | totag (const int &tag) const |
| virtual OpSet< ITEM > | getItemsHavingTag (const TAG &tag) const |
| Get the items which are tagged with at least the tag `tag'. | |
| virtual OpSet< ITEM > | getItemsHavingTags (const OpSet< TAG > &tags) const |
| Get the items which are tagged with at least the tags `tags'. | |
| virtual OpSet< TAG > | getTagsOfItem (const ITEM &item) const |
| Get the tags attached to an item. | |
| virtual OpSet< TAG > | getTagsOfItems (const OpSet< ITEM > &items) const |
| Get all the tags attached to the items in a set. | |
Protected Attributes | |
| IntIndex | pkgidx |
| IntIndex | tagidx |
| const Converter< ITEM, int > * | m_fromitem |
| const Converter< TAG, int > * | m_fromtag |
| const Converter< int, ITEM > * | m_toitem |
| const Converter< int, TAG > * | m_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.
| Tagcoll::IntDiskIndex< ITEM, TAG >::IntDiskIndex | ( | ) | [inline] |
Create a new IntDiskIndex.
| filename | The file name of the package index | |
| tagidx | The file name of the tag index | |
| fromitem,fromtag,toitem,totag | The Converter-s used to convert ITEMS and TAGS to and from strings. If 0 is passed, this TDBDiskIndex will only be able to work with string items and string tags. | |
| write | Set to false if the index should be opened in read-only mode. If opened in read-only mode, all non-const methods of this class will throw an exception if invoked. It defaults to true. |
| Tagcoll::IntDiskIndex< ITEM, TAG >::IntDiskIndex | ( | const MasterMMapIndex & | master, | |
| int | pkgindex, | |||
| int | tagindex, | |||
| const Converter< ITEM, int > * | fromitem, | |||
| const Converter< TAG, int > * | fromtag, | |||
| const Converter< int, ITEM > * | toitem, | |||
| const Converter< int, TAG > * | totag | |||
| ) | [inline] |
| virtual Tagcoll::IntDiskIndex< ITEM, TAG >::~IntDiskIndex | ( | ) | [inline, virtual] |
| int Tagcoll::IntDiskIndex< ITEM, TAG >::fromitem | ( | const ITEM & | tag | ) | const [inline, protected] |
| int Tagcoll::IntDiskIndex< ITEM, TAG >::fromtag | ( | const TAG & | tag | ) | const [inline, protected] |
| ITEM Tagcoll::IntDiskIndex< ITEM, TAG >::toitem | ( | const int & | tag | ) | const [inline, protected] |
| TAG Tagcoll::IntDiskIndex< ITEM, TAG >::totag | ( | const int & | tag | ) | const [inline, protected] |
| OpSet< ITEM > IntDiskIndex::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< ITEM > IntDiskIndex::getItemsHavingTags | ( | const OpSet< TAG > & | tags | ) | const [protected, virtual] |
Get the items which are tagged with at least the tags `tags'.
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >.
| OpSet< TAG > IntDiskIndex::getTagsOfItem | ( | const ITEM & | item | ) | const [protected, virtual] |
Get the tags attached to an item.
| item | The item to query |
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
| OpSet< TAG > IntDiskIndex::getTagsOfItems | ( | const OpSet< ITEM > & | items | ) | const [protected, virtual] |
Get all the tags attached to the items in a set.
| items | The items to query |
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >.
| void Tagcoll::IntDiskIndex< ITEM, TAG >::init | ( | const MasterMMapIndex & | master, | |
| int | pkgindex, | |||
| int | tagindex, | |||
| const Converter< ITEM, int > * | fromitem, | |||
| const Converter< TAG, int > * | fromtag, | |||
| const Converter< int, ITEM > * | toitem, | |||
| const Converter< int, TAG > * | totag | |||
| ) | [inline] |
| void Tagcoll::IntDiskIndex< ITEM, TAG >::init | ( | const MasterMMapIndex & | master, | |
| int | pkgindex, | |||
| int | tagindex | |||
| ) | [inline] |
| virtual bool Tagcoll::IntDiskIndex< 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 > IntDiskIndex::getTaggedItems | ( | ) | const [virtual] |
Get the set of all the items that have tags according to this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
| OpSet< TAG > IntDiskIndex::getAllTags | ( | ) | const [virtual] |
Get the set of all the tags in this collection.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
| virtual int Tagcoll::IntDiskIndex< ITEM, TAG >::getCardinality | ( | const TAG & | tag | ) | const [inline, virtual] |
Get the cardinality of tag `tag' (that is, the number of items who have it).
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >.
| OpSet< TAG > IntDiskIndex::getCompanionTags | ( | const OpSet< TAG > & | tags | ) | const [virtual] |
Get the set of all tags in this collection that appear in tagsets containing `tags'.
Example:
void refineSelection(const OpSet<Tag>& selection) { OpSet<Tag> extraTags = collection.getCompanionTags(selection); tagMenu.setAvailableOptions(extraTags); }
Reimplemented from Tagcoll::ReadonlyCollection< ITEM, TAG >.
| void IntDiskIndex::output | ( | Consumer< ITEM, TAG > & | consumer | ) | const [virtual] |
Output all the contents of the collection to a Consumer.
Implements Tagcoll::ReadonlyCollection< ITEM, TAG >.
IntIndex Tagcoll::IntDiskIndex< ITEM, TAG >::pkgidx [protected] |
IntIndex Tagcoll::IntDiskIndex< ITEM, TAG >::tagidx [protected] |
const Converter<ITEM, int>* Tagcoll::IntDiskIndex< ITEM, TAG >::m_fromitem [protected] |
const Converter<TAG, int>* Tagcoll::IntDiskIndex< ITEM, TAG >::m_fromtag [protected] |
const Converter<int, ITEM>* Tagcoll::IntDiskIndex< ITEM, TAG >::m_toitem [protected] |
const Converter<int, TAG>* Tagcoll::IntDiskIndex< ITEM, TAG >::m_totag [protected] |
1.5.1