ContainerUtils

Helper functions to handle standard container compliant containers. Supports array, vector, sls::Result etc.

While not a part of the public API we aim not to change this interface too much. However, we don’t give the same strong guarantees as for Detector etc.

Any reoccurring container operation should probably be added to this file.

namespace sls

functions basic implemenation of shared memory

creates/destroys a thread

creates & manages a listener thread each

abstract for setting/getting properties of detector data

constructs the fifo structure

creates & manages a data streamer thread each

creates & manages a data processor thread each

creates/destroys an ARPing child process to arping the interfaces slsReceiver is listening to.

Functions

template<typename T, typename ...Args>
std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(Args&&... args)
template<typename T>
std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(std::size_t n)
template<typename Container>
bool allEqual(const Container &c)

Compare elements in a Container to see if they are all equal

template<typename T>
std::enable_if<std::is_arithmetic<T>::value, bool>::type allEqualWithTol(const std::vector<T> &container, const T tol)

Compare elements but with specified tolerance, useful for floating point values.

template<typename T>
bool allEqualTo(const std::vector<T> &container, const T value)
template<typename T>
bool allEqualToWithTol(const std::vector<T> &container, const T value, const T tol)
template<typename T>
bool anyEqualTo(const std::vector<T> &container, const T value)
template<typename T>
bool anyEqualToWithTol(const std::vector<T> &container, const T value, const T tol)
template<typename T>
std::enable_if<std::is_arithmetic<T>::value, T>::type sum(const std::vector<T> &container)
template<typename T>
T minusOneIfDifferent(const std::vector<T> &container)
inline int minusOneIfDifferent(const std::vector<bool> &container)
template<typename T>
std::vector<T> minusOneIfDifferent(const std::vector<std::vector<T>> &container)
template<typename T, size_t size>
std::array<T, size> minusOneIfDifferent(const std::vector<std::array<T, size>> &container)
template<typename Container>
Container::value_type Squash(const Container &c, typename Container::value_type default_value = {})

Return the first value if all values are equal otherwise return default_value. If no default value is supplied it will be default constructed

template<typename Container>
bool hasDuplicates(Container c)
template<typename T>
std::enable_if<is_container<T>::value, bool>::type removeDuplicates(T &c)