ImFusion SDK 4.3
DataComponent< T > Class Template Reference

#include <ImFusion/Base/DataComponent.h>

Main specialization of DataComponentBase for regular types. More...

+ Inheritance diagram for DataComponent< T >:

Detailed Description

template<typename T>
class ImFusion::DataComponent< T >

Main specialization of DataComponentBase for regular types.

If you need serialization, make your class T inherit from DataComponent<T> and implement the copy- constructor (T(const T&)), the copy assignment operator (T& operator=(const T&)), and the equality comparison operator (bool operator==(const T&) const / friend bool operator==(const T&, const T&)). The clone(), assign(), and equals() methods will forward to your class methods.

You also still need to implement id(), configure(), and configuration() to make your class serializable.

Example:

class FooComponent : public DataComponent<FooComponent>
{
public:
// copy-constructor and copy-assignment operator are auto-generated by the compiler
bool operator==(const FooComponent& rhs) const { return rhs.i == i; }
// you still need to implement these methods to make the DataComponent serializable
std::string id() const override;
void configure(const Properties*) override;
void configuration(Properties*) const override;
private:
int i = 0;
};
Main specialization of DataComponentBase for regular types.
Definition DataComponent.h:109
Storage container for serialization of arbitrary types, internally backed by strings.
Definition Properties.h:50
Examples
DicomExtensionExample.cpp, and DicomExtensionExample3.cpp.

Public Member Functions

std::unique_ptr< DataComponentBaseclone () const override
 Creates a clone of this data component.
 
std::unique_ptr< Subclass > cloneDerived () 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 DataComponentBase
virtual std::string id () const =0
 Returns a unique string identifier for this type of data component.
 
- Public Member Functions inherited from Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
 
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
 
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
 

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 Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ clone()

template<typename T>
std::unique_ptr< DataComponentBase > clone ( ) const
inlineoverridevirtual

Creates a clone of this data component.

Implements DataComponentBase.

◆ assign()

template<typename T>
bool assign ( const DataComponentBase & other)
inlineoverridevirtual

Assigns the content of other to this data component.

Parameters
otherSource data component for assignment.

Implements DataComponentBase.

◆ equals()

template<typename T>
bool equals ( const DataComponentBase & other) const
inlineoverridevirtual

Compares this data component to other for equality.

Parameters
otherOther data component to compare this one to.

Implements DataComponentBase.


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