libgpiod
Loading...
Searching...
No Matches
gpiod::edge_event_buffer Class Referencefinal

Object into which edge events are read for better performance. More...

#include <edge-event-buffer.hpp>

Public Types

using const_iterator = ::std::vector<edge_event>::const_iterator
 Constant iterator for iterating over edge events stored in the buffer.
 

Public Member Functions

 edge_event_buffer (::std::size_t capacity=64)
 Constructor. Creates a new edge event buffer with given capacity.
 
 edge_event_buffer (const edge_event_buffer &other)=delete
 
 edge_event_buffer (edge_event_buffer &&other) noexcept
 Move constructor.
 
 ~edge_event_buffer ()
 
edge_event_bufferoperator= (const edge_event_buffer &other)=delete
 
edge_event_bufferoperator= (edge_event_buffer &&other) noexcept
 Move assignment operator.
 
const edge_eventget_event (unsigned int index) const
 Get the constant reference to the edge event at given index.
 
::std::size_t num_events () const
 Get the number of edge events currently stored in the buffer.
 
::std::size_t capacity () const noexcept
 Maximum capacity of the buffer.
 
const_iterator begin () const noexcept
 Get a constant iterator to the first edge event currently stored in the buffer.
 
const_iterator end () const noexcept
 Get a constant iterator to the element after the last edge event in the buffer.
 

Detailed Description

Object into which edge events are read for better performance.

The edge_event_buffer allows reading edge_event objects into an existing buffer which improves the performance by avoiding needless memory allocations.

Member Typedef Documentation

◆ const_iterator

using gpiod::edge_event_buffer::const_iterator = ::std::vector<edge_event>::const_iterator

Constant iterator for iterating over edge events stored in the buffer.

Constructor & Destructor Documentation

◆ edge_event_buffer() [1/3]

gpiod::edge_event_buffer::edge_event_buffer ( ::std::size_t capacity = 64)
explicit

Constructor. Creates a new edge event buffer with given capacity.

Parameters
capacityCapacity of the new buffer.

◆ edge_event_buffer() [2/3]

gpiod::edge_event_buffer::edge_event_buffer ( const edge_event_buffer & other)
delete

◆ edge_event_buffer() [3/3]

gpiod::edge_event_buffer::edge_event_buffer ( edge_event_buffer && other)
noexcept

Move constructor.

Parameters
otherObject to move.

◆ ~edge_event_buffer()

gpiod::edge_event_buffer::~edge_event_buffer ( )

Member Function Documentation

◆ begin()

const_iterator gpiod::edge_event_buffer::begin ( ) const
noexcept

Get a constant iterator to the first edge event currently stored in the buffer.

Returns
Constant iterator to the first element.

◆ capacity()

::std::size_t gpiod::edge_event_buffer::capacity ( ) const
noexcept

Maximum capacity of the buffer.

Returns
Buffer capacity.

◆ end()

const_iterator gpiod::edge_event_buffer::end ( ) const
noexcept

Get a constant iterator to the element after the last edge event in the buffer.

Returns
Constant iterator to the element after the last edge event.

◆ get_event()

const edge_event & gpiod::edge_event_buffer::get_event ( unsigned int index) const

Get the constant reference to the edge event at given index.

Parameters
indexIndex of the event in the buffer.
Returns
Constant reference to the edge event.

◆ num_events()

::std::size_t gpiod::edge_event_buffer::num_events ( ) const

Get the number of edge events currently stored in the buffer.

Returns
Number of edge events in the buffer.

◆ operator=() [1/2]

edge_event_buffer & gpiod::edge_event_buffer::operator= ( const edge_event_buffer & other)
delete

◆ operator=() [2/2]

edge_event_buffer & gpiod::edge_event_buffer::operator= ( edge_event_buffer && other)
noexcept

Move assignment operator.

Parameters
otherObject to move.
Returns
Reference to self.

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