cpp.implementation - moduleus/urx GitHub Wiki

Classes

Default implementation

All classes are in namespace urx.

All classes are struct and public fields.

struct Dataset {
  bool operator==(const Dataset& other) const {
    return version == other.version && acquisition == other.acquisition;
  }

  bool operator!=(const Dataset& other) const { return !operator==(other); }

  Acquisition acquisition;

  Version version;
};

Comparison

You need to add operator==. By default, struct can't be compared.

If a class can be using inside a weak_ptr or shared_ptr, you need to add header urx/detail/compare.h. This header overrides comparison for smart pointers. You will make a deep comparison and not a pointer value comparison.

shared_ptr and weak_ptr

Classes that use weak_ptr must point to a shared_ptr from a class that store shared_ptr.

Class Stored as shared_ptr in Used as weak_ptr in
Probe Acquisition ReceiveSetup, TransmitSetup
Excitation Acquisition TransmitSetup
Group Acquisition GroupData
ElementGeometry Probe Element
ImpulseResponse Probe Element
RawData GroupData

double

By default, NaN number can't be compared with another NaN. Since some value are optional, a DoubleNan class has been implemented with comparison operator overridden. In this class, the comparison of two NaN number returns true.

RawData

Each GroupData have data in field raw_data.

It's the only field that have complex class: RawData. It's an interface with 2 getters : getBuffer and getSize.

Data may come from multiple source, you can have:

  • RawDataVector to have a std::vector as buffer. When you resize(), all value are initialized by 0.
  • RawDataNoInit an array that don't initialize data.
  • RawDataWeak to store a pointer without managing life cycling. It doesn't store a std::weak_ptr.