• 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
  • IMetricMath
  • 5.1.0

IMetricMath Class

Interface for implementing custom metric math engines. More...

Header: #include <IMetricMath>
Inherited By:

MetricMathBase

  • List of all members, including inherited members

Public Functions

virtual ~IMetricMath() = default
virtual void Consume(const std::vector<MetricEvent> &events) = 0
virtual void FinishWindow() = 0
virtual void InitDone() = 0
virtual void Initialize(int measureType, const std::vector<MetricChannelSpec> &channels, const MetricOptions &opts, IMetricPropertyFactory &factory, const MetricCallbacks &callbacks) = 0
virtual void StartWindow(uint64_t fromTs, uint64_t toTs) = 0

Detailed Description

Interface for implementing custom metric math engines.

This interface defines the lifecycle and data consumption methods that a metric math engine must implement. It is used by MetricNode to drive the calculation of metrics based on incoming events.

Member Function Documentation

[default] IMetricMath::~IMetricMath()

Destroys the instance of IMetricMath. The destructor is virtual.

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

Consumes a batch of events. events The list of events to process, sorted by timestamp.

[pure virtual] void IMetricMath::FinishWindow()

Finishes the current calculation window. Finalize any time-based accumulation to window end and commit to properties as needed.

[pure virtual] void IMetricMath::InitDone()

Called after Initialize when the orchestrator considers the math engine ready to start processing. This is intended for initialization that depends on persisted/external values being loaded into created properties.

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

Initializes the math engine. measureType The type of measurement. channels The list of channels to process. opts Configuration options for the metric. factory Factory for creating dynamic properties. callbacks Callback hooks for the orchestrator.

Called once after construction. Implementer should inspect channels, read options, and create dynamic properties via factory.

[pure virtual] void IMetricMath::StartWindow(uint64_t fromTs, uint64_t toTs)

Starts a new calculation window. fromTs The start timestamp of the window (inclusive). toTs The end timestamp of the window (inclusive).

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