UniqueValueReceiver< T, ERROR_WHEN_AMBIGUOUS > Class Template Reference

#include <valuereceiver.h>

Detailed Description

template<typename T, Bool ERROR_WHEN_AMBIGUOUS = true>
class maxon::UniqueValueReceiver< T, ERROR_WHEN_AMBIGUOUS >

ValueReceiver type that will copy the first found value for later access and keep iterating for counting values or validating uniqueness. Useful for calls such as GetConnections when we are interested in enforcing that there is a single connection on a port. Iterations continue until the end is reached, or when non uniqueness is detected. of the given type.

String myString;
...
UniqueValueReceiver<const String&, false> recv;
myString.Split('a', false, recv) iferr_return;
if (recv.IsPopulated())
DiagnosticOutput("Found a unique value");
Definition: c4d_string.h:41
Bool IsPopulated() const
Definition: string.h:1451
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:170
#define iferr_return
Definition: resultbase.h:1524

Public Member Functions

 operator ValueReceiver< T > ()
 
const Opt< typename std::decay< T >::type > & Get () const
 
Bool IsPopulated () const
 
Bool IsEmpty () const
 
Int GetCount () const
 
void Reset ()
 

Private Attributes

Opt< typename std::decay< T >::type_value
 
Int _count
 

Member Function Documentation

◆ operator ValueReceiver< T >()

operator ValueReceiver< T > ( )

◆ Get()

const Opt<typename std::decay<T>::type>& Get ( ) const

◆ IsPopulated()

Bool IsPopulated ( ) const

◆ IsEmpty()

Bool IsEmpty ( ) const

◆ GetCount()

Int GetCount ( ) const

◆ Reset()

void Reset ( )

Member Data Documentation

◆ _value

Opt<typename std::decay<T>::type> _value
private

◆ _count

Int _count
private