FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
OrderedInputSourceProxyWithReordering Class Reference

Class that extends OrderedInputSourceProxy with the ability to tolerate a certain number of out-of-order messages that are provided by the source. More...

#include <OrderedInput.hpp>

+ Inheritance diagram for OrderedInputSourceProxyWithReordering:

Public Member Functions

 OrderedInputSourceProxyWithReordering (OrderedInputSource *interfaceFor, size_t maxReorder)
 Constructor for reordering proxy. More...
 
virtual ~OrderedInputSourceProxyWithReordering ()
 
void dropProxy ()
 Disconnects proxy from its client. More...
 
size_t totalBlocksPending () const OME_ALWAYS_INLINE
 Returns total blocks already pending. More...
 
virtual OrderedInputSource::InputBlockReturn getNextInputBlock (bool forceCopy=false, const struct timespec *maxWaitTime=nullptr) VIRTUAL_OVERRIDE
 Implementation of OrderedInputSource::getNextInputBlock() interface that inserts itself as a proxy between the caller and the true source of data. More...
 
- Public Member Functions inherited from OrderedInputSourceProxy
 OrderedInputSourceProxy (OrderedInputSource *interfaceFor)
 Construct a proxy for an existing OrderedInputSource object. More...
 
virtual ~OrderedInputSourceProxy ()
 
virtual void recoverInputBlock (OrderedInputBlock *block) VIRTUAL_OVERRIDE
 
virtual int forwardInputBlock (OrderedInputBlock *block) VIRTUAL_OVERRIDE
 
virtual const char * sourceLabel (char *outputBfr, uint_fast32_t bfrLen) const VIRTUAL_OVERRIDE
 
virtual void noteEOFread () VIRTUAL_OVERRIDE
 
virtual void noteEOFprocessed () VIRTUAL_OVERRIDE
 

Protected Attributes

OrderedInputPriorityQueue reorderQueue
 only holds data from single source More...
 
bool sawEOF
 indicates if end-of-file has been seen from this source More...
 
- Protected Attributes inherited from OrderedInputSourceProxy
OrderedInputSource * proxyFor
 points at the original input source More...
 

Detailed Description

Class that extends OrderedInputSourceProxy with the ability to tolerate a certain number of out-of-order messages that are provided by the source.

This class is used by OrderedMultipleInputFilter::addInputSource() whenever a value value greater than 0 is passed for the preloadBy parameter or the OrderedMultipleInputFilter was created with a nonzero maxReorderFromSource argument.

It can be directly used by users to handle input sources that suffer from reordered events.

Constructor & Destructor Documentation

◆ OrderedInputSourceProxyWithReordering()

OrderedInputSourceProxyWithReordering::OrderedInputSourceProxyWithReordering ( OrderedInputSource *  interfaceFor,
size_t  maxReorder 
)
inline

Constructor for reordering proxy.

Parameters
interfaceForpoints at the true OrderedInputSource object.
maxReorderspecifies the number of packets that can be reordered from this source.

A distance of up to maxReorder out-of-order input blocks can be tolerated. Normally, a very small value is sufficient to yield the desired results, but a large value may be needed when attempting to reorganize simulation output log files whose timestamps change based on the day being simulated.

References OrderedInputSource::InputBlockReturn::block, io(), LOG_COMPONENT_CERR, LOG_ENDLINE, OrderedInputSource::InputBlockReturn::obtainedLen, OrderedInputPriorityQueue::pushBlock(), reorderQueue, and sawEOF.

◆ ~OrderedInputSourceProxyWithReordering()

virtual OrderedInputSourceProxyWithReordering::~OrderedInputSourceProxyWithReordering ( )
inlinevirtual

Member Function Documentation

◆ dropProxy()

void OrderedInputSourceProxyWithReordering::dropProxy ( )
inline

Disconnects proxy from its client.

References OrderedInputSourceProxy::proxyFor.

Referenced by OrderedMultipleInputFilter::addInputSource().

◆ getNextInputBlock()

virtual OrderedInputSource::InputBlockReturn OrderedInputSourceProxyWithReordering::getNextInputBlock ( bool  forceCopy = false,
const struct timespec *  maxWaitTime = nullptr 
)
inlinevirtual

Implementation of OrderedInputSource::getNextInputBlock() interface that inserts itself as a proxy between the caller and the true source of data.

It maintains a priority queue of pending blocks, which is used to tolerate out-of-order arrival of blocks.

Reimplemented from OrderedInputSourceProxy.

References OrderedInputSource::InputBlockReturn::block, OrderedInputPriorityQueue::getQueueLength(), OrderedInputBlock::inputFile, io(), LOG_COMPONENT_CERR, LOG_ENDLINE, OrderedInputSource::InputBlockReturn::obtainedLen, OME_EXPECT_FALSE, OME_EXPECT_TRUE, OrderedInputPriorityQueue::popNextBlock(), OrderedInputSourceProxy::proxyFor, OrderedInputPriorityQueue::pushBlock(), reorderQueue, sawEOF, and OrderedInputBlock::usedLen.

◆ totalBlocksPending()

size_t OrderedInputSourceProxyWithReordering::totalBlocksPending ( ) const
inline

Returns total blocks already pending.

This is not an EOF indication; more blocks may be available from the source that have not yet been read.

References OrderedInputPriorityQueue::getQueueLength(), and reorderQueue.

Referenced by OrderedMultipleInputFilter::addInputSource().

Member Data Documentation

◆ reorderQueue

OrderedInputPriorityQueue OrderedInputSourceProxyWithReordering::reorderQueue
protected

only holds data from single source

Referenced by getNextInputBlock(), OrderedInputSourceProxyWithReordering(), and totalBlocksPending().

◆ sawEOF

bool OrderedInputSourceProxyWithReordering::sawEOF
protected

indicates if end-of-file has been seen from this source

Referenced by getNextInputBlock(), and OrderedInputSourceProxyWithReordering().


The documentation for this class was generated from the following file:
Generated: Fri Jul 31 2020 18:19:16
Support Information