RTI Connext C# API  6.1.2
SampleProcessor Class Reference

A SampleProcessor automatically takes the data from the attached readers and provides each data sample to a user-defined handler function. The SampleProcessor uses a configurable thread pool to wait for the data and call the handlers. More...

Inherits IDisposable.

Public Member Functions

 SampleProcessor ()
 Creates a new SampleProcessor with default configuration. More...
 
 SampleProcessor (AsyncWaitSetProperty property)
 Creates a new SampleProcessor with the specified configuration. More...
 
void AttachDataReader< T > (DataReader< T > reader, Action< LoanedSample< T >> handler)
 Adds a handler to be called for each data sample received by a DataReader<T> . More...
 
void DetachDataReader (AnyDataReader reader)
 Detaches a reader. The SampleProcessor stops taking data from this reader. More...
 
void Dispose ()
 Releases the native resources used by this object. A finalizer is also provided, so it is not necessary to call Dispose. More...
 

Detailed Description

A SampleProcessor automatically takes the data from the attached readers and provides each data sample to a user-defined handler function. The SampleProcessor uses a configurable thread pool to wait for the data and call the handlers.

Readers cannot be disposed while they're attached to a SampleProcessor.

Constructor & Destructor Documentation

◆ SampleProcessor() [1/2]

Creates a new SampleProcessor with default configuration.

◆ SampleProcessor() [2/2]

Creates a new SampleProcessor with the specified configuration.

Member Function Documentation

◆ AttachDataReader< T >()

void AttachDataReader< T > ( DataReader< T >  reader,
Action< LoanedSample< T >>  handler 
)

Adds a handler to be called for each data sample received by a DataReader<T> .

Parameters
readerThe reader to read from. Important: the reader must not be Disposed while attached.
handlerA function that receives a LoanedSample<T>. Important: the sample is only valid inside the handler. It cannot be used after the handler returns.
Template Parameters
TThe reader's topic-type

◆ DetachDataReader()

void DetachDataReader ( AnyDataReader  reader)

Detaches a reader. The SampleProcessor stops taking data from this reader.

Parameters
readerThe reader to detach.

◆ Dispose()

void Dispose ( )

Releases the native resources used by this object. A finalizer is also provided, so it is not necessary to call Dispose.