nds2-client - ClientUser
0.16.8
|
A connection to the NDS/NDS2 server. More...
#include <nds.hh>
Classes | |
class | already_closed_error |
Signal that the connection has already been closed. More... | |
class | daq_error |
an error state was returned by the NDS server More... | |
class | error |
Base class for NDS errors. More... | |
class | minute_trend_error |
Signals that a minute trend has been requested but the start/stop times are not divisible by 60. More... | |
class | transfer_busy_error |
A transfer is already in progress. More... | |
class | unexpected_channels_received_error |
An unexpected channel or data was received. More... | |
Public Types | |
enum | protocol_type { PROTOCOL_INVALID = -1, PROTOCOL_ONE = 1, PROTOCOL_TWO = 2, PROTOCOL_TRY = 3 } |
Connection constants. More... | |
typedef std::string | host_type |
Host name type. | |
typedef int | port_type |
Host port number type. | |
typedef size_t | count_type |
Generic count time. | |
typedef channel::channel_names_type | channel_names_type |
A list of channel names. | |
Public Member Functions | |
DLL_EXPORT | connection ()=delete |
Default constructor. | |
DLL_EXPORT | connection (const host_type &host, port_type port=DEFAULT_PORT, protocol_type protocol=PROTOCOL_TRY) |
Create a connection. More... | |
DLL_EXPORT | connection (const NDS::parameters ¶ms) |
Create a connection object, initialized with parameters from a parameters object. More... | |
connection (const NDS::connection &other)=delete | |
Connection objects are not copyable. | |
connection & | operator= (const NDS::connection &other)=delete |
Connection objects are not copyable. | |
DLL_EXPORT | ~connection () |
Destroy the connection. | |
DLL_EXPORT void | close () |
Close the connection. | |
DLL_EXPORT count_type | count_channels (const channel_predicate_object &pred) |
Return the count of channels matching the given predicate. More... | |
DLL_EXPORT channels_type | find_channels (const channel_predicate_object &pred) |
Retrieve a list of channels. More... | |
DLL_EXPORT epochs_type | get_epochs () |
Return a list of epochs. More... | |
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. More... | |
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. More... | |
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. More... | |
DLL_EXPORT NDS::parameters & | parameters () const |
Return the parameter/configuration object. More... | |
DLL_EXPORT const channel::hash_type & | hash () const |
Return the NDS2 channel hash. More... | |
DLL_EXPORT NDS::data_iterable | iterate (NDS::request_period period, const channel_names_type &channel_names) |
Retreive data in segments. More... | |
DLL_EXPORT bool | request_in_progress () const |
Query the connection to see if a request is in progress. More... | |
Static Public Attributes | |
static const port_type | DEFAULT_PORT |
Default NDS2 port number. | |
A connection to the NDS/NDS2 server.
The connection object is used to interact with the NDS (v1 or v2) servers to retrieve data and channel lists. Connnection objects have a few main categories of methods:
|
explicit |
Create a connection.
[in] | host | Server to connect to |
[in] | port | Port number to connect to (defaults to DEFAULT_PORT) |
[in] | protocol | Protocol version to use (defaults to PROTOCOL_TRY) |
|
explicit |
Create a connection object, initialized with parameters from a parameters object.
[in] | params | The parameter/configuration object used to specify the connection parameters and options. |
bool NDS::abi_0::connection::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.
Given a start/stop time and a channel list check to see if a fetch request would suceed. This will return failure if there is a gap in the data, or if the data is on tape.
[in] | gps_start | Start time of request |
[in] | gps_stop | Stop time of request |
[in] | channel_names | The channel list |
connection::count_type NDS::abi_0::connection::count_channels | ( | const channel_predicate_object & | pred | ) |
Return the count of channels matching the given predicate.
Return a count of channels that are available form this connection within the given contstraints.
[in] | pred | A ChannelPredicate object holding the constraints to impose on the search. |
buffers_type NDS::abi_0::connection::fetch | ( | buffer::gps_second_type | gps_start, |
buffer::gps_second_type | gps_stop, | ||
const channel_names_type & | channel_names | ||
) |
Retreive data from the server.
Given a start/stop time and a channel list retrieve the associated data.
[in] | gps_start | Start time of request |
[in] | gps_stop | Stop time of request |
[in] | channel_names | The channel list |
channels_type NDS::abi_0::connection::find_channels | ( | const channel_predicate_object & | pred | ) |
Retrieve a list of channels.
Return a list of channels that are available form this connection within the given contstraints.
[in] | pred | A ChannelPredicate object holding the constraints to impose on the search. |
availability_list_type NDS::abi_0::connection::get_availability | ( | const epoch & | time_span, |
const channel_names_type & | channel_names | ||
) |
Given a list of channels return their availability over the current epoch.
[in] | time_span | A epoch limiting start/stop time of the availability check |
[in] | channel_names | A list of channels to return availability for. |
epochs_type NDS::abi_0::connection::get_epochs | ( | ) |
Return a list of epochs.
NDS2 has the concept of epochs. A epoch may be set on a connection to constrain all data and channel requests to a given time frame. This call returns the currently available epochs.
const channel::hash_type & NDS::abi_0::connection::hash | ( | ) | const |
Return the NDS2 channel hash.
NDSv2 server can return a hash of its internal channel list. This hash value can be used by a client to determine if the channel list has updated.
DLL_EXPORT NDS::data_iterable NDS::abi_0::connection::iterate | ( | NDS::request_period | period, |
const channel_names_type & | channel_names | ||
) |
Retreive data in segments.
Setup an iterative data retrieval process. This function initiates the request for data in range specified by period, but does not actually retreive the data. Instead it returns a data_stream object which manages the data iteration request.
[in] | period | The range of data to return. It may be any range that a request_period may express, including unbounded live data, bounded live data, or bounded historical data. |
[in] | channel_names | The list of channels to retrieve data for. |
parameters & NDS::abi_0::connection::parameters | ( | ) | const |
Return the parameter/configuration object.
bool NDS::abi_0::connection::request_in_progress | ( | ) | const |
Query the connection to see if a request is in progress.