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 )
444 NDS::epoch e(
"", gps_start, 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 );
653 explicit connection(
const NDS::parameters& params );
658 connection(
const NDS::connection& other ) =
delete;
905 iterate( NDS::request_period period,
918 std::shared_ptr< detail::conn_p_type >
p_;
974 DLL_EXPORT std::string
get(
const std::string& key )
const;
1090 const std::string& value );
1101 std::unique_ptr< detail::parameter_block >
p_;
std::vector< std::string > channel_names_type
A vector of channel names.
Definition: nds_channel.hh:104
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
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
channel_predicate_object & operator=(const channel_predicate_object &other)=default
DLL_EXPORT int DAQCode() const
Definition: nds_connection.hh:586
std::vector< std::string > parameters_type
Definition: nds_connection.hh:620
Signal that the connection has already been closed.
Definition: nds_connection.hh:530
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
data_type_list data_types_
Definition: nds_connection.hh:455
A list of availabilitys (channels, availability segments)
Definition: nds_availability.hh:126
DLL_EXPORT ~connection()
Destroy the connection.
Base class for NDS errors.
Definition: nds_connection.hh:520
static const port_type DEFAULT_PORT
Default NDS2 port number.
Definition: nds_connection.hh:622
A buffer holds the data contents of a channel.
Definition: nds_buffer.hh:27
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
DLL_EXPORT void close()
Close the connection.
Definition: nds_connection.cc:216
static std::string format(int DAQCode, const char *extra=nullptr)
Definition: nds_connection.cc:397
Unknown or invalid connection.
Definition: nds_connection.hh:606
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
DLL_EXPORT parameters()
Definition: nds_connection.cc:83
frequency_range & operator=(const frequency_range &other)=default
std::string host_type
Host name type.
Definition: nds_connection.hh:612
int error_code
Definition: nds_connection.hh:593
void set_channel_type_mask(NDS::channel::channel_type val)
Set the channel type mask.
Definition: nds_connection.hh:361
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
frequency_range sample_rates_
Definition: nds_connection.hh:456
A transfer is already in progress.
Definition: nds_connection.hh:551
A predicate object to be used in limiting the number of channels returned when searching for channels...
Definition: nds_connection.hh:168
NDS::channel::sample_rate_type minimum
Definition: nds_connection.hh:139
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
DLL_EXPORT channels_type find_channels(const channel_predicate_object &pred)
Retrieve a list of channels.
Definition: nds_connection.cc:272
void build_channel_predicate(channel_predicate_object &pred)
Definition: nds_connection.hh:460
buffer::gps_second_type gps_stop
Definition: nds_epoch.hh:21
channel_predicate_object & set(std::string val)
Set the glob string used in channel matching.
Definition: nds_connection.hh:318
DLL_EXPORT unexpected_channels_received_error()
Definition: nds_connection.cc:365
channel_type_list channel_types_
Definition: nds_connection.hh:454
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
DLL_EXPORT bool set(const std::string &key, const std::string &value)
Change the default behavior of the connection.
Definition: nds_connection.cc:144
frequency_range()
The maximum frequency in this range.
Definition: nds_connection.hh:143
std::string glob_
Definition: nds_connection.hh:453
Signals that a minute trend has been requested but the start/stop times are not divisible by 60...
Definition: nds_connection.hh:541
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
channel_predicate_object & set(NDS::channel::channel_type val)
Set a channel type to search for.
Definition: nds_connection.hh:343
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
DLL_EXPORT NDS::data_iterable iterate(NDS::request_period period, const channel_names_type &channel_names)
Retreive data in segments.
long gps_second_type
Type second portion of a gps time.
Definition: nds_buffer.hh:33
DLL_EXPORT static const channel_type_list all_channel_types
Definition: nds_connection.hh:450
channel_predicate_object & set(epoch val)
Definition: nds_connection.hh:428
DLL_EXPORT connection::parameters_type parameter_list() const
Return a list of supported parameters.
Definition: nds_connection.cc:150
NDS::channel::sample_rate_type maximum
The minimum frequency in this range.
Definition: nds_connection.hh:141
#define DLL_EXPORT
Definition: channel.h:12
std::vector< NDS::channel::channel_type > channel_type_list
Definition: nds_connection.hh:171
int port_type
Host port number type.
Definition: nds_connection.hh:613
std::string glob() const
Return the channel name glob (defaults to "*")
Definition: nds_connection.hh:194
std::unique_ptr< detail::parameter_block > p_
Definition: nds_connection.hh:1101
DLL_EXPORT parameters & operator=(const parameters &other)
Definition: nds_connection.cc:106
DLL_EXPORT error(const std::string &What, int ErrNo=0)
Definition: nds_connection.cc:326
DLL_EXPORT connection::host_type host() const
Return the host that is currently connected/configured.
Definition: nds_connection.cc:120
A simple range for sample rates.
Definition: nds_connection.hh:136
channel_predicate_object & set(frequency_range val)
Definition: nds_connection.hh:403
Connect with NDS1 protocol.
Definition: nds_connection.hh:607
size_t count_type
Generic count time.
Definition: nds_connection.hh:614
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
DLL_EXPORT daq_error(int daq_code)
Definition: nds_connection.cc:374
an error state was returned by the NDS server
Definition: nds_connection.hh:571
static int counter_
Definition: nds_connection.hh:595
The hash_type represents a channel hash. The channel hash is an hash of the NDS2 channel list...
Definition: nds_channel.hh:71
DLL_EXPORT const channel::hash_type & hash() const
Return the NDS2 channel hash.
Definition: nds_connection.cc:290
An unexpected channel or data was received.
Definition: nds_connection.hh:561
DLL_EXPORT epochs_type get_epochs()
Return a list of epochs.
Definition: nds_connection.cc:298
channel_predicate_object()
Definition: nds_connection.hh:174
DLL_EXPORT NDS::parameters & parameters() const
Return the parameter/configuration object.
Definition: nds_connection.cc:284
DLL_EXPORT bool request_in_progress() const
Query the connection to see if a request is in progress.
Definition: nds_connection.cc:318
channel_predicate_object channel_predicate(Args...args)
Definition: nds_connection.hh:493
channel::channel_names_type channel_names_type
A list of channel names.
Definition: nds_connection.hh:619
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
DLL_EXPORT connection::port_type port() const
Return the port number that is currently connected/configured.
Definition: nds_connection.cc:126
DLL_EXPORT transfer_busy_error()
Definition: nds_connection.cc:356
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
std::vector< epoch > epochs_type
Definition: nds_epoch.hh:56
frequency_range(NDS::channel::sample_rate_type Min, NDS::channel::sample_rate_type Max)
Definition: nds_connection.hh:148
void set_data_type_mask(NDS::channel::data_type val)
Set the data type mask.
Definition: nds_connection.hh:392
channel_predicate_object & set(NDS::channel::data_type val)
Set a data type to search for.
Definition: nds_connection.hh:374
A connection to the NDS/NDS2 server.
Definition: nds_connection.hh:514
std::vector< channel > channels_type
Definition: nds_channel.hh:298
A parameter_accessor allows internal code to access the detail::parameter_block in a NDS::connection:...
Definition: nds_parameter_block.hh:177
DLL_EXPORT static const data_type_list all_data_types
Definition: nds_connection.hh:449
DLL_EXPORT already_closed_error()
Definition: nds_connection.cc:338
Represents a LIGO data channel.
Definition: nds_channel.hh:33
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
epoch epoch_
Definition: nds_connection.hh:452
The parameters class holds the configuration for a connection. This includes gap handling strategy an...
Definition: nds_connection.hh:929
buffer::gps_second_type gps_start
Definition: nds_epoch.hh:20
std::shared_ptr< detail::conn_p_type > p_
Definition: nds_connection.hh:918
std::vector< buffer > buffers_type
Definition: nds_buffer.hh:356
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
Autodetect server protocol.
Definition: nds_connection.hh:609
std::vector< NDS::channel::data_type > data_type_list
Definition: nds_connection.hh:172
protocol_type
Connection constants.
Definition: nds_connection.hh:604
DLL_EXPORT connection::protocol_type protocol() const
Return the protocol version configured/in use.
Definition: nds_connection.cc:132
DLL_EXPORT minute_trend_error()
Definition: nds_connection.cc:346
void set_glob(std::string val)
Set the glob string to match on.
Definition: nds_connection.hh:330
Connect with NDS2 protocol.
Definition: nds_connection.hh:608
int index
Definition: nds_connection.hh:592
std::ostream & operator<<(std::ostream &os, const segment &obj)
Definition: nds_availability.cc:72
DLL_EXPORT connection()=delete
Default constructor.
connection & operator=(const NDS::connection &other)=delete
Connection objects are not copyable.
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
Definition: nds_epoch.hh:16