nds2-client - ClientDeveloper  0.16.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
NDS::abi_0 Namespace Reference

Classes

struct  segment
 An availability segment defines when data is available. More...
 
struct  simple_segment
 A simple [start,stop) range for denoting segments. More...
 
class  simple_segment_list_type
 A list of simple segments. This does not contain the channel name. More...
 
class  simple_availability_list_type
 A list of simple availability lists. More...
 
class  segment_list_type
 A list of detailed segments. This does not contain the channel name. More...
 
struct  availability
 Availability information for a channel. More...
 
class  availability_list_type
 A list of availabilitys (channels, availability segments) More...
 
class  buffer
 A buffer holds the data contents of a channel. More...
 
class  channel
 Represents a LIGO data channel. More...
 
struct  channel_data_type_conversion
 Given a C++ data type, determine which NDS channel data type applies to it. More...
 
struct  channel_data_type_conversion< std::int16_t >
 
struct  channel_data_type_conversion< std::int32_t >
 
struct  channel_data_type_conversion< std::int64_t >
 
struct  channel_data_type_conversion< float >
 
struct  channel_data_type_conversion< double >
 
struct  channel_data_type_conversion< std::complex< float > >
 
struct  channel_data_type_conversion< std::uint32_t >
 
struct  frequency_range
 A simple range for sample rates. More...
 
class  channel_predicate_object
 A predicate object to be used in limiting the number of channels returned when searching for channels. More...
 
class  connection
 A connection to the NDS/NDS2 server. More...
 
class  parameters
 The parameters class holds the configuration for a connection. This includes gap handling strategy and server connection information. More...
 
struct  request_period
 This represents a [start, stop) time with an optional data stride. More...
 
class  data_stream_iterator
 A input iterator. More...
 
class  data_iterable
 The data_iterable manages streaming data from an NDS::connection. More...
 
class  epoch
 

Typedefs

typedef std::vector< bufferbuffers_type
 
typedef std::vector< channelchannels_type
 
typedef std::vector< epochepochs_type
 

Functions

std::ostream & operator<< (std::ostream &os, const segment &obj)
 
std::ostream & operator<< (std::ostream &os, const simple_segment &obj)
 
std::ostream & operator<< (std::ostream &os, const segment_list_type &obj)
 
std::ostream & operator<< (std::ostream &os, const availability &obj)
 
std::ostream & operator<< (std::ostream &os, const availability_list_type &obj)
 
std::ostream & operator<< (std::ostream &os, const simple_availability_list_type &obj)
 
std::ostream & operator<< (std::ostream &os, const simple_segment_list_type &obj)
 
std::ostream & operator<< (std::ostream &os, const buffer &obj)
 
std::ostream & operator<< (std::ostream &os, const buffers_type &obj)
 
std::ostream & operator<< (std::ostream &os, const channel &ch)
 
const std::string & channel_type_to_string (channel::channel_type ctype)
 
const std::string & data_type_to_string (channel::data_type dtype)
 
std::ostream & operator<< (std::ostream &os, const connection &conn)
 
void build_channel_predicate (channel_predicate_object &pred)
 
template<typename T >
void build_channel_predicate (channel_predicate_object &pred, T val)
 
template<typename T , typename... Args>
void build_channel_predicate (channel_predicate_object &pred, T val, Args...args)
 
template<typename... Args>
channel_predicate_object channel_predicate (Args...args)
 
std::ostream & operator<< (std::ostream &os, const epoch &obj)
 
std::ostream & operator<< (std::ostream &os, const epochs_type &obj)
 
NDS::buffers_type fetch (const NDS::parameters &params, buffer::gps_second_type gps_start, buffer::gps_second_type gps_stop, const NDS::connection::channel_names_type &channel_names)
 Retreive data from the server without having to manage a connection. More...
 
NDS::buffers_type fetch (buffer::gps_second_type gps_start, buffer::gps_second_type gps_stop, const NDS::connection::channel_names_type &channel_names)
 Retreive data from the server without having to manage a connection. More...
 
NDS::data_iterable iterate (const NDS::parameters &params, NDS::request_period period, const NDS::connection::channel_names_type &channel_names)
 Retreive data in segments without having to manage a connection. More...
 
NDS::data_iterable iterate (NDS::request_period period, const NDS::connection::channel_names_type &channel_names)
 Retreive data in segments without having to manage a connection. More...
 
channels_type find_channels (const NDS::parameters &params, const channel_predicate_object &pred)
 Retrieve a list of channels without having to manage a connection. More...
 
channels_type find_channels (const channel_predicate_object &pred)
 Retrieve a list of channels without having to manage a connection. More...
 
std::string version ()
 

Typedef Documentation

typedef std::vector< buffer > NDS::abi_0::buffers_type
typedef std::vector< channel > NDS::abi_0::channels_type
typedef std::vector< epoch > NDS::abi_0::epochs_type

Function Documentation

void NDS::abi_0::build_channel_predicate ( channel_predicate_object &  pred)
inline
template<typename T >
void NDS::abi_0::build_channel_predicate ( channel_predicate_object &  pred,
val 
)
template<typename T , typename... Args>
void NDS::abi_0::build_channel_predicate ( channel_predicate_object &  pred,
val,
Args...  args 
)
template<typename... Args>
channel_predicate_object NDS::abi_0::channel_predicate ( Args...  args)

Create a ChannelPredicate object initialized with the parameters to this call.

Template Parameters
ArgsThe types of args
Parameters
argsarguments predicate object.
Returns
A ChannelPredicate object which has been initialized with the search parameters specified.
Note
Each argument passed to this function is used to set a constraint in a ChannelPredicate object.
DLL_EXPORT const std::string & NDS::abi_0::channel_type_to_string ( channel::channel_type  ctype)
DLL_EXPORT const std::string & NDS::abi_0::data_type_to_string ( channel::data_type  dtype)
DLL_EXPORT NDS::buffers_type NDS::abi_0::fetch ( const NDS::parameters &  params,
buffer::gps_second_type  gps_start,
buffer::gps_second_type  gps_stop,
const NDS::connection::channel_names_type &  channel_names 
)

Retreive data from the server without having to manage a connection.

Given a start/stop time and a channel list retrieve the associated data.

Parameters
[in]paramsParameters object specifying connection settings
[in]gps_startStart time of request
[in]gps_stopStop time of request
[in]channel_namesThe channel list
Returns
A list of buffers containing the request data.
Remarks
The params argument should be used to specify how fetch selects gap handlers, deals with data on tape, and provide a specific server to connect to.
DLL_EXPORT NDS::buffers_type NDS::abi_0::fetch ( buffer::gps_second_type  gps_start,
buffer::gps_second_type  gps_stop,
const NDS::connection::channel_names_type &  channel_names 
)

Retreive data from the server without having to manage a connection.

Given a start/stop time and a channel list retrieve the associated data, pulling connection information from the environment.

Parameters
[in]gps_startStart time of request
[in]gps_stopStop time of request
[in]channel_namesThe channel list
Returns
A list of buffers containing the request data.
Remarks
The server to connect to, gap handlers, ... are all configured via the environment.
DLL_EXPORT channels_type NDS::abi_0::find_channels ( const NDS::parameters &  params,
const channel_predicate_object &  pred 
)

Retrieve a list of channels without having to manage a connection.

Return a list of channels that are available form this connection within the given contstraints.

Parameters
[in]paramsA parameters object used to specify a specific server
[in]predA channel_predicate object holding the constraints to impose on the search.
Returns
A count of channels matching the input parameters.
Remarks
This may result in multiple requests being sent to the server.
// Return all channels
auto params = parameters(hostname, port);
auto chans = find_channels(params, channel_predicate());
// Return all DMT channels
auto params = parameters(hostname, port);
auto chans = conn.find_channels(params, channel_predicate("*DMT*"));
// Return all 16Hz-2KHz channels that are 32 bit integers
auto params = parameters(hostname, port);
auto chans =
find_channels(params, channel_predicate(FrequencyRange(16.0, 2000.),
channel::data_type::DATA_TYPE_INT32);
// Return all 16Hz-2KHz channels that are 32 bit integers
// from the O1 run.
auto params = parameters(hostname, port);
auto chans =
find_channels(params, channel_predicate(FrequencyRange(16.0, 2000.),
channel::data_type::DATA_TYPE_INT32, epoch("O1"));
DLL_EXPORT channels_type NDS::abi_0::find_channels ( const channel_predicate_object &  pred)

Retrieve a list of channels without having to manage a connection.

Return a list of channels that are available form this connection within the given contstraints.

Parameters
[in]predA channel_predicate object holding the constraints to impose on the search.
Returns
A count of channels matching the input parameters.
Remarks
This may result in multiple requests being sent to the server.
Note
The server(s) that are queried for channel lists is pulled from the environment. To specify a specific server use the overload that takes a parameters object.
// Return all channels
// Return all DMT channels
auto chans = conn.find_channels(channel_predicate("*DMT*"));
// Return all 16Hz-2KHz channels that are 32 bit integers
auto chans =
find_channels(channel_predicate(FrequencyRange(16.0, 2000.),
channel::data_type::DATA_TYPE_INT32);
// Return all 16Hz-2KHz channels that are 32 bit integers
// from the O1 run.
auto chans =
find_channels(channel_predicate(FrequencyRange(16.0, 2000.),
channel::data_type::DATA_TYPE_INT32, epoch("O1"));
DLL_EXPORT NDS::data_iterable NDS::abi_0::iterate ( const NDS::parameters &  params,
NDS::request_period  period,
const NDS::connection::channel_names_type &  channel_names 
)

Retreive data in segments without having to manage a connection.

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.

Parameters
[in]paramsParameters object specifying connection settings
[in]periodThe 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_namesThe list of channels to retrieve data for.
Returns
A data_iterable object which manages the iteration.
Note
All iterate calls must be terminated. If you break out of an iterate loop without retrieving all of the available data you must call the abort() method of the data_iterable object to ensure that a network connection is not left open to the server. This will eventually happen when all references to the data_iterable object and the iterators it refers to are destructed.
// to stream live data from a connection object 'conn'.
auto params = parameters(hostname, port);
auto stream = iterate(params, NDS::request_period(),
{"H1:GDS-CALIB_STRAIN,online",});
for (auto it:stream) {
// *it will be a std::shared_ptr<NDS::buffers_type>
std::cout << (*it)->Start();
}
// To stream historical data, skipping over gaps
// it is assumed that start, stop are defined elsewhere
// but are in scope.
auto params = parameters();
params.set("ITERATE_USE_GAP_HANDLERS", "false");
auto stream = iterate(params, NDS::request_period(start, stop),
{"H1:GDS-CALIB_STRAIN,online",});
for (auto it:stream) {
// *it will be a std::shared_ptr<NDS::buffers_type>
std::cout << (*it)->Start();
}
DLL_EXPORT NDS::data_iterable NDS::abi_0::iterate ( NDS::request_period  period,
const NDS::connection::channel_names_type &  channel_names 
)

Retreive data in segments without having to manage a connection.

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.

Parameters
[in]periodThe 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_namesThe list of channels to retrieve data for.
Returns
A data_iterable object which manages the iteration.
Note
All iterate calls must be terminated. If you break out of an iterate loop without retrieving all of the available data you must call the abort() method of the data_iterable object to ensure that a network connection is not left open to the server. This will eventually happen when all references to the data_iterable object and the iterators it refers to are destructed.
// to stream live data from a connection object 'conn'.
auto stream = iterate(NDS::request_period(),
{"H1:GDS-CALIB_STRAIN,online",});
for (auto it:stream) {
// *it will be a std::shared_ptr<NDS::buffers_type>
std::cout << (*it)->Start();
}
// To stream historical data.
// it is assumed that start, stop are defined elsewhere
// but are in scope.
// Note if to explicitly set gap handlers/... use the
// overload which accepts a parameters object.
auto stream = iterate(NDS::request_period(start, stop),
{"H1:GDS-CALIB_STRAIN,online",});
for (auto it:stream) {
// *it will be a std::shared_ptr<NDS::buffers_type>
std::cout << (*it)->Start();
}
std::ostream& NDS::abi_0::operator<< ( std::ostream &  os,
const epoch &  obj 
)
inline
std::ostream& NDS::abi_0::operator<< ( std::ostream &  os,
const epochs_type &  obj 
)
inline
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const segment &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const buffer &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const simple_segment &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const buffers_type &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const segment_list_type &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const availability &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const availability_list_type &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const simple_availability_list_type &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const simple_segment_list_type &  obj 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const channel &  ch 
)
DLL_EXPORT std::ostream & NDS::abi_0::operator<< ( std::ostream &  os,
const connection &  conn 
)
DLL_EXPORT std::string NDS::abi_0::version ( )