LuciadCPillar 2023.1.04
luciad::FeatureChange Class Reference

Represents a change for a feature. More...

#include <luciad/models/features/IFeatureModel.h>

Public Member Functions

 FeatureChange (Feature feature, FeatureChangeType featureChangeType)
 Constructs the feature change based on a feature instance and the type of change for the feature. More...
 
 FeatureChange (FeatureId featureId, FeatureChangeType featureChangeType)
 Constructs the feature change based on the id of the feature and the type of change for the feature. More...
 
std::optional< FeaturegetFeature () const
 Returns the changed feature, or std::nullopt. More...
 
FeatureChangeType getFeatureChangeType () const
 Returns the type of change. More...
 
FeatureId getFeatureId () const
 Returns the id of the changed feature. More...
 
bool operator!= (const FeatureChange &fc) const
 
bool operator== (const FeatureChange &fc) const
 

Detailed Description

Represents a change for a feature.

It indicates for a given feature, identified by its luciad::FeatureId, whether it has been added, updated, etc. It can optionally contain the actual feature instance rather than only the id of the feature. The benefit of the latter is that it may avoid performing queries on the luciad::IFeatureModel.

Constructor & Destructor Documentation

◆ FeatureChange() [1/2]

luciad::FeatureChange::FeatureChange ( FeatureId  featureId,
FeatureChangeType  featureChangeType 
)
inline

Constructs the feature change based on the id of the feature and the type of change for the feature.

Parameters
featureIdthe id of the feature.
featureChangeTypethe type of change.

◆ FeatureChange() [2/2]

luciad::FeatureChange::FeatureChange ( Feature  feature,
FeatureChangeType  featureChangeType 
)
inline

Constructs the feature change based on a feature instance and the type of change for the feature.

Parameters
featurethe feature.
featureChangeTypethe type of change.

Member Function Documentation

◆ getFeature()

std::optional< Feature > luciad::FeatureChange::getFeature ( ) const
inline

Returns the changed feature, or std::nullopt.

If no value is available, the model can be queried to retrieve it. In case of a FeatureChangeType::Remove change type, this method will always return std::nullopt.

Returns
the changed feature, or std::nullopt.

◆ getFeatureChangeType()

FeatureChangeType luciad::FeatureChange::getFeatureChangeType ( ) const
inline

Returns the type of change.

Returns
the type of change.

◆ getFeatureId()

FeatureId luciad::FeatureChange::getFeatureId ( ) const
inline

Returns the id of the changed feature.

When this class is used as part of FeatureModelUpdate, the feature id will not always be available. This method will throw an exception in that case. Use FeatureChange::getFeature in that case. See FeatureModelUpdate::Builder::addFeature for more information.

In all other cases, this method will not thrown an exception.

Returns
the id of the changed feature. It is guaranteed to be non-nullptr for Update and Remove changes. Not necessarily for Add.
Exceptions
LogicExceptionwhen the feature has no id.

◆ operator!=()

bool luciad::FeatureChange::operator!= ( const FeatureChange fc) const
inline

◆ operator==()

bool luciad::FeatureChange::operator== ( const FeatureChange fc) const
inline