nds2-client - Developer 0.16.7
Loading...
Searching...
No Matches
nds_channel_selection.hh
Go to the documentation of this file.
1//
2// Created by jonathan.hanks on 9/6/18.
3//
4#ifndef NDS2_CLIENT_NDS_CHANNEL_SELECTION_HH
5#define NDS2_CLIENT_NDS_CHANNEL_SELECTION_HH
6
7#include <memory>
8
9#include "nds_channel.hh"
11
12namespace NDS
13{
14 namespace detail
15 {
16 // Given a channel name return the channel name with any [ms]-trend
17 // component stripped out
19 std::string filter_trend_from_string( const std::string& input );
20
21 // Given a channel return the channel with the name stripped of
22 // [ms]-trend.
23 //
24 // On NDS1 it can be necessary to strip the 's-trend', 'm-trend'
25 // text from a channel name to make the names match between
26 // channel listing and fetch/iterate
28 channel strip_trend_from_name( const channel& chan );
29
30 // Given a channel name, try to determine which NDS::channel
31 // it corresponds to.
33 {
34 public:
44
45 // Initialize the channel_selector with a connection object
47 explicit channel_selector( std::shared_ptr< conn_p_type > conn )
48 : conn_( std::move( conn ) )
49 {
50 }
52 channel_selector( const channel_selector& other ) = default;
54 channel_selector( channel_selector&& other ) = default;
55
57 operator=( const channel_selector& other ) = default;
59
60 // Given a channel name return a channel object that it maps to, or
61 // raise a daq_error
62 // if no good match could be found.
63 // Do not use for online channels
65 channel operator( )(
66 const std::string& name,
68
69 private:
70 // \brief Given a list of channels return a vector of pointers
71 // into the input list that are filtered to be compatible with
72 // the given channel_type_mask. Then sort the list.
73 // \note You must ensure that the input is around as long as the
74 // output array is needed, as non-owning pointers are returned
75 std::vector< const NDS::channel* > filter_and_sort_channel_list(
76 NDS::channels_type& input,
77 NDS::channel::channel_type channel_type_mask );
78
79 // \brief Given a list of possible channels, downselect to one
80 // @param input List of channels
81 // @param name The channel name
82 // @param policy Is any match good, or does it need to be unambigous
83 // @notes may throw if the policy can not be satisfied
85 const std::string& name,
86 NDS::channel::channel_type channel_type_mask,
87 selection_method policy );
88
89 std::shared_ptr< conn_p_type > conn_;
90 };
91 }
92}
93
94#endif // NDS2_CLIENT_NDS_CHANNEL_SELECTION_HH
#define DLL_EXPORT
Definition channel.h:12
Represents a LIGO data channel.
Definition nds_channel.hh:34
Definition nds_channel_selection.hh:33
std::vector< const NDS::channel * > filter_and_sort_channel_list(NDS::channels_type &input, NDS::channel::channel_type channel_type_mask)
Definition nds_channel_selection.cc:141
DLL_EXPORT channel_selector(channel_selector &&other)=default
DLL_EXPORT channel_selector(std::shared_ptr< conn_p_type > conn)
Definition nds_channel_selection.hh:47
selection_method
Definition nds_channel_selection.hh:36
channel downselect(NDS::channels_type &input, const std::string &name, NDS::channel::channel_type channel_type_mask, selection_method policy)
Definition nds_channel_selection.cc:165
channel_selector & operator=(channel_selector &&other)=default
DLL_EXPORT channel_selector(const channel_selector &other)=default
channel_selector & operator=(const channel_selector &other)=default
std::shared_ptr< conn_p_type > conn_
Definition nds_channel_selection.hh:89
std::vector< channel > channels_type
Definition nds_channel.hh:298
std::string filter_trend_from_string(const std::string &input)
Definition nds_channel_selection.cc:18
channel strip_trend_from_name(const channel &chan)
Definition nds_channel_selection.cc:58
The NDS client namespace.
Definition debug_stream.cc:18