OpenEV
Extending OpenCV to event-based vision
 
Loading...
Searching...
No Matches
ev::AbstractReader_ Class Referenceabstract

This is an auxiliary class. This class cannot be instanced. More...

#include <abstract-reader.hpp>

Inheritance diagram for ev::AbstractReader_:
ev::PlainTextReader

Public Member Functions

 AbstractReader_ (const std::size_t buffer_size, const bool use_threading)
 Constructor for AbstractReader_.
 
bool read (Event &e)
 Read the next event.
 
bool read (Vector &vector, const int n)
 Read next n events.
 
bool read (Queue &queue, const int n, const bool keep_size=false)
 Read next n events.
 
bool read_t (Vector &vector, const double t)
 Read the next events until the specified duration is reached.
 
bool read_t (Queue &queue, const double t, const bool keep_size=false)
 Get the next events until the specified duration is reached and store them in a queue.
 
bool skip (int n)
 Skip the next n events.
 
bool skip_t (const double t)
 Skip events for the specified duration.
 
void reset ()
 Start reading from the first event.
 
virtual std::size_t count ()=0
 Count the total number of events available.
 

Static Public Attributes

static constexpr std::size_t NO_BUFFER = 0
 
static constexpr std::size_t INF_BUFFER = std::numeric_limits<std::size_t>::max()
 

Protected Member Functions

virtual bool read_ (Event &e)=0
 
virtual void reset_ ()=0
 

Protected Attributes

const std::size_t bufferSize_
 
std::thread thread_
 
Queue buffer_
 
std::mutex bufferMutex_
 
std::atomic< bool > threadRunning_ {}
 

Detailed Description

This is an auxiliary class. This class cannot be instanced.

Constructor & Destructor Documentation

◆ AbstractReader_()

ev::AbstractReader_::AbstractReader_ ( const std::size_t buffer_size,
const bool use_threading )

Constructor for AbstractReader_.

Parameters
buffer_sizeThe size of the buffer to be used by the reader.

Member Function Documentation

◆ count()

virtual std::size_t ev::AbstractReader_::count ( )
nodiscardpure virtual

Count the total number of events available.

Returns
The total number of events available.

Implemented in ev::PlainTextReader.

◆ read() [1/3]

bool ev::AbstractReader_::read ( ev::Event & e)

Read the next event.

Parameters
eReference to an Event object where the next event will be stored.
Returns
True if the event was successfully read, false otherwise.

◆ read() [2/3]

bool ev::AbstractReader_::read ( ev::Queue & queue,
const int n,
const bool keep_size = false )

Read next n events.

Parameters
nNumber of events to get
queueEvent queue
keep_sizeIf true, pop one event for each insertion to maintain queue size.
Returns
True if queue populated with n new events

◆ read() [3/3]

bool ev::AbstractReader_::read ( ev::Vector & vector,
const int n )

Read next n events.

Parameters
vectorEvent vector
nNumber of events to get
Returns
True if vector populated with n new events

◆ read_t() [1/2]

bool ev::AbstractReader_::read_t ( ev::Queue & queue,
const double t,
const bool keep_size = false )

Get the next events until the specified duration is reached and store them in a queue.

Parameters
tDuration to get events for.
queueEvent queue to store the events.
keep_sizeIf true, pop one event for each insertion to maintain queue size.
Returns
True if the queue is populated with events for the specified duration.

◆ read_t() [2/2]

bool ev::AbstractReader_::read_t ( ev::Vector & vector,
const double t )

Read the next events until the specified duration is reached.

Parameters
vectorEvent vector to store the events.
tDuration to get events for.
Returns
True if the vector is populated with events for the specified duration.

◆ reset()

void ev::AbstractReader_::reset ( )

Start reading from the first event.

Note
The behaviour of reset should be implemented in the derived classes.

◆ skip()

bool ev::AbstractReader_::skip ( int n)

Skip the next n events.

Parameters
nNumber of events to skip.
Returns
True if the skip was successful.

◆ skip_t()

bool ev::AbstractReader_::skip_t ( const double t)

Skip events for the specified duration.

Parameters
tDuration to skip events for.
Returns
True if the skip was successful.

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