25#ifndef SWIG__COMMON__NDS_CONNECTION_HH
26#define SWIG__COMMON__NDS_CONNECTION_HH
128 class parameter_block;
129 class parameter_accessor;
131 inline namespace abi_0
138 NDS::channel::sample_rate_type
140 NDS::channel::sample_rate_type
149 NDS::channel::sample_rate_type Max )
216 NDS::channel::channel_type
221 return NDS::channel::DEFAULT_CHANNEL_MASK;
223 NDS::channel::channel_type result;
226 result = ( NDS::channel::channel_type )( result | val );
247 NDS::channel::data_type
252 return NDS::channel::DEFAULT_DATA_MASK;
254 NDS::channel::data_type result;
255 for (
const NDS::channel::data_type val :
data_types_ )
257 result = ( NDS::channel::data_type )( result | val );
274 NDS::channel::sample_rate_type
282 NDS::channel::sample_rate_type
298 NDS::buffer::gps_second_type
306 NDS::buffer::gps_second_type
320 glob_ = std::move( val );
343 set( NDS::channel::channel_type val )
347 if ( (
int)entry | (int)val )
374 set( NDS::channel::data_type val )
378 if ( (
int)entry | (int)val )
442 NDS::buffer::gps_second_type
gps_stop )
464 template <
typename T >
471 template <
typename T,
typename... Args >
491 template <
typename... Args >
492 channel_predicate_object
520 class error :
public std::runtime_error
524 error(
const std::string& What,
int ErrNo = 0 );
579 const std::string& additional_information );
582 daq_error(
int daq_code,
const char* additional_information );
598 const char* extra =
nullptr );
918 std::shared_ptr< detail::conn_p_type >
p_;
1090 const std::string& value );
1101 std::unique_ptr< detail::parameter_block >
p_;
#define DLL_EXPORT
Definition channel.h:12
A list of availabilitys (channels, availability segments)
Definition nds_availability.hh:127
A buffer holds the data contents of a channel.
Definition nds_buffer.hh:28
long gps_second_type
Type second portion of a gps time.
Definition nds_buffer.hh:33
The hash_type represents a channel hash. The channel hash is an hash of the NDS2 channel list....
Definition nds_channel.hh:72
A predicate object to be used in limiting the number of channels returned when searching for channels...
Definition nds_connection.hh:169
NDS::buffer::gps_second_type gps_start() const
Return the gps start time that constrains this query. Note this is available via the time_span method...
Definition nds_connection.hh:299
const channel_type_list channel_types() const
return a container of distinct channel types that are to be matched (defaults to an expansion of NDS:...
Definition nds_connection.hh:203
NDS::channel::channel_type channel_type_mask() const
return a compact mask of the channel types selected. this is mainly provided for the SWIG language bi...
Definition nds_connection.hh:217
NDS::channel::data_type data_type_mask() const
return a compact mask of the data types selected. this is mainly provided for the SWIG language bindi...
Definition nds_connection.hh:248
void set_channel_type_mask(NDS::channel::channel_type val)
Set the channel type mask.
Definition nds_connection.hh:361
void set_glob(std::string val)
Set the glob string to match on.
Definition nds_connection.hh:330
NDS::channel::sample_rate_type min_sample_rate() const
return the minimum sample rate to be selected. This is also available through the sample_rates method...
Definition nds_connection.hh:275
std::vector< NDS::channel::channel_type > channel_type_list
Definition nds_connection.hh:171
channel_predicate_object & operator=(const channel_predicate_object &other)=default
channel_predicate_object(const channel_predicate_object &other)=default
epoch epoch_
Definition nds_connection.hh:452
NDS::channel::sample_rate_type max_sample_rate() const
return the maximum sample rate to be selected. This is also available through the sample_rates method...
Definition nds_connection.hh:283
void set_timespan(NDS::buffer::gps_second_type gps_start, NDS::buffer::gps_second_type gps_stop)
Set the [gps_start, gps_stop) time range that limits this query.
Definition nds_connection.hh:441
channel_predicate_object()
Definition nds_connection.hh:174
channel_predicate_object & set(NDS::channel::data_type val)
Set a data type to search for.
Definition nds_connection.hh:374
channel_predicate_object & operator=(channel_predicate_object &&other)=default
DLL_EXPORT static const channel_type_list all_channel_types
Definition nds_connection.hh:450
NDS::buffer::gps_second_type gps_stop() const
Return the gps stop time that constrains this query. Note this is available via the time_span method.
Definition nds_connection.hh:307
void set_data_type_mask(NDS::channel::data_type val)
Set the data type mask.
Definition nds_connection.hh:392
frequency_range sample_rates_
Definition nds_connection.hh:456
DLL_EXPORT static const data_type_list all_data_types
Definition nds_connection.hh:449
channel_predicate_object & set(NDS::channel::channel_type val)
Set a channel type to search for.
Definition nds_connection.hh:343
channel_predicate_object(channel_predicate_object &&other)=default
channel_predicate_object & set(epoch val)
Definition nds_connection.hh:428
const data_type_list data_types() const
return a container of distinct data types that are to be matched (defaults to an expansion of NDS::ch...
Definition nds_connection.hh:235
channel_predicate_object & set(frequency_range val)
Definition nds_connection.hh:403
channel_predicate_object & set(std::string val)
Set the glob string used in channel matching.
Definition nds_connection.hh:318
const frequency_range & sample_rates() const
return the range of sample rates that are to be allowed in the query. defaults to (NDS::channel::MIN_...
Definition nds_connection.hh:267
data_type_list data_types_
Definition nds_connection.hh:455
const epoch & time_span() const
return the timespan/epoch that should constrain the query defaults to [0, NDS::buffer::GPS_INF)
Definition nds_connection.hh:291
std::string glob() const
Return the channel name glob (defaults to "*")
Definition nds_connection.hh:194
void set_frequency_range(NDS::channel::sample_rate_type min_sample_rate, NDS::channel::sample_rate_type max_sample_rate)
Set the [min, max) frequency range that limits this query.
Definition nds_connection.hh:415
std::vector< NDS::channel::data_type > data_type_list
Definition nds_connection.hh:172
channel_type_list channel_types_
Definition nds_connection.hh:454
std::string glob_
Definition nds_connection.hh:453
Represents a LIGO data channel.
Definition nds_channel.hh:34
std::vector< std::string > channel_names_type
A vector of channel names.
Definition nds_channel.hh:104
Signal that the connection has already been closed.
Definition nds_connection.hh:531
DLL_EXPORT already_closed_error()
Definition nds_connection.cc:338
an error state was returned by the NDS server
Definition nds_connection.hh:572
int index
Definition nds_connection.hh:592
int error_code
Definition nds_connection.hh:593
static int counter_
Definition nds_connection.hh:595
DLL_EXPORT int DAQCode() const
Definition nds_connection.hh:586
static std::string format(int DAQCode, const char *extra=nullptr)
Definition nds_connection.cc:397
Base class for NDS errors.
Definition nds_connection.hh:521
Signals that a minute trend has been requested but the start/stop times are not divisible by 60.
Definition nds_connection.hh:542
DLL_EXPORT minute_trend_error()
Definition nds_connection.cc:346
A transfer is already in progress.
Definition nds_connection.hh:552
DLL_EXPORT transfer_busy_error()
Definition nds_connection.cc:356
An unexpected channel or data was received.
Definition nds_connection.hh:562
DLL_EXPORT unexpected_channels_received_error()
Definition nds_connection.cc:365
A connection to the NDS/NDS2 server.
Definition nds_connection.hh:515
DLL_EXPORT bool request_in_progress() const
Query the connection to see if a request is in progress.
Definition nds_connection.cc:318
DLL_EXPORT NDS::data_iterable iterate(NDS::request_period period, const channel_names_type &channel_names)
Retreive data in segments.
DLL_EXPORT ~connection()
Destroy the connection.
DLL_EXPORT const channel::hash_type & hash() const
Return the NDS2 channel hash.
Definition nds_connection.cc:290
DLL_EXPORT void close()
Close the connection.
Definition nds_connection.cc:216
DLL_EXPORT bool check(buffer::gps_second_type gps_start, buffer::gps_second_type gps_stop, const channel_names_type &channel_names)
Check to see if data is avaiable.
Definition nds_connection.cc:230
protocol_type
Connection constants.
Definition nds_connection.hh:605
@ PROTOCOL_TRY
Autodetect server protocol.
Definition nds_connection.hh:609
@ PROTOCOL_TWO
Connect with NDS2 protocol.
Definition nds_connection.hh:608
@ PROTOCOL_ONE
Connect with NDS1 protocol.
Definition nds_connection.hh:607
@ PROTOCOL_INVALID
Unknown or invalid connection.
Definition nds_connection.hh:606
size_t count_type
Generic count time.
Definition nds_connection.hh:614
DLL_EXPORT availability_list_type get_availability(const epoch &time_span, const channel_names_type &channel_names)
Given a list of channels return their availability over the current epoch.
Definition nds_connection.cc:222
DLL_EXPORT count_type count_channels(const channel_predicate_object &pred)
Return the count of channels matching the given predicate.
Definition nds_connection.cc:250
static const port_type DEFAULT_PORT
Default NDS2 port number.
Definition nds_connection.hh:622
int port_type
Host port number type.
Definition nds_connection.hh:613
std::vector< std::string > parameters_type
Definition nds_connection.hh:620
DLL_EXPORT NDS::parameters & parameters() const
Return the parameter/configuration object.
Definition nds_connection.cc:284
DLL_EXPORT buffers_type fetch(buffer::gps_second_type gps_start, buffer::gps_second_type gps_stop, const channel_names_type &channel_names)
Retreive data from the server.
Definition nds_connection.cc:240
channel::channel_names_type channel_names_type
A list of channel names.
Definition nds_connection.hh:619
std::shared_ptr< detail::conn_p_type > p_
Definition nds_connection.hh:918
std::string host_type
Host name type.
Definition nds_connection.hh:612
connection(const NDS::connection &other)=delete
Connection objects are not copyable.
DLL_EXPORT connection()=delete
Default constructor.
DLL_EXPORT channels_type find_channels(const channel_predicate_object &pred)
Retrieve a list of channels.
Definition nds_connection.cc:272
DLL_EXPORT epochs_type get_epochs()
Return a list of epochs.
Definition nds_connection.cc:298
connection & operator=(const NDS::connection &other)=delete
Connection objects are not copyable.
The data_iterable manages streaming data from an NDS::connection.
Definition nds_data_iterator.hh:263
Definition nds_epoch.hh:17
buffer::gps_second_type gps_start
Definition nds_epoch.hh:20
buffer::gps_second_type gps_stop
Definition nds_epoch.hh:21
The parameters class holds the configuration for a connection. This includes gap handling strategy an...
Definition nds_connection.hh:930
DLL_EXPORT connection::port_type port() const
Return the port number that is currently connected/configured.
Definition nds_connection.cc:126
DLL_EXPORT connection::parameters_type parameter_list() const
Return a list of supported parameters.
Definition nds_connection.cc:150
DLL_EXPORT parameters()
Definition nds_connection.cc:83
DLL_EXPORT std::string get(const std::string &key) const
Retreive the current parameter setting on a connection.
Definition nds_connection.cc:138
DLL_EXPORT connection::host_type host() const
Return the host that is currently connected/configured.
Definition nds_connection.cc:120
DLL_EXPORT bool set(const std::string &key, const std::string &value)
Change the default behavior of the connection.
Definition nds_connection.cc:144
std::unique_ptr< detail::parameter_block > p_
Definition nds_connection.hh:1101
DLL_EXPORT parameters(const connection::host_type &host, connection::port_type port=connection::DEFAULT_PORT, connection::protocol_type protocol=connection::PROTOCOL_TRY)
DLL_EXPORT connection::protocol_type protocol() const
Return the protocol version configured/in use.
Definition nds_connection.cc:132
DLL_EXPORT parameters & operator=(parameters &&other) noexcept
DLL_EXPORT parameters & operator=(const parameters &other)
Definition nds_connection.cc:106
DLL_EXPORT parameters(parameters &&other) noexcept
A parameter_accessor allows internal code to access the detail::parameter_block in a NDS::connection:...
Definition nds_parameter_block.hh:178
std::vector< buffer > buffers_type
Definition nds_buffer.hh:356
std::ostream & operator<<(std::ostream &os, const segment &obj)
Definition nds_availability.cc:72
std::vector< channel > channels_type
Definition nds_channel.hh:298
void build_channel_predicate(channel_predicate_object &pred)
Definition nds_connection.hh:460
std::vector< epoch > epochs_type
Definition nds_epoch.hh:56
channel_predicate_object channel_predicate(Args... args)
Definition nds_connection.hh:493
The NDS client namespace.
Definition debug_stream.cc:18
A simple range for sample rates.
Definition nds_connection.hh:137
frequency_range(const frequency_range &other)=default
frequency_range()
The maximum frequency in this range.
Definition nds_connection.hh:143
frequency_range(NDS::channel::sample_rate_type Min, NDS::channel::sample_rate_type Max)
Definition nds_connection.hh:148
NDS::channel::sample_rate_type maximum
The minimum frequency in this range.
Definition nds_connection.hh:141
frequency_range & operator=(const frequency_range &other)=default
NDS::channel::sample_rate_type minimum
Definition nds_connection.hh:139
This represents a [start, stop) time with an optional data stride.
Definition nds_data_iterator.hh:38