11 #include "IndexBinary.h"
12 #include "WorkerThread.h"
20 template <
typename IndexT>
42 void runOnIndex(std::function<
void(
int, IndexT*)> f);
43 void runOnIndex(std::function<
void(
int,
const IndexT*)> f)
const;
47 void reset()
override;
56 const IndexT*
at(
int i)
const {
return indices_[i].first; }
69 static void waitAndHandleFutures(std::vector<std::future<bool>>& v);
72 std::vector<std::pair<IndexT*, std::unique_ptr<WorkerThread>>>
indices_;
80 #include "ThreadedIndex-inl.h"
void removeIndex(IndexT *index)
bool isThreaded_
Is this index multi-threaded?
const IndexT * at(int i) const
Returns the i-th sub-index (const version)
bool own_fields
Whether or not we are responsible for deleting our contained indices.
void addIndex(IndexT *index)
std::vector< std::pair< IndexT *, std::unique_ptr< WorkerThread > > > indices_
Collection of Index instances, with their managing worker thread if any.
int count() const
Returns the number of sub-indices.
void runOnIndex(std::function< void(int, IndexT *)> f)
virtual void onAfterRemoveIndex(IndexT *index)
Called just after an index is removed.
IndexT * at(int i)
Returns the i-th sub-index.
virtual void onAfterAddIndex(IndexT *index)
Called just after an index is added.