3#ifndef SWIG__COMMON__NDS_BUFFER_HH
4#define SWIG__COMMON__NDS_BUFFER_HH
11#include "nds_export.hh"
12#include "nds_channel.hh"
17 inline namespace abi_0
168 template <
typename T >
172 const auto val_type =
176 ( std::is_same< T, void >::value &&
179 return reinterpret_cast< const T*
>( data.data( ) );
181 throw std::runtime_error(
182 "Invalid cast, the buffer data type is "
183 "not compatible with your requested "
195 template <
typename T >
199 const auto val_type =
203 ( std::is_same< T, void >::value &&
206 return reinterpret_cast< const T*
>(
209 throw std::runtime_error(
210 "Invalid cast, the buffer data type is "
211 "not compatible with your requested "
225 template <
typename T >
230 if ( array_out_of_range( index,
Samples( ) ) )
232 throw std::out_of_range(
233 "The requested index is out of range" );
235 return start[ index ];
349 template <
typename IndexType >
353 bool is_minute_trend( )
const;
356 typedef std::vector< buffer > buffers_type;
359 buffer::is_minute_trend( )
const
369 if ( is_minute_trend( ) )
383 if ( is_minute_trend( ) )
408 if ( is_minute_trend( ) )
447 return gps_nanosecond;
485 DLL_EXPORT
extern std::ostream& operator<<( std::ostream& os,
488 DLL_EXPORT
extern std::ostream& operator<<( std::ostream& os,
489 const buffers_type& obj );
501 template <
typename IndexType >
503 buffer::array_out_of_range( IndexType Index, IndexType Max )
const
A buffer holds the data contents of a channel.
Definition nds_buffer.hh:28
DLL_EXPORT gps_nanosecond_type StopNano() const
Retrieve the GPS stop nanosecond of the data.
Definition nds_buffer.hh:466
DLL_EXPORT size_type seconds_to_samples(gps_second_type offset_seconds, gps_nanosecond_type offset_nano=0) const
Convert relative second offsets to relative sample offsets.
Definition nds_buffer.hh:404
const T * cend() const
Return a constant data iterator for this buffer, that references the just after the end of the data.
Definition nds_buffer.hh:197
DLL_EXPORT gps_second_type samples_to_seconds(size_type offset_samples) const
Convert relative sample offsets to relative second offsets.
Definition nds_buffer.hh:367
const T * cbegin() const
Return a constant data iterator for this buffer, that references the beginning of the data.
Definition nds_buffer.hh:170
long gps_second_type
Type second portion of a gps time.
Definition nds_buffer.hh:33
std::vector< unsigned char > data_type
Storage type for the data.
Definition nds_buffer.hh:45
DLL_EXPORT buffer()
Default constructor.
Definition nds_buffer.cc:12
DLL_EXPORT size_type samples_to_bytes(size_type offset_samples) const
Convert relative sample offsets to relative byte offsets.
Definition nds_buffer.hh:418
DLL_EXPORT gps_second_type samples_to_trailing_nanoseconds(size_type offset_samples) const
Given a sample count, determine how many seconds and nanoseconds worth of data are avaialble,...
Definition nds_buffer.hh:380
DLL_EXPORT gps_second_type Start() const
Retrieve the GPS start second of the data.
Definition nds_buffer.hh:437
const T & at(size_type index) const
This is a type aware, bounds checked lookup in the buffer.
Definition nds_buffer.hh:227
DLL_EXPORT gps_nanosecond_type StartNano() const
Retrieve the GPS start nano second of the data.
Definition nds_buffer.hh:445
DLL_EXPORT void swap(buffer &Source)
Exchange the contents of this container with another.
Definition nds_buffer.cc:46
DLL_EXPORT void reset_channel_info(const channel &ChannelInfo, gps_second_type Second, gps_nanosecond_type NanoSecond)
Reset the channel type. Set the sample count to 0.
Definition nds_buffer.cc:64
DLL_EXPORT size_type Samples() const
Retrieve the number of samples being stored.
Definition nds_buffer.hh:429
DLL_EXPORT size_type bytes_to_samples(size_type offset_bytes) const
Convert relative byte offsets to relative sample offsets.
Definition nds_buffer.hh:396
DLL_EXPORT gps_second_type Stop() const
Retrieve the GPS stop second of the data.
Definition nds_buffer.hh:453
long gps_nanosecond_type
Type nano second portion of a gps time.
Definition nds_buffer.hh:37
DLL_EXPORT void resize(size_type N)
Resize the container to hold N elements.
Definition nds_buffer.hh:477
size_t size_type
Type appropriate for length.
Definition nds_buffer.hh:41
Represents a LIGO data channel.
Definition nds_channel.hh:34
DLL_EXPORT size_type DataTypeSize() const
Return the size in bytes of an individual sample from the channel.
Definition nds_channel.hh:325
DLL_EXPORT channel_type Type() const
Return the type of the channel.
Definition nds_channel.hh:313
@ CHANNEL_TYPE_MTREND
Minute trend.
Definition nds_channel.hh:45
DLL_EXPORT data_type DataType() const
Return the data type of the channel.
Definition nds_channel.hh:319
DLL_EXPORT sample_rate_type SampleRate() const
Return the sample rate of the channel.
Definition nds_channel.hh:348
@ DATA_TYPE_UNKNOWN
Unkown.
Definition nds_channel.hh:54
size_t size_type
Defines sizes when dealing with channels.
Definition nds_channel.hh:99
The NDS client namespace.
Definition debug_stream.cc:18
Given a C++ data type, determine which NDS channel data type applies to it.
Definition nds_channel.hh:426