Loading...
Searching...
No Matches
edge-event-buffer.hpp
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
#ifndef __LIBGPIOD_CXX_EDGE_EVENT_BUFFER_HPP__
#define __LIBGPIOD_CXX_EDGE_EVENT_BUFFER_HPP__
#if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
#error "Only gpiod.hpp can be included directly."
#endif
#include <cstddef>
#include <iostream>
#include <memory>
#include <vector>
namespace gpiod {
class edge_event;
class line_request;
class edge_event_buffer final
{
public:
using const_iterator = ::std::vector<edge_event>::const_iterator;
explicit edge_event_buffer(::std::size_t capacity = 64);
edge_event_buffer(const edge_event_buffer& other) = delete;
edge_event_buffer(edge_event_buffer&& other) noexcept;
~edge_event_buffer();
edge_event_buffer& operator=(const edge_event_buffer& other) = delete;
edge_event_buffer& operator=(edge_event_buffer&& other) noexcept;
const edge_event& get_event(unsigned int index) const;
::std::size_t num_events() const;
::std::size_t capacity() const noexcept;
const_iterator begin() const noexcept;
const_iterator end() const noexcept;
private:
struct impl;
::std::unique_ptr<impl> _m_priv;
friend line_request;
};
::std::ostream& operator<<(::std::ostream& out, const edge_event_buffer& buf);
} /* namespace gpiod */
#endif /* __LIBGPIOD_CXX_EDGE_EVENT_BUFFER_HPP__ */
gpiod::edge_event_buffer
Object into which edge events are read for better performance.
Definition edge-event-buffer.hpp:33
gpiod::edge_event_buffer::operator=
edge_event_buffer & operator=(const edge_event_buffer &other)=delete
gpiod::edge_event_buffer::num_events
::std::size_t num_events() const
Get the number of edge events currently stored in the buffer.
gpiod::edge_event_buffer::operator=
edge_event_buffer & operator=(edge_event_buffer &&other) noexcept
Move assignment operator.
gpiod::edge_event_buffer::begin
const_iterator begin() const noexcept
Get a constant iterator to the first edge event currently stored in the buffer.
gpiod::edge_event_buffer::edge_event_buffer
edge_event_buffer(edge_event_buffer &&other) noexcept
Move constructor.
gpiod::edge_event_buffer::capacity
::std::size_t capacity() const noexcept
Maximum capacity of the buffer.
gpiod::edge_event_buffer::edge_event_buffer
edge_event_buffer(const edge_event_buffer &other)=delete
gpiod::edge_event_buffer::const_iterator
::std::vector< edge_event >::const_iterator const_iterator
Constant iterator for iterating over edge events stored in the buffer.
Definition edge-event-buffer.hpp:40
gpiod::edge_event_buffer::~edge_event_buffer
~edge_event_buffer()
gpiod::edge_event_buffer::end
const_iterator end() const noexcept
Get a constant iterator to the element after the last edge event in the buffer.
gpiod::edge_event_buffer::edge_event_buffer
edge_event_buffer(::std::size_t capacity=64)
Constructor. Creates a new edge event buffer with given capacity.
gpiod::edge_event_buffer::get_event
const edge_event & get_event(unsigned int index) const
Get the constant reference to the edge event at given index.
gpiod::edge_event
Immutable object containing data about a single edge event.
Definition edge-event.hpp:29
gpiod::line_request
Stores the context of a set of requested GPIO lines.
Definition line-request.hpp:33
gpiod
Definition chip-info.hpp:18