RTI Connext Modern C++ API  Version 6.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::sub::IsValidData< T > Struct Template Reference

<<extension>> A functor that returns true when a sample has valid data. More...

#include <LoanedSamplesImpl.hpp>

Public Types

typedef LoanedSamples< T >
::value_type 
sample_type
 LoanedSample type.
 

Public Member Functions

bool operator() (const sample_type &sample)
 Returns true if this sample contains valid data.
 

Detailed Description

template<typename T>
struct rti::sub::IsValidData< T >

<<extension>> A functor that returns true when a sample has valid data.

This functor is useful in algorithms that iterate on LoanedSamples. For example:

LoanedSamples<Foo> samples = reader.take();
std::cout << "Valid sample count: "
<< std::count_if(samples.begin(), samples.end(), IsValidData<Foo>());

A similar utility is the iterator valid_data().

See Also
dds::sub::LoanedSamples
valid_data()

Member Typedef Documentation

template<typename T >
typedef LoanedSamples<T>::value_type rti::sub::IsValidData< T >::sample_type

LoanedSample type.

Member Function Documentation

template<typename T >
bool rti::sub::IsValidData< T >::operator() ( const sample_type sample)
inline

Returns true if this sample contains valid data.

That is, if sample.info().valid().


RTI Connext Modern C++ API Version 6.0.1 Copyright © Sat Nov 23 2019 Real-Time Innovations, Inc