Falcon
Loading...
Searching...
No Matches
ChannelList< T > Class Template Reference

Public Member Functions

std::vector< std::pair< T, std::string > > get_channels () const
std::vector< T > get_channel_numbers () const
std::vector< std::string > get_labels () const
void add_channels (T channel, std::string label="")
void add_channels (std::vector< T > channels, std::vector< std::string > labels={})
void add_channels (T range_min, T range_max)
void remove_channels (double range_min, double range_max)
void remove_channels (std::vector< T > channels)
void remove_channels (std::vector< std::string > labels)
auto size () const
T & operator[] (size_t index)
const T & operator[] (size_t index) const
auto begin () const
auto end () const
auto begin ()
auto end ()
std::string to_string () const
 to_string print the channel list in a yaml format understood by the options lib.
bool all_in_range (T range_min, T range_max) const
 all_in_range check if all the column numbers in this collection are contained in the range given in input.
bool is_subset (std::vector< T > channels_vec) const
 is_subset check if the column numbers in this collection is a subset of the column numbers list given in input.
bool is_subset (std::vector< std::string > labels_vec) const
 is_subset check if the labels in this collection is a subset of the labels list given in input.
bool is_sorted (bool by_label=false) const
 is_sorted check without modifying the collection if it is sorted by column numbers or by labels
bool is_unique () const
 is_unique check without modifying the collection if there is an unique set of column numbers.
void sort (bool by_label=false)
 sort the collection of pair (column index, label)
void unique ()
 unique - Remove duplicates to keep only an unique set of channel numbers. Because of the way sort works, the first label in alphabetical order is the one keep.

Member Function Documentation

◆ all_in_range()

template<typename T>
bool ChannelList< T >::all_in_range ( T range_min,
T range_max ) const
inline

all_in_range check if all the column numbers in this collection are contained in the range given in input.

Parameters
range_min
range_max
Returns

◆ is_sorted()

template<typename T>
bool ChannelList< T >::is_sorted ( bool by_label = false) const
inline

is_sorted check without modifying the collection if it is sorted by column numbers or by labels

Parameters
by_labeloptional, switch the sorting test to sort by labels instead of column numbers
Returns

◆ is_subset() [1/2]

template<typename T>
bool ChannelList< T >::is_subset ( std::vector< std::string > labels_vec) const
inline

is_subset check if the labels in this collection is a subset of the labels list given in input.

Parameters
labels_vec
Returns

◆ is_subset() [2/2]

template<typename T>
bool ChannelList< T >::is_subset ( std::vector< T > channels_vec) const
inline

is_subset check if the column numbers in this collection is a subset of the column numbers list given in input.

Parameters
channels_vec
Returns

◆ is_unique()

template<typename T>
bool ChannelList< T >::is_unique ( ) const
inline

is_unique check without modifying the collection if there is an unique set of column numbers.

Returns

◆ sort()

template<typename T>
void ChannelList< T >::sort ( bool by_label = false)
inline

sort the collection of pair (column index, label)

std::pair has a sort implementation by default - it sorts automatically by the first element (channel number) and then in case of equality by the second element (label).

Parameters
by_labeloptional, optional, switch the sorting to sort by labels instead of column numbers

◆ to_string()

template<typename T>
std::string ChannelList< T >::to_string ( ) const
inline

to_string print the channel list in a yaml format understood by the options lib.

Note
labels are not added in this format.
Returns

◆ unique()

template<typename T>
void ChannelList< T >::unique ( )
inline

unique - Remove duplicates to keep only an unique set of channel numbers. Because of the way sort works, the first label in alphabetical order is the one keep.

No need to have an unique implementation for the labels as we cannot from the start have duplicate labels.


The documentation for this class was generated from the following file:
  • extensions/falcon-fklab-extensions/lib/recording_utilities/channellist.hpp