ocarina/include/index.h
Anna Schumaker cac0aee2e6 database: Insert through a const reference
This should offer a performance increase since the item to insert will
only be copied if it is not already in the database.

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
2014-04-09 21:10:08 -04:00

39 lines
668 B
C++

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_INDEX_H
#define OCARINA_INDEX_H
#include <database.h>
#include <set>
#include <string>
class IndexEntry : public DatabaseEntry {
public:
std::string key;
std::set<unsigned int> values;
IndexEntry();
IndexEntry(const std::string &);
const std::string primary_key() const;
void insert(unsigned int);
void remove(unsigned int);
void write(File &);
void read(File &);
};
class Index : public Database<IndexEntry> {
public:
Index(const std::string &, bool);
void insert(const std::string &, unsigned int);
void remove(const std::string &, unsigned int);
};
#endif /* OCARINA_DATABASE_H */