Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
mctools::digitization::sampled_signal Class Reference

A simple linear ADC (Analog/Digital Converter) More...

#include <bayeux/mctools/digitization/sampled_signal.h>

Inheritance diagram for mctools::digitization::sampled_signal:
geomtools::base_hit datatools::i_serializable datatools::i_tree_dumpable datatools::i_clear

Public Types

enum  more_store_mask_type { STORE_SAMPLING_FREQUENCY = datatools::bit_mask::bit03, STORE_SAMPLES = datatools::bit_mask::bit04 }
 Masks to automatically tag the attributes to be stored. More...
 
enum  sampling_status_index { SS_INVALID = 0, SS_UNDERFLOW = 1, SS_OVERFLOW = 2 }
 Indexes of sampling status bits. More...
 
enum  slicing_bits {
  SLICING_HIT_ID = datatools::bit_mask::bit00, SLICING_GEOM_ID = datatools::bit_mask::bit01, SLICING_AUXILIARIES = datatools::bit_mask::bit02, SLICING_UPDATE = datatools::bit_mask::bit03,
  SLICING_ALL
}
 Special flags for signal slicing. More...
 
enum  print_ascii_bits { PRINT_ASCII_NOHEADER = datatools::bit_mask::bit00, PRINT_ASCII_TIME_IN_NS = datatools::bit_mask::bit01, PRINT_ASCII_NODATABLOCKSEP = datatools::bit_mask::bit02 }
 Special flags for ASCII dump. More...
 
- Public Types inherited from geomtools::base_hit
enum  store_mask_type {
  STORE_NOTHING = 0, STORE_HIT_ID = datatools::bit_mask::bit00, STORE_GEOM_ID = datatools::bit_mask::bit01, STORE_AUXILIARIES = datatools::bit_mask::bit02,
  STORE_RESERVED30 = datatools::bit_mask::bit30, STORE_RESERVED31 = datatools::bit_mask::bit31
}
 Masks to automatically tag the attributes to be stored. More...
 
- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 

Public Member Functions

 sampled_signal ()
 Default constructor. More...
 
 sampled_signal (const double sampling_frequency_, const std::size_t nsamples_, const int32_t value_=INVALID_SAMPLE)
 Constructor. More...
 
virtual ~sampled_signal ()
 Destructor. More...
 
virtual bool is_valid () const
 Check validity. More...
 
bool has_sampling_frequency () const
 Check if sampling frequency is set. More...
 
void set_sampling_frequency (const double)
 Set the sampling frequency. More...
 
double get_sampling_frequency () const
 Return the sampling frequency. More...
 
void reset_sampling_frequency ()
 Reset sampling frequency and associated period. More...
 
void set_sampling_period (const double)
 Set the sampling period. More...
 
double get_sampling_period () const
 Return the sampling period. More...
 
std::size_t get_number_of_sampling_time_intervals () const
 Return the number of sampling time intervals. More...
 
double get_sampling_duration () const
 Return the sampling duration. More...
 
double get_min_sampling_time () const
 Return the minimum sampling time. More...
 
double get_max_sampling_time () const
 Return the maximum sampling time. More...
 
void set_number_of_samples (const std::size_t nsamples_, const int32_t value_=INVALID_SAMPLE)
 Set the number of samples. More...
 
void reset_number_of_samples ()
 Reset the number of samples. More...
 
std::size_t get_number_of_samples () const
 Return the number of samples. More...
 
bool is_sampling_initialized () const
 Check if the array of samples is initialized. More...
 
bool has_invalid_samples () const
 Check if the array of samples has at least one invalid sample. More...
 
bool has_underflow_samples () const
 Check if the array of samples has at least one underflow sample. More...
 
bool has_overflow_samples () const
 Check if the array of samples has at least one overflow sample. More...
 
bool has_only_valid_samples () const
 Check if the array of samples has only valid samples. More...
 
bool has_min_sample () const
 Check if the minimum sample value is set. More...
 
int32_t get_min_sample () const
 Return the minimum sample value. More...
 
bool has_max_sample () const
 Check if the maximum sample value is set. More...
 
int32_t get_max_sample () const
 Return the maximum sample value. More...
 
void reset ()
 Reset. More...
 
void set_samples (const std::vector< int32_t > &, const bool update_=true)
 Set the array of samples. More...
 
const std::vector< int32_t > & get_samples () const
 Return a const reference to the array of samples. More...
 
void set_sample (const uint32_t index_, const int32_t sample_, const bool update_=false)
 Set the sample value at given time index. More...
 
uint32_t get_sample (const uint32_t index_) const
 Return the sample value at given time index. More...
 
bool is_normal (const uint32_t index_) const
 Check if a sample at given time index has a normal value. More...
 
bool is_invalid (const uint32_t index_) const
 Check if a sample at given time index has an invalid value. More...
 
bool is_underflow (const uint32_t index_) const
 Check if a sample at given time index has an underflow value. More...
 
bool is_overflow (const uint32_t index_) const
 Check if a sample at given time index has an overflow value. More...
 
double get_time (const uint32_t index_) const
 Return the time associated to a given sample. More...
 
uint32_t get_index (const double time_) const
 Return the sample index associated to a given time. More...
 
void unset_sample (const uint32_t index_, const bool update_=false)
 Force the sample value at given time index to be invalid. More...
 
void set_underflow_sample (const uint32_t index_, const bool update_=false)
 Force the sample value at given time index to be underflow. More...
 
void set_overflow_sample (const uint32_t index_, const bool update_=false)
 Force the sample value at given time index to be overflow. More...
 
virtual void tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Smart print. More...
 
void update ()
 Update internal data. More...
 
void slice_from_to (sampled_signal &target_, const std::size_t first_, const std::size_t last_, const uint32_t flags_=0) const
 Extract slice of the signal. More...
 
void print_ascii (std::ostream &out_, const uint32_t flags_=0) const
 Simple ASCII terminal dump. More...
 
- Public Member Functions inherited from geomtools::base_hit
bool has_hit_id () const
 
int32_t get_hit_id () const
 
void set_hit_id (int32_t)
 Set the hit ID integer value. More...
 
void invalidate_hit_id ()
 
bool has_geom_id () const
 Check if the geometry ID is valid. More...
 
const geomtools::geom_idget_geom_id () const
 Get a reference on the non-mutable geometry ID. More...
 
geomtools::geom_idgrab_geom_id ()
 Get a reference on the mutable geometry ID. More...
 
void set_geom_id (const geomtools::geom_id &)
 Set the geometry ID. More...
 
void invalidate_geom_id ()
 Reset the geometry ID. More...
 
bool has_auxiliaries () const
 Check if there are stored auxiliary properties. More...
 
const datatools::propertiesget_auxiliaries () const
 Get a non-mutable reference on the auxiliaries container. More...
 
datatools::propertiesgrab_auxiliaries ()
 Get a mutable reference on the auxiliaries container. More...
 
void set_auxiliaries (const datatools::properties &)
 Set the auxiliaries container. More...
 
void invalidate_auxiliaries ()
 Reset the mutable auxiliaries container. More...
 
 base_hit ()
 Default constructor. More...
 
virtual ~base_hit ()
 Destructor. More...
 
virtual void invalidate ()
 Reset the internals of the hit, making it invalid. More...
 
void reset ()
 Reset the internals of the hit, making it invalid. More...
 
virtual void clear ()
 Reset the internals of the hit, making it invalid. More...
 
base_hitmeasure (i_measurement &)
 Apply a measurement on the current hit. More...
 
void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=datatools::i_tree_dumpable::empty_options()) const override
 
void dump () const
 Smart print (default behaviour) More...
 
- Public Member Functions inherited from datatools::i_serializable
 i_serializable ()
 Default constructor. More...
 
virtual ~i_serializable ()
 Destructor. More...
 
virtual const std::string & get_serial_tag () const =0
 Return the serialization string identifier of the class. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 
- Public Member Functions inherited from datatools::i_clear
virtual ~i_clear ()
 Destructor. More...
 

Static Public Member Functions

static bool sample_is_normal (const int32_t)
 Check if a sample value is normal (nor invalid, underflow or overflow) More...
 
static bool sample_is_invalid (const int32_t)
 Check if a sample value is invalid. More...
 
static bool sample_is_underflow (const int32_t)
 Check if a sample value is underflow. More...
 
static bool sample_is_overflow (const int32_t)
 Check if a sample value is overflow. More...
 
- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 

Static Public Attributes

static const int32_t INVALID_SAMPLE = std::numeric_limits<int32_t>::min()
 
static const int32_t UNDERFLOW_SAMPLE = std::numeric_limits<int32_t>::min() + 1
 
static const int32_t OVERFLOW_SAMPLE = std::numeric_limits<int32_t>::max()
 
- Static Public Attributes inherited from geomtools::base_hit
static const int32_t INVALID_HIT_ID = -1
 

Protected Member Functions

void _set_defaults ()
 Set default attributes values. More...
 
void _set_default_working_data ()
 Set default attributes values. More...
 
void _recompute_working_data ()
 Recompute working data. More...
 
- Protected Member Functions inherited from geomtools::base_hit
void _store_set (uint32_t bit_mask_)
 Set the bits from a mask. More...
 
void _store_unset (uint32_t bit_mask_)
 Unset the bits from a mask. More...
 
bool _store_check (uint32_t bit_mask_) const
 Check the bits from a mask. More...
 

Additional Inherited Members

- Protected Attributes inherited from geomtools::base_hit
uint32_t _store
 

Detailed Description

A simple linear ADC (Analog/Digital Converter)

Member Enumeration Documentation

◆ more_store_mask_type

Masks to automatically tag the attributes to be stored.

Enumerator
STORE_SAMPLING_FREQUENCY 

Serialization mask for the sampling frequency.

STORE_SAMPLES 

Serialization mask for the samples.

◆ print_ascii_bits

Special flags for ASCII dump.

Enumerator
PRINT_ASCII_NOHEADER 
PRINT_ASCII_TIME_IN_NS 
PRINT_ASCII_NODATABLOCKSEP 

◆ sampling_status_index

Indexes of sampling status bits.

Enumerator
SS_INVALID 

Index of the invalid/uninitialized samples bit.

SS_UNDERFLOW 

Index of the underflow samples bit.

SS_OVERFLOW 

Index of the overflow samples bit.

◆ slicing_bits

Special flags for signal slicing.

Enumerator
SLICING_HIT_ID 
SLICING_GEOM_ID 
SLICING_AUXILIARIES 
SLICING_UPDATE 
SLICING_ALL 

Constructor & Destructor Documentation

◆ sampled_signal() [1/2]

mctools::digitization::sampled_signal::sampled_signal ( )

Default constructor.

◆ sampled_signal() [2/2]

mctools::digitization::sampled_signal::sampled_signal ( const double  sampling_frequency_,
const std::size_t  nsamples_,
const int32_t  value_ = INVALID_SAMPLE 
)

Constructor.

◆ ~sampled_signal()

virtual mctools::digitization::sampled_signal::~sampled_signal ( )
virtual

Destructor.

Member Function Documentation

◆ _recompute_working_data()

void mctools::digitization::sampled_signal::_recompute_working_data ( )
protected

Recompute working data.

◆ _set_default_working_data()

void mctools::digitization::sampled_signal::_set_default_working_data ( )
protected

Set default attributes values.

◆ _set_defaults()

void mctools::digitization::sampled_signal::_set_defaults ( )
protected

Set default attributes values.

◆ get_index()

uint32_t mctools::digitization::sampled_signal::get_index ( const double  time_) const

Return the sample index associated to a given time.

◆ get_max_sample()

int32_t mctools::digitization::sampled_signal::get_max_sample ( ) const

Return the maximum sample value.

◆ get_max_sampling_time()

double mctools::digitization::sampled_signal::get_max_sampling_time ( ) const

Return the maximum sampling time.

◆ get_min_sample()

int32_t mctools::digitization::sampled_signal::get_min_sample ( ) const

Return the minimum sample value.

◆ get_min_sampling_time()

double mctools::digitization::sampled_signal::get_min_sampling_time ( ) const

Return the minimum sampling time.

◆ get_number_of_samples()

std::size_t mctools::digitization::sampled_signal::get_number_of_samples ( ) const

Return the number of samples.

◆ get_number_of_sampling_time_intervals()

std::size_t mctools::digitization::sampled_signal::get_number_of_sampling_time_intervals ( ) const

Return the number of sampling time intervals.

◆ get_sample()

uint32_t mctools::digitization::sampled_signal::get_sample ( const uint32_t  index_) const

Return the sample value at given time index.

◆ get_samples()

const std::vector<int32_t>& mctools::digitization::sampled_signal::get_samples ( ) const

Return a const reference to the array of samples.

◆ get_sampling_duration()

double mctools::digitization::sampled_signal::get_sampling_duration ( ) const

Return the sampling duration.

◆ get_sampling_frequency()

double mctools::digitization::sampled_signal::get_sampling_frequency ( ) const

Return the sampling frequency.

◆ get_sampling_period()

double mctools::digitization::sampled_signal::get_sampling_period ( ) const

Return the sampling period.

◆ get_time()

double mctools::digitization::sampled_signal::get_time ( const uint32_t  index_) const

Return the time associated to a given sample.

◆ has_invalid_samples()

bool mctools::digitization::sampled_signal::has_invalid_samples ( ) const

Check if the array of samples has at least one invalid sample.

◆ has_max_sample()

bool mctools::digitization::sampled_signal::has_max_sample ( ) const

Check if the maximum sample value is set.

◆ has_min_sample()

bool mctools::digitization::sampled_signal::has_min_sample ( ) const

Check if the minimum sample value is set.

◆ has_only_valid_samples()

bool mctools::digitization::sampled_signal::has_only_valid_samples ( ) const

Check if the array of samples has only valid samples.

◆ has_overflow_samples()

bool mctools::digitization::sampled_signal::has_overflow_samples ( ) const

Check if the array of samples has at least one overflow sample.

◆ has_sampling_frequency()

bool mctools::digitization::sampled_signal::has_sampling_frequency ( ) const

Check if sampling frequency is set.

◆ has_underflow_samples()

bool mctools::digitization::sampled_signal::has_underflow_samples ( ) const

Check if the array of samples has at least one underflow sample.

◆ is_invalid()

bool mctools::digitization::sampled_signal::is_invalid ( const uint32_t  index_) const

Check if a sample at given time index has an invalid value.

◆ is_normal()

bool mctools::digitization::sampled_signal::is_normal ( const uint32_t  index_) const

Check if a sample at given time index has a normal value.

◆ is_overflow()

bool mctools::digitization::sampled_signal::is_overflow ( const uint32_t  index_) const

Check if a sample at given time index has an overflow value.

◆ is_sampling_initialized()

bool mctools::digitization::sampled_signal::is_sampling_initialized ( ) const

Check if the array of samples is initialized.

◆ is_underflow()

bool mctools::digitization::sampled_signal::is_underflow ( const uint32_t  index_) const

Check if a sample at given time index has an underflow value.

◆ is_valid()

virtual bool mctools::digitization::sampled_signal::is_valid ( ) const
virtual

Check validity.

Reimplemented from geomtools::base_hit.

◆ print_ascii()

void mctools::digitization::sampled_signal::print_ascii ( std::ostream &  out_,
const uint32_t  flags_ = 0 
) const

Simple ASCII terminal dump.

◆ reset()

void mctools::digitization::sampled_signal::reset ( )

Reset.

◆ reset_number_of_samples()

void mctools::digitization::sampled_signal::reset_number_of_samples ( )

Reset the number of samples.

◆ reset_sampling_frequency()

void mctools::digitization::sampled_signal::reset_sampling_frequency ( )

Reset sampling frequency and associated period.

◆ sample_is_invalid()

static bool mctools::digitization::sampled_signal::sample_is_invalid ( const int32_t  )
static

Check if a sample value is invalid.

◆ sample_is_normal()

static bool mctools::digitization::sampled_signal::sample_is_normal ( const int32_t  )
static

Check if a sample value is normal (nor invalid, underflow or overflow)

◆ sample_is_overflow()

static bool mctools::digitization::sampled_signal::sample_is_overflow ( const int32_t  )
static

Check if a sample value is overflow.

◆ sample_is_underflow()

static bool mctools::digitization::sampled_signal::sample_is_underflow ( const int32_t  )
static

Check if a sample value is underflow.

◆ set_number_of_samples()

void mctools::digitization::sampled_signal::set_number_of_samples ( const std::size_t  nsamples_,
const int32_t  value_ = INVALID_SAMPLE 
)

Set the number of samples.

◆ set_overflow_sample()

void mctools::digitization::sampled_signal::set_overflow_sample ( const uint32_t  index_,
const bool  update_ = false 
)

Force the sample value at given time index to be overflow.

◆ set_sample()

void mctools::digitization::sampled_signal::set_sample ( const uint32_t  index_,
const int32_t  sample_,
const bool  update_ = false 
)

Set the sample value at given time index.

◆ set_samples()

void mctools::digitization::sampled_signal::set_samples ( const std::vector< int32_t > &  ,
const bool  update_ = true 
)

Set the array of samples.

◆ set_sampling_frequency()

void mctools::digitization::sampled_signal::set_sampling_frequency ( const double  )

Set the sampling frequency.

◆ set_sampling_period()

void mctools::digitization::sampled_signal::set_sampling_period ( const double  )

Set the sampling period.

◆ set_underflow_sample()

void mctools::digitization::sampled_signal::set_underflow_sample ( const uint32_t  index_,
const bool  update_ = false 
)

Force the sample value at given time index to be underflow.

◆ slice_from_to()

void mctools::digitization::sampled_signal::slice_from_to ( sampled_signal target_,
const std::size_t  first_,
const std::size_t  last_,
const uint32_t  flags_ = 0 
) const

Extract slice of the signal.

◆ tree_dump()

virtual void mctools::digitization::sampled_signal::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Smart print.

Reimplemented from geomtools::base_hit.

◆ unset_sample()

void mctools::digitization::sampled_signal::unset_sample ( const uint32_t  index_,
const bool  update_ = false 
)

Force the sample value at given time index to be invalid.

◆ update()

void mctools::digitization::sampled_signal::update ( )

Update internal data.

Member Data Documentation

◆ INVALID_SAMPLE

const int32_t mctools::digitization::sampled_signal::INVALID_SAMPLE = std::numeric_limits<int32_t>::min()
static

◆ OVERFLOW_SAMPLE

const int32_t mctools::digitization::sampled_signal::OVERFLOW_SAMPLE = std::numeric_limits<int32_t>::max()
static

◆ UNDERFLOW_SAMPLE

const int32_t mctools::digitization::sampled_signal::UNDERFLOW_SAMPLE = std::numeric_limits<int32_t>::min() + 1
static

The documentation for this class was generated from the following file: