libgpiod  2.0.1
Public Types | Public Member Functions
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. More...
 
 edge_event_buffer (const edge_event_buffer &other)=delete
 
 edge_event_buffer (edge_event_buffer &&other) noexcept
 Move constructor. More...
 
edge_event_bufferoperator= (const edge_event_buffer &other)=delete
 
edge_event_bufferoperator= (edge_event_buffer &&other) noexcept
 Move assignment operator. More...
 
const edge_eventget_event (unsigned int index) const
 Get the constant reference to the edge event at given index. More...
 
::std::size_t num_events () const
 Get the number of edge events currently stored in the buffer. More...
 
::std::size_t capacity () const noexcept
 Maximum capacity of the buffer. More...
 
const_iterator begin () const noexcept
 Get a constant iterator to the first edge event currently stored in the buffer. More...
 
const_iterator end () const noexcept
 Get a constant iterator to the element after the last edge event in the buffer. More...
 

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.

Definition at line 37 of file edge-event-buffer.hpp.

Constructor & Destructor Documentation

◆ edge_event_buffer() [1/2]

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/2]

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

Move constructor.

Parameters
otherObject to move.

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=()

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: