OpenHantek
Loading...
Searching...
No Matches
ExporterInterface Class Referenceabstract

#include <exporterinterface.h>

Inheritance diagram for ExporterInterface:
ExporterCSV ExporterJSON

Public Types

enum class  Type { SnapshotExport , ContinuousExport }

Public Member Functions

virtual ~ExporterInterface ()
virtual void create (ExporterRegistry *registry)=0
virtual QString name ()=0
virtual QString format ()=0
virtual Type type ()=0
virtual bool samples (const std::shared_ptr< PPresult >)=0
virtual bool save ()=0
virtual float progress ()=0
 The progress of receiving and processing samples. If the exporter returns 1, it will be called back by the GUI via the save() method.

Protected Attributes

ExporterRegistryregistry

Detailed Description

Implement this interface and register your Exporter to the ExporterRegistry instance in the main routine to make an Exporter available.

Member Enumeration Documentation

◆ Type

enum class ExporterInterface::Type
strong

Exporters can save only a single sample set or save data continuously.

Enumerator
SnapshotExport 
ContinuousExport 

Constructor & Destructor Documentation

◆ ~ExporterInterface()

ExporterInterface::~ExporterInterface ( )
virtual

Member Function Documentation

◆ create()

virtual void ExporterInterface::create ( ExporterRegistry * registry)
pure virtual

Starts up this exporter. Acquires resources etc. Do not call this directly, it will be called by the exporter registry at some point. Release your resources in the destructor as usual.

Parameters
registryThe exporter registry instance. This is used to obtain a reference to the settings.

Implemented in ExporterCSV, and ExporterJSON.

◆ format()

virtual QString ExporterInterface::format ( )
pure virtual
Returns
Return this exporter's data format. Will be used in graphical interfaces.

Implemented in ExporterCSV, and ExporterJSON.

◆ name()

virtual QString ExporterInterface::name ( )
pure virtual
Returns
Return the text representation / name of this exporter. Will be used in graphical interfaces.

Implemented in ExporterCSV, and ExporterJSON.

◆ progress()

virtual float ExporterInterface::progress ( )
pure virtual

The progress of receiving and processing samples. If the exporter returns 1, it will be called back by the GUI via the save() method.

Returns
A number between 0..1 indicating the used capacity of this exporter. If this is a snapshot exporter, only 0 for "no samples processed yet" or 1 for "finished" will be returned. A continuous exporter may report the used memory / reserved memory ratio here.

Implemented in ExporterCSV, and ExporterJSON.

◆ samples()

virtual bool ExporterInterface::samples ( const std::shared_ptr< PPresult > )
pure virtual

A new sample set from the ExporterRegistry. The exporter needs to be active to receive samples. If it is a snapshot exporter, only one set of samples will be received.

Returns
Return true if you want to receive another sample or false if you are done (progress()==1).

Implemented in ExporterCSV, and ExporterJSON.

◆ save()

virtual bool ExporterInterface::save ( )
pure virtual

Exporter: Save your received data and perform any conversions necessary. This method will be called in the GUI thread context and can create and show dialogs if required.

Returns
Return true if saving succeeded otherwise false.

Implemented in ExporterCSV, and ExporterJSON.

◆ type()

virtual Type ExporterInterface::type ( )
pure virtual
Returns
Return the type of this exporter.
See also
ExporterInterface::Type

Implemented in ExporterCSV, and ExporterJSON.

Field Documentation

◆ registry

ExporterRegistry* ExporterInterface::registry
protected

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