Template Class Collection

Class Documentation

template<class ExperimentType>
class Collection

Encapsulates a collection of Experiments and maintains a minimal set of Experiments.

Public Types

using ActiveExperiments = std::map<uint64_t, std::shared_ptr<ExperimentType>>

Public Functions

Collection() = default

Creates an instance of ExperimentType::Collection.

inline Collection(Collection &&other)

Moves an instance of ExperimentType::Collection.

Parameters

other -- The ExperimentType::Collection to move from

inline Collection &operator=(Collection &&other)

Moves an instance of ExperimentType::Collection.

Parameters

other -- The ExperimentType::Collection to move from

Returns

This ExperimentType::Collection after being moved to

inline bool Get(uint64_t callIndex, ExperimentType *pExperiment) const

Gets the ExperimentType at a given call index.

Parameters
  • callIndex -- The call index of the ExperimentType to get

  • pExperiment -- (out) A pointer to the ExperimentType to populate with the contents of the ExperimentType at the given index (optional = nullptr)

Returns

Whether or not there is an ExperimentType at the given call index

inline void Add(uint64_t callIndex, ExperimentType const &experiment)

Adds a given ExperimentType to a given call index.

Parameters
  • callIndex -- The call index at which to set the given ExperimentType

  • experiment -- The ExperimentType to set at the given call index

inline void Add(uint64_t startIndex, uint64_t endIndex, ExperimentType const &experiment)

Adds a given ExperimentType to a given range of call indices.

Parameters
  • startIndex -- The first call index at which to set the ExperimentType

  • endIndex -- The last call index at which to set the ExperimentType

  • experiment -- The ExperimentType to set to the given range of Callables

inline void Remove(uint64_t callIndex)

Removes the Experiments from a given call index.

inline void Remove(uint64_t startIndex, uint64_t endIndex)

Removes the Experiments from a given range of call indices.

Parameters
  • startIndex -- The first call index to remove Experiments from

  • endIndex -- The last call index to remove Experiments from

inline void Clear()

Removes all Experiments from this ExperimentType::Collection.

inline size_t UniqueCount() const

Gets the number of unique Experiments managed by this ExperimentType::Collection.

Returns

The number of unique Experiments managed by this ExperimentType::Collection

inline size_t ActiveCount() const

Gets the number of active Experiments managed by this ExperimentType::Collection.

Returns

The number of active Experiments managed by this ExperimentType::Collection

inline ActiveExperiments::iterator begin()

Gets an iterator to the beginning of this ExperimentType::Collection's active Experiments.

NOTE : The iterator's first member is the call index of the ExperimentType

NOTE : The iterator's second member is a std::shared_ptr<ExperimentType>

Returns

An iterator to the beginning this ExperimentType::Collection's active Experiments

inline ActiveExperiments::iterator end()

Gets an iterator to the end of this ExperimentType::Collection's active Experiments.

NOTE : The iterator's first member is the call index of the ExperimentType

NOTE : The iterator's second member is a std::shared_ptr<ExperimentType>

Returns

An iterator to the end this ExperimentType::Collection's active Experiments