File index_vector.hpp

class IIndexVector
#include <index_vector.hpp>

Defines an interface for all classes that provide random access to indices.

Subclassed by CompleteIndexVector, IPrediction, PartialIndexVector

Public Types

using PartialIndexVectorVisitor = std::function<void(const PartialIndexVector&)>

A visitor function for handling objects of the type PartialIndexVector.

using CompleteIndexVectorVisitor = std::function<void(const CompleteIndexVector&)>

A visitor function for handling objects of the type CompleteIndexVector.

Public Functions

inline virtual ~IIndexVector()
virtual uint32 getNumElements() const = 0

Returns the number of indices.

Returns:

The number of indices

virtual bool isPartial() const = 0

Returns whether the indices are partial, i.e., some indices in the range [0, getNumElements()) are missing, or not.

Returns:

True, if the indices are partial, false otherwise

virtual uint32 getIndex(uint32 pos) const = 0

Returns the index at a specific position.

Parameters:

pos – The position of the index. Must be in [0, getNumElements())

Returns:

The index at the given position

virtual void visit(PartialIndexVectorVisitor partialIndexVectorVisitor, CompleteIndexVectorVisitor completeIndexVectorVisitor) const = 0

Invokes one of the given visitor functions, depending on which one is able to handle this particular type of vector.

Parameters:
  • partialIndexVectorVisitor – The visitor function for handling objects of the type PartialIndexVector

  • completeIndexVectorVisitor – The visitor function for handling objects of the type CompleteIndexVector