ImFusion SDK 4.3
PointsStorageComponent Class Reference

#include <ImFusion/Base/PointsStorageComponent.h>

Data component for storing and managing point sets. More...

+ Inheritance diagram for PointsStorageComponent:

Detailed Description

Data component for storing and managing point sets.

This component allows you to store multiple point sets, each identified by a unique name. Each point set can be of a specific type derived from PointsOnData, and you can retrieve or create point sets with the specified type and name. This component keeps track of the created points sets offering automatic persistence and sharing between algorithms. Example usage:

// SharedImageSet or any Data loaded or created in the application
SharedImageSet sis = ...;
// Get or create a point set named "MyPoints" of type PointsOnImage
std::shared_ptr<PointsOnImage> points = StorageComponent::getPoints<PointsOnImage>(sis, "MyPoints");
// ... add points to the point set ...
// If we save the SharedImageSet, the point set will be saved as well as part of PointsStorageComponent.
// points2 will point to the same instance as points
auto points2 = PointsStorageComponent::getPoints<PointsOnImage>(sis, "MyPoints");
Set of images independent of their storage location.
Definition SharedImageSet.h:42

Public Member Functions

bool operator== (const PointsStorageComponent &) const
 
template<class T, class DataType, std::enable_if_t< std::is_base_of_v< PointsOnData, T >, bool > = 0, std::enable_if_t< std::is_base_of_v< Data, DataType >, bool > = 0>
std::shared_ptr< T > getOrCreate (DataType &data, const std::string &name)
 Get a PointsOnData instance with the specified name and type.
 
bool add (const std::string &name, const PointsOnData *pod)
 Adds a new point set with the specified name.
 
bool addConfiguration (const std::string &name, std::unique_ptr< Properties > properties)
 Adds the configuration of a new point set with the specified name.
 
std::vector< std::stringnames () const
 List all point set names stored by the component.
 
bool contains (const std::string &name) const
 Check if a point set with the specified name exists.
 
std::string id () const override
 Returns a unique string identifier for this type of data component.
 
void configure (const Properties *) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *) const override
 Serialize the current object configuration into the given Properties object.
 
PropertiesgetConfiguration (const std::string &name) const
 
- Public Member Functions inherited from DataComponent< PointsStorageComponent >
std::unique_ptr< DataComponentBaseclone () const override
 Creates a clone of this data component.
 
std::unique_ptr< SubclasscloneDerived () const
 
bool assign (const DataComponentBase &other) override
 Assigns the content of other to this data component.
 
bool equals (const DataComponentBase &other) const override
 Compares this data component to other for equality.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 
- Public Member Functions inherited from SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
 
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
 
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.
 

Static Public Member Functions

template<class T, class DataType, std::enable_if_t< std::is_base_of_v< PointsOnData, T >, bool > = 0, std::enable_if_t< std::is_base_of_v< Data, DataType >, bool > = 0>
static std::shared_ptr< T > getOrCreatePoints (DataType &data, const std::string &name)
 Get a PointsOnData instance associated to the provided data, with the specified name and type.
 

Additional Inherited Members

- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from DataComponentBase
 DataComponentBase (const DataComponentBase &)=default
 
DataComponentBaseoperator= (const DataComponentBase &other)=default
 
- Protected Member Functions inherited from SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ getOrCreatePoints()

template<class T, class DataType, std::enable_if_t< std::is_base_of_v< PointsOnData, T >, bool > = 0, std::enable_if_t< std::is_base_of_v< Data, DataType >, bool > = 0>
static std::shared_ptr< T > getOrCreatePoints ( DataType & data,
const std::string & name )
inlinestatic

Get a PointsOnData instance associated to the provided data, with the specified name and type.

This is a convenience function that retrieves the PointsStorageComponent from the data and calls getOrCreate() on it.

◆ getOrCreate()

template<class T, class DataType, std::enable_if_t< std::is_base_of_v< PointsOnData, T >, bool > = 0, std::enable_if_t< std::is_base_of_v< Data, DataType >, bool > = 0>
std::shared_ptr< T > getOrCreate ( DataType & data,
const std::string & name )
inline

Get a PointsOnData instance with the specified name and type.

If the instance does not exist yet, it will be created. If it exists and is of the requested type, a shared pointer to it is returned.

◆ add()

bool add ( const std::string & name,
const PointsOnData * pod )

Adds a new point set with the specified name.

Warning
The ownership of the PointsOnData instance is not transferred to the PointsStorageComponent. Only its configuration is stored.
Returns
true on success, false if a point set with the same name already exists.
Deprecated
"Use addConfiguration() instead"

◆ addConfiguration()

bool addConfiguration ( const std::string & name,
std::unique_ptr< Properties > properties )

Adds the configuration of a new point set with the specified name.

If a point set with the same name already exists, it will not be overwritten and this function will fail (return false).

Returns
true on success, false if a point set with the same name already exists.

◆ id()

std::string id ( ) const
inlineoverridevirtual

Returns a unique string identifier for this type of data component.

Note
To avoid conflicts make sure to include potential plugin names into this ID. Due to the modular architecture of the ImFusion library, uniqueness of IDs cannot be checked at compile time. However, DataComponentFactory will check the uniqueness of the ID during registration.

Implements DataComponentBase.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configure this object instance by de-serializing the given Properties.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configuration() for the inverse functionality

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Serialize the current object configuration into the given Properties object.

The default implementation will do so automatically for all registered Parameter and SubProperty instances.

See also
configure() for the inverse functionality

Reimplemented from Configurable.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close