• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • CDP Linux
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • MetricMathBase
  • 5.1.0

MetricMathBase Class

Base class for metric math engines. More...

Header: #include <MetricMathBase>
Inherits: IMetricMath
Inherited By:

CustomMetricMath

  • List of all members, including inherited members

Public Functions

virtual ~MetricMathBase()

Reimplemented Public Functions

virtual void Consume(const std::vector<MetricEvent> &events) override
virtual void FinishWindow() override
virtual void InitDone() override
virtual void Initialize(int measureType, const std::vector<MetricChannelSpec> &channels, const MetricOptions &opts, IMetricPropertyFactory &factory, const MetricCallbacks &callbacks) override
virtual void StartWindow(uint64_t fromTs, uint64_t toTs) override
  • 5 public functions inherited from IMetricMath

Protected Types

class BoundedCounter
class ControlProcessResult
class SampledPropertyPair

Protected Functions

const char *ChannelKindLabel(uint8_t channel) const
bool CoerceToTruth(const CDP::StudioAPI::CDPVariantValue &value, bool previousState, double threshold = 0.5, double hysteresis = 1e-9) const
bool IsEnabled() const
bool IsMeasureChannel(uint8_t id) const
CDPProperty<T> *MakeSampledProperty(CDPProperty<T> *source, const std::string &sampledName, CDP::System::Base::PropertyCreateFlags flags = {})
CDPProperty<T> *MakeTypedProperty(const std::string &name, CDP::System::Base::PropertyCreateFlags flags)
ControlProcessResult ProcessControlEvent(const MetricEvent &event, double threshold = 0.5, double hysteresis = 1e-9)
void RecordHistogramSample(uint8_t channel, const CDP::StudioAPI::CDPVariantValue &value)
void RegisterSampledPair(CDPPropertyBase *source, CDPPropertyBase *sampled)
void SnapshotSampledProperties()

Detailed Description

Base class for metric math engines.

This class provides a default implementation for `IMetricMath` and includes helper methods for handling channels, control states, and property creation. It simplifies the implementation of custom metric math engines.

Member Function Documentation

[virtual] MetricMathBase::~MetricMathBase()

Destroys the instance of MetricMathBase. The destructor is virtual.

[protected] const char *MetricMathBase::ChannelKindLabel(uint8_t channel) const

[protected] bool MetricMathBase::CoerceToTruth(const CDP::StudioAPI::CDPVariantValue &value, bool previousState, double threshold = 0.5, double hysteresis = 1e-9) const

[override virtual] void MetricMathBase::Consume(const std::vector<MetricEvent> &events)

Reimplemented from IMetricMath::Consume().

[override virtual] void MetricMathBase::FinishWindow()

Reimplemented from IMetricMath::FinishWindow().

[override virtual] void MetricMathBase::InitDone()

[override virtual] void MetricMathBase::Initialize(int measureType, const std::vector<MetricChannelSpec> &channels, const MetricOptions &opts, IMetricPropertyFactory &factory, const MetricCallbacks &callbacks)

Reimplemented from IMetricMath::Initialize().

[protected] bool MetricMathBase::IsEnabled() const

[protected] bool MetricMathBase::IsMeasureChannel(uint8_t id) const

[protected] CDPProperty<T> *MetricMathBase::MakeSampledProperty(CDPProperty<T> *source, const std::string &sampledName, CDP::System::Base::PropertyCreateFlags flags = {})

[protected] CDPProperty<T> *MetricMathBase::MakeTypedProperty(const std::string &name, CDP::System::Base::PropertyCreateFlags flags)

[protected] ControlProcessResult MetricMathBase::ProcessControlEvent(const MetricEvent &event, double threshold = 0.5, double hysteresis = 1e-9)

[protected] void MetricMathBase::RecordHistogramSample(uint8_t channel, const CDP::StudioAPI::CDPVariantValue &value)

[protected] void MetricMathBase::RegisterSampledPair(CDPPropertyBase *source, CDPPropertyBase *sampled)

[protected] void MetricMathBase::SnapshotSampledProperties()

[override virtual] void MetricMathBase::StartWindow(uint64_t fromTs, uint64_t toTs)

Reimplemented from IMetricMath::StartWindow().

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2026 CDP Technologies. Privacy and cookie policy.

Return to top