nds2-client - ClientDeveloper
0.16.8
|
A buffer holds the data contents of a channel. More...
#include <nds.hh>
Public Types | |
typedef long | gps_second_type |
Type second portion of a gps time. More... | |
typedef long | gps_nanosecond_type |
Type nano second portion of a gps time. More... | |
typedef size_t | size_type |
Type appropriate for length. More... | |
typedef std::vector< unsigned char > | data_type |
Storage type for the data. More... | |
Public Types inherited from NDS::abi_0::channel | |
enum | channel_type { CHANNEL_TYPE_UNKNOWN = 0, CHANNEL_TYPE_ONLINE = ( 1 << 0 ), CHANNEL_TYPE_RAW = ( 1 << 1 ), CHANNEL_TYPE_RDS = ( 1 << 2 ), CHANNEL_TYPE_STREND = ( 1 << 3 ), CHANNEL_TYPE_MTREND = ( 1 << 4 ), CHANNEL_TYPE_TEST_POINT = ( 1 << 5 ), CHANNEL_TYPE_STATIC = ( 1 << 6 ) } |
enum | data_type { DATA_TYPE_UNKNOWN = 0, DATA_TYPE_INT16 = ( 1 << 0 ), DATA_TYPE_INT32 = ( 1 << 1 ), DATA_TYPE_INT64 = ( 1 << 2 ), DATA_TYPE_FLOAT32 = ( 1 << 3 ), DATA_TYPE_FLOAT64 = ( 1 << 4 ), DATA_TYPE_COMPLEX32, DATA_TYPE_UINT32 = ( 1 << 6 ) } |
Defines the internal data representation. More... | |
typedef double | sample_rate_type |
Defines the sample rate type. More... | |
typedef float | signal_gain_type |
Defines the gain type. More... | |
typedef float | signal_slope_type |
Defines the slope type. More... | |
typedef float | signal_offset_type |
Defines the offset type. More... | |
typedef size_t | size_type |
Defines sizes when dealing with channels. More... | |
typedef std::vector< std::string > | channel_names_type |
A vector of channel names. More... | |
Public Member Functions | |
DLL_EXPORT | buffer () |
Default constructor. More... | |
DLL_EXPORT | buffer (const channel &ChannelInfo, gps_second_type Second, gps_nanosecond_type NanoSecond, const void *Buffer, size_type BufferSize) |
Constructor. More... | |
DLL_EXPORT | buffer (const channel &ChannelInfo, gps_second_type Second, gps_nanosecond_type NanoSecond, data_type &&Buffer) |
Constructor. More... | |
DLL_EXPORT size_type | Samples () const |
Retrieve the number of samples being stored. More... | |
DLL_EXPORT gps_second_type | Start () const |
Retrieve the GPS start second of the data. More... | |
DLL_EXPORT gps_nanosecond_type | StartNano () const |
Retrieve the GPS start nano second of the data. More... | |
DLL_EXPORT gps_second_type | Stop () const |
Retrieve the GPS stop second of the data. More... | |
DLL_EXPORT gps_nanosecond_type | StopNano () const |
Retrieve the GPS stop nanosecond of the data. More... | |
DLL_EXPORT void | swap (buffer &Source) |
Exchange the contents of this container with another. More... | |
DLL_EXPORT void | resize (size_type N) |
Resize the container to hold N elements. More... | |
template<typename T > | |
const T * | cbegin () const |
Return a constant data iterator for this buffer, that references the beginning of the data. More... | |
template<typename T > | |
const T * | cend () const |
Return a constant data iterator for this buffer, that references the just after the end of the data. More... | |
template<typename T > | |
const T & | at (size_type index) const |
This is a type aware, bounds checked lookup in the buffer. More... | |
DLL_EXPORT gps_second_type | samples_to_seconds (size_type offset_samples) const |
Convert relative sample offsets to relative second offsets. More... | |
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, and return the nanosecond count. More... | |
DLL_EXPORT size_type | bytes_to_samples (size_type offset_bytes) const |
Convert relative byte offsets to relative sample offsets. More... | |
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. More... | |
DLL_EXPORT size_type | samples_to_bytes (size_type offset_samples) const |
Convert relative sample offsets to relative byte offsets. More... | |
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. More... | |
Public Member Functions inherited from NDS::abi_0::channel | |
DLL_EXPORT | channel () |
Default constructor. More... | |
DLL_EXPORT | channel (const channel &Source) |
Copy constructor. More... | |
DLL_EXPORT | channel (const std::string &Name, channel_type Type, data_type DataType, sample_rate_type SampleRate, signal_gain_type Gain, signal_slope_type Slope, signal_offset_type Offset, std::string Units) |
Create a channel object. More... | |
DLL_EXPORT const std::string & | Name () const |
Return the channel name. More... | |
DLL_EXPORT std::string | NameLong () const |
Return the name with additional information. More... | |
DLL_EXPORT channel_type | Type () const |
Return the type of the channel. More... | |
DLL_EXPORT data_type | DataType () const |
Return the data type of the channel. More... | |
DLL_EXPORT size_type | DataTypeSize () const |
Return the size in bytes of an individual sample from the channel. More... | |
DLL_EXPORT sample_rate_type | SampleRate () const |
Return the sample rate of the channel. More... | |
DLL_EXPORT signal_gain_type | Gain () const |
Return the gain of the channel. More... | |
DLL_EXPORT signal_slope_type | Slope () const |
Return the slope of the channel. More... | |
DLL_EXPORT signal_offset_type | Offset () const |
Return the offset of the channel. More... | |
DLL_EXPORT const std::string & | Units () const |
Return the units of this channel. More... | |
DLL_EXPORT void | swap (channel &Source) |
Swap this channel with another. More... | |
Static Public Attributes | |
static const gps_second_type | GPS_INF = 1999999999 |
Static Public Attributes inherited from NDS::abi_0::channel | |
static DLL_EXPORT const channel_type | DEFAULT_CHANNEL_MASK |
The combination of all valid channel types. More... | |
static DLL_EXPORT const data_type | DEFAULT_DATA_MASK |
The combinatino of all valid data types. More... | |
static DLL_EXPORT const sample_rate_type | MIN_SAMPLE_RATE = 0.0f |
Smallest sample rate possible. More... | |
static DLL_EXPORT const sample_rate_type | MAX_SAMPLE_RATE = 1e12f |
Largest sample rate possible. More... | |
Protected Member Functions | |
bool | is_minute_trend () const |
Private Member Functions | |
template<typename IndexType > | |
bool | array_out_of_range (IndexType Index, IndexType Max) const |
template<> | |
bool | array_out_of_range (size_t Index, size_t Max) const |
Private Attributes | |
gps_second_type | gps_second |
gps_nanosecond_type | gps_nanosecond |
data_type | data |
Additional Inherited Members | |
Static Public Member Functions inherited from NDS::abi_0::channel | |
static DLL_EXPORT channel_type | convert_daq_chantype (int ChanType) |
Convert from the legacy daqd channel types to a channel_type enum. More... | |
static DLL_EXPORT data_type | convert_daq_datatype (int DataType) |
Convert from the legacy daqd data types to a data_type enum. More... | |
static DLL_EXPORT const std::string & | ToString (channel_type ChannelType) |
Return a string representatino of the given channel_type. More... | |
static DLL_EXPORT const std::string & | ToString (data_type DataType) |
Return a string representatino of the given data_type. More... | |
static DLL_EXPORT bool | IsSecondTrend (const std::string &Name) |
Check the channel name to see if it is a second trend. More... | |
static DLL_EXPORT bool | IsMinuteTrend (const std::string &Name) |
Check the channel name to see if it is a minute trend. More... | |
A buffer holds the data contents of a channel.
This class facilitates the storage of data and accompanying meta data.
typedef std::vector< unsigned char > NDS::abi_0::buffer::data_type |
Storage type for the data.
typedef long NDS::abi_0::buffer::gps_nanosecond_type |
Type nano second portion of a gps time.
typedef long NDS::abi_0::buffer::gps_second_type |
Type second portion of a gps time.
typedef size_t NDS::abi_0::buffer::size_type |
Type appropriate for length.
NDS::abi_0::buffer::buffer | ( | ) |
Default constructor.
NDS::abi_0::buffer::buffer | ( | const channel & | ChannelInfo, |
gps_second_type | Second, | ||
gps_nanosecond_type | NanoSecond, | ||
const void * | Buffer, | ||
size_type | BufferSize | ||
) |
Constructor.
[in] | ChannelInfo | Channel metadata. |
[in] | Second | GPS second start time of channel data. |
[in] | NanoSecond | GPS nanosecond start time of channel data. |
[in] | Buffer | Channel data. |
[in] | BufferSize | Number of bytes in Buffer. |
NDS::abi_0::buffer::buffer | ( | const channel & | ChannelInfo, |
gps_second_type | Second, | ||
gps_nanosecond_type | NanoSecond, | ||
data_type && | Buffer | ||
) |
Constructor.
[in] | ChannelInfo | Channel metadata. |
[in] | Second | GPS second start time of channel data. |
[in] | NanoSecond | GPS nanosecond start time of channel data. |
[in] | Buffer | Channel data in a std::vector<char>. The vector will be moved from. |
|
inlineprivate |
|
inlineprivate |
|
inline |
This is a type aware, bounds checked lookup in the buffer.
T | The type to return a const reference for. |
index | The number/index of the sample to reference. |
|
inline |
Convert relative byte offsets to relative sample offsets.
[in] | offset_bytes | An byte number [0,...) |
|
inline |
Return a constant data iterator for this buffer, that references the beginning of the data.
T | The type to return an iterator for |
|
inline |
Return a constant data iterator for this buffer, that references the just after the end of the data.
T | The type to return an iterator for |
|
inlineprotected |
void NDS::abi_0::buffer::reset_channel_info | ( | const channel & | ChannelInfo, |
gps_second_type | Second, | ||
gps_nanosecond_type | NanoSecond | ||
) |
Reset the channel type. Set the sample count to 0.
[in] | ChannelInfo | channel meta data to copy into this buffer |
[in] | Second | A second number [0,...) that the buffer should start at |
[in] | NanoSecond | The number of nanoseconds atfer Second that this buffer starts. |
|
inline |
Resize the container to hold N elements.
[in] | N | The new number of elements to be stored. |
|
inline |
Retrieve the number of samples being stored.
The number of samples in the data set. The number of bytes stored is the number of samples multiplied by size of the data type.
|
inline |
Convert relative sample offsets to relative byte offsets.
[in] | offset_samples | A sample number [0,...). This is the number of samples since the start of this buffer |
|
inline |
Convert relative sample offsets to relative second offsets.
[in] | offset_samples | An sample number [0,...) |
|
inline |
Given a sample count, determine how many seconds and nanoseconds worth of data are avaialble, and return the nanosecond count.
[in] | offset_samples | An sample number [0,...) |
|
inline |
Convert relative second offsets to relative sample offsets.
[in] | offset_seconds | A second number [0,...). This is the number of seconds since Start() |
[in] | offset_nano | A nanosecond offset, defaults to 0 |
|
inline |
Retrieve the GPS start second of the data.
|
inline |
Retrieve the GPS start nano second of the data.
|
inline |
Retrieve the GPS stop second of the data.
|
inline |
Retrieve the GPS stop nanosecond of the data.
void NDS::abi_0::buffer::swap | ( | buffer & | Source | ) |
Exchange the contents of this container with another.
|
private |
|
static |
|
private |
|
private |