SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
satdump::handlers::ProductHandler Class Reference

Product handler base class. More...

#include <product_handler.h>

Inheritance diagram for satdump::handlers::ProductHandler:
satdump::handlers::Handler satdump::handlers::ProcessingHandler satdump::handlers::ImageProductHandler satdump::handlers::PunctiformProductHandler

Public Member Functions

nlohmann::json getInstrumentCfg ()
virtual void saveResult (std::string directory)
 ProductHandler (std::shared_ptr< products::Product > p, bool dataset_mode=false, std::function< bool(nlohmann::ordered_json &)> filterPreset=[](auto &) { return true;})
 Constructor.
std::string getName ()
 Get this handler's readable name.
std::string getID ()
Public Member Functions inherited from satdump::handlers::Handler
virtual void drawMenu ()=0
 Render explorer menu left sidebar.
virtual void drawContents (ImVec2 win_size)=0
 Render explorer contents (center/left)
virtual void drawMenuBar ()
 Render explorer menu bar (in the left sidebar)
virtual bool drawTreeMenu (std::shared_ptr< Handler > &h)
 Render explorer menu bar (in the left sidebar)
std::string getTreeID ()
 Get this handler's ImGui ID for rendering in the tree.
bool hasSubhandlers ()
 Check if this handler contains any sub-handlers.
virtual void addSubHandler (std::shared_ptr< Handler > handler, bool ontop=false)
 Add a new subhandler.
virtual void delSubHandler (std::shared_ptr< Handler > handler, bool now=false)
 Delete a subhandler.
virtual std::vector< std::shared_ptr< Handler > > getAllSubHandlers ()
 Get all current subhandlers.
void setCanBeSelected (bool v)
 Set if a handler can be select in the tree.
void setCanBeDragged (bool v)
 Set if a handler can be dragged around in the tree.
void setCanBeDraggedTo (bool v)
 Set if a handler can be dragged to in the tree.
void setSubHandlersCanBeDragged (bool v)
 Set if a handler's subhandlers can be dragged to in the tree.
void setCanSubBeReorgTo (bool v)
 Set if a handler's subhandlers can be reordered.
virtual void setConfig (nlohmann::json p)
 Optional, allows setting a configuration/state from JSON.
virtual nlohmann::json getConfig ()
 Optional, allows getting a configuration/state as JSON.
virtual void resetConfig ()
 Optional, allows resetting the handler's configuration.
Public Member Functions inherited from satdump::handlers::ProcessingHandler
void process ()
 Performing processing. This is not multi-threaded, intended to call it externally.
void set_is_processing (bool v)
 Set the processing status externally, to force waiting before starting a new thread.
void asyncProcess ()
 Perform processing asynchronously, in a thread.

Protected Member Functions

void resetPreset ()
std::string generateFileName ()
bool renderPresetMenu ()
 Draw preset selection menu.
void tryApplyDefaultPreset ()
 Attempts to a apply a default preset if present in the configuration.
Protected Member Functions inherited from satdump::handlers::ProcessingHandler
virtual void do_process ()=0
 Actual processing function to be implemented by the child class.

Protected Attributes

bool preset_reset_by_handler = false
std::shared_ptr< products::Productproduct
nlohmann::ordered_json instrument_cfg
std::string product_internal_name
Protected Attributes inherited from satdump::handlers::Handler
std::vector< std::shared_ptr< Handler > > subhandlers
std::mutex subhandlers_mtx
Protected Attributes inherited from satdump::handlers::ProcessingHandler
bool is_processing = false
std::mutex is_processing_mtx
std::thread async_thread

Additional Inherited Members

Static Public Member Functions inherited from satdump::handlers::ProcessingHandler
static std::string getID ()
static std::shared_ptr< HandlergetInstance ()
Public Attributes inherited from satdump::handlers::Handler
std::string handler_tree_icon = "N"

Detailed Description

Product handler base class.

A common usecase of handlers in the explorer is to allow displaying and doing basic manipulation on instrument products.

To this effect, this base class implements the common interface for handling those instrument products.

Parameters
productraw product pointer, to be cast in the inheriting class
instrument_cfgTODOREWORK instrument configuration file, for presets

Constructor & Destructor Documentation

◆ ProductHandler()

satdump::handlers::ProductHandler::ProductHandler ( std::shared_ptr< products::Product > p,
bool dataset_mode = false,
std::function< bool(nlohmann::ordered_json &)> filterPreset = [](auto &) { return true; } )

Constructor.

Parameters
pproduct to handle
dataset_modeif true, only displays the instrument name, otherwise adds timestamp and source name for clarity
filterPresetoptional function to filter the presets list

Member Function Documentation

◆ getID()

std::string satdump::handlers::ProductHandler::getID ( )
inlinevirtual

◆ getName()

std::string satdump::handlers::ProductHandler::getName ( )
inlinevirtual

Get this handler's readable name.

Returns
name as a string

Reimplemented from satdump::handlers::Handler.

◆ renderPresetMenu()

bool satdump::handlers::ProductHandler::renderPresetMenu ( )
protected

Draw preset selection menu.

Returns
if one was selected

The documentation for this class was generated from the following files:
  • src-core/handlers/product/product_handler.h
  • src-core/handlers/product/product_handler.cpp