PCL
pcl::ConsistentlyDefined< T > Class Template Reference

An object that can be in consistently defined or undefined/inconsistent states. More...

#include <IntegrationMetadata.h>

+ Inheritance diagram for pcl::ConsistentlyDefined< T >:

Public Member Functions

 ConsistentlyDefined ()
 
 ConsistentlyDefined (const ConsistentlyDefined &)=default
 
 ConsistentlyDefined (const T &value)
 
void ForceValue (const T &value)
 
bool IsConsistent () const
 
bool IsConsistentlyDefined (const String &what=String()) const
 
bool IsDefined () const
 
const T & operator() () const
 
ConsistentlyDefinedoperator+= (const ConsistentlyDefined &other)
 
ConsistentlyDefinedoperator+= (const T &otherValue)
 
ConsistentlyDefinedoperator= (const ConsistentlyDefined &other)
 
T & operator= (const T &value)
 
void SetInconsistent ()
 
String ToString () const
 
void Undefine ()
 

Detailed Description

template<class T>
class pcl::ConsistentlyDefined< T >

ConsistentlyDefined is similar to Optional: it stores an instance of the template argument T, along with a defined state Boolean flag. In addition, this class includes a consistency state flag. A consistently defined object has been both defined and optionally ckecked for consistency against other objects or values. Two objects are considered consistent if an equality operator is true for them.

As happens with Optional, ConsistentlyDefined objects update their defined and consistency states automatically as they are created, copied and assigned.

Note
This is a support utility class used internally by several modules, made public mainly for code organization purposes. We make this class public because it can be useful, but it still has not been fully developed as it should to fulfill standard PCL quality standards.

Definition at line 88 of file IntegrationMetadata.h.

Constructor & Destructor Documentation

◆ ConsistentlyDefined() [1/3]

template<class T >
pcl::ConsistentlyDefined< T >::ConsistentlyDefined ( )
inline

Constructs an undefined, consistent ConsistentlyDefined object.

The value instance will be default-constructed implicitly, which means that the type T must provide valid default construction semantics.

Definition at line 98 of file IntegrationMetadata.h.

◆ ConsistentlyDefined() [2/3]

template<class T >
pcl::ConsistentlyDefined< T >::ConsistentlyDefined ( const ConsistentlyDefined< T > &  )
default

Copy constructor.

The value instance will be copy-constructed implicitly, which means that the type T must provide valid copy construction semantics if this constructor is invoked.

◆ ConsistentlyDefined() [3/3]

template<class T >
pcl::ConsistentlyDefined< T >::ConsistentlyDefined ( const T &  value)
inline

Constructs a defined, consistent ConsistentlyDefined object with the specified value.

Definition at line 121 of file IntegrationMetadata.h.

Member Function Documentation

◆ ForceValue()

template<class T >
void pcl::ConsistentlyDefined< T >::ForceValue ( const T &  value)
inline

Changes the value in this object in a forcible way, i.e. without checking for consistency.

Definition at line 322 of file IntegrationMetadata.h.

◆ IsConsistent()

template<class T >
bool pcl::ConsistentlyDefined< T >::IsConsistent ( ) const
inline

Returns true iff this object is consistent, even if it has not been defined.

Definition at line 274 of file IntegrationMetadata.h.

◆ IsConsistentlyDefined()

template<class T >
bool pcl::ConsistentlyDefined< T >::IsConsistentlyDefined ( const String what = String()) const
inline

If this object is in defined/consistent state, then this function returns true.

If this object is in undefined state, this function returns false.

If this object is in defined/inconsistent state, this function returns false. In this case, if the what string is not empty, a warning message will be written to the core platform's console alerting about the inconsistent state.

Definition at line 290 of file IntegrationMetadata.h.

◆ IsDefined()

template<class T >
bool pcl::ConsistentlyDefined< T >::IsDefined ( ) const
inline

Returns true iff this object has been defined, even if it's inconsistent.

Definition at line 265 of file IntegrationMetadata.h.

◆ operator()()

template<class T >
const T& pcl::ConsistentlyDefined< T >::operator() ( ) const
inline

Returns a reference to the value stored in this object.

If this object is undefined, the returned value may be unpredictable, depending on construction semantics for the type T.

Definition at line 257 of file IntegrationMetadata.h.

◆ operator+=() [1/2]

template<class T >
ConsistentlyDefined& pcl::ConsistentlyDefined< T >::operator+= ( const ConsistentlyDefined< T > &  other)
inline

Addition/assignment operator. Returns a reference to this object.

If this object is inconsistent, then this function does nothing but returning a reference to this.

If this object is consistent, then:

  • If other is defined and this is defined, then the value of other will be added to this object's value, and this object will remain in defined/consistent state.
  • If other is defined and this is not defined, then the value of other will be assigned to this object, and this object will be in defined/consistent state.
  • If other is not defined and this is defined, then this object will be in defined/inconsistent state.

Definition at line 201 of file IntegrationMetadata.h.

◆ operator+=() [2/2]

template<class T >
ConsistentlyDefined& pcl::ConsistentlyDefined< T >::operator+= ( const T &  otherValue)
inline

Addition/assignment operator. Returns a reference to this object.

If this object is inconsistent, then this function does nothing but returning a reference to this.

If this object is consistent, then:

  • If this object is defined, then otherValue will be added to this object's value, and this object will remain in defined/consistent state.
  • If this object is not defined, then otherValue will be assigned to this object, and this object will be in defined/consistent state.

Definition at line 237 of file IntegrationMetadata.h.

◆ operator=() [1/2]

template<class T >
ConsistentlyDefined& pcl::ConsistentlyDefined< T >::operator= ( const ConsistentlyDefined< T > &  other)
inline

Copy assignment operator. Returns a reference to this object.

If this object is inconsistent, then this function does nothing but returning a reference to this.

If this object is consistent, then:

  • If other is defined and this is defined, then if the values of both objects are different, this object will be in defined/inconsistent state.
  • If other is defined and this is not defined, then the value of other will be assigned to this object, and this object will be in defined/consistent state.
  • If other is not defined and this is defined, then this object will be in defined/inconsistent state.

Definition at line 157 of file IntegrationMetadata.h.

◆ operator=() [2/2]

template<class T >
T& pcl::ConsistentlyDefined< T >::operator= ( const T &  value)
inline

Assigns the specified value to this object. Returns a reference to this object. After assigning a value, a ConsistentlyDefined object will be in defined/consistent state.

Definition at line 132 of file IntegrationMetadata.h.

◆ SetInconsistent()

template<class T >
void pcl::ConsistentlyDefined< T >::SetInconsistent ( )
inline

Force this object to be in inconsistent state.

Definition at line 313 of file IntegrationMetadata.h.

◆ ToString()

template<class T >
String pcl::ConsistentlyDefined< T >::ToString ( ) const
inline

Returns a String representation of the value in this object if it has been defined (even if it's inconsistent). Otherwise returns an empty string.

Definition at line 332 of file IntegrationMetadata.h.

◆ Undefine()

template<class T >
void pcl::ConsistentlyDefined< T >::Undefine ( )
inline

Force this object to be in undefined state.

Definition at line 305 of file IntegrationMetadata.h.


The documentation for this class was generated from the following file: