#include <MRFeatureObject.h>
Public Member Functions | |
| template<typename T , typename C , typename SetterFunc > | |
| FeatureObjectSharedProperty (std::string name, FeaturePropertyKind kind, T(C::*m_getter)(ViewportId) const, SetterFunc m_setter) | |
Public Attributes | |
| std::string | propertyName |
| FeaturePropertyKind | kind |
| std::function< FeaturesPropertyTypesVariant(const FeatureObject *objectToInvoke, ViewportId id)> | getter |
| due to getAllSharedProperties in FeatureObject returns static vector, we need externaly setup object to invoke setter ad getter. | |
| std::function< void(const FeaturesPropertyTypesVariant &, FeatureObject *objectToInvoke, ViewportId id)> | setter |
FeatureObjectSharedProperty struct is designed to represent a shared property of a feature object, enabling the use of generalized getter and setter methods for property manipulation. propertyName: A string representing the name of the property. getter : A std::function encapsulating a method with no parameters that returns a FeaturesPropertyTypesVariant.This allows for a generic way to retrieve the value of the property. setter : A std::function encapsulating a method that takes a FeaturesPropertyTypesVariant as a parameter and returns void.This function sets the value of the property. The templated constructor of this struct takes the property name, pointers to the getter and setter member functions, and a pointer to the object( obj ). The constructor initializes the propertyName and uses lambdas to adapt the member function pointers into std::function objects that conform to the expected getter and setter signatures.The getter lambda invokes the getter method on the object, and the setter lambda ensures the correct variant type is passed before invoking the setter method.