libgpiod  1.6.2
Data Structures | Public Member Functions | Static Public Attributes
gpiod::line_bulk Class Reference

Represents a set of GPIO lines. More...

#include <gpiod.hpp>

Data Structures

class  iterator
 Iterator for iterating over lines held by line_bulk. More...
 

Public Member Functions

GPIOD_API line_bulk (void)=default
 Default constructor. More...
 
GPIOD_API line_bulk (const ::std::vector< line > &lines)
 Construct a line_bulk from a vector of lines. More...
 
GPIOD_API line_bulk (const line_bulk &other)=default
 Copy constructor. More...
 
GPIOD_API line_bulk (line_bulk &&other)=default
 Move constructor. More...
 
GPIOD_API line_bulkoperator= (const line_bulk &other)=default
 Assignment operator. More...
 
GPIOD_API line_bulkoperator= (line_bulk &&other)=default
 Move assignment operator. More...
 
GPIOD_API ~line_bulk (void)=default
 Destructor.
 
GPIOD_API void append (const line &new_line)
 Add a line to this line_bulk object. More...
 
GPIOD_API lineget (unsigned int offset)
 Get the line at given offset. More...
 
GPIOD_API lineoperator[] (unsigned int offset)
 Get the line at given offset without bounds checking. More...
 
GPIOD_API unsigned int size (void) const noexcept
 Get the number of lines currently held by this object. More...
 
GPIOD_API bool empty (void) const noexcept
 Check if this line_bulk doesn't hold any lines. More...
 
GPIOD_API void clear (void)
 Remove all lines from this object.
 
GPIOD_API void request (const line_request &config, const ::std::vector< int > default_vals=::std::vector< int >()) const
 Request all lines held by this object. More...
 
GPIOD_API void release (void) const
 Release all lines held by this object.
 
GPIOD_API ::std::vector< int > get_values (void) const
 Read values from all lines held by this object. More...
 
GPIOD_API void set_values (const ::std::vector< int > &values) const
 Set values of all lines held by this object. More...
 
GPIOD_API void set_config (int direction, ::std::bitset< 32 > flags, const ::std::vector< int > values=::std::vector< int >()) const
 Set configuration of all lines held by this object. More...
 
GPIOD_API void set_flags (::std::bitset< 32 > flags) const
 Set configuration flags of all lines held by this object. More...
 
GPIOD_API void set_direction_input () const
 Change the direction all lines held by this object to input.
 
GPIOD_API void set_direction_output (const ::std::vector< int > &values) const
 Change the direction all lines held by this object to output. More...
 
GPIOD_API line_bulk event_wait (const ::std::chrono::nanoseconds &timeout) const
 Poll the set of lines for line events. More...
 
GPIOD_API operator bool (void) const noexcept
 Check if this object holds any lines. More...
 
GPIOD_API bool operator! (void) const noexcept
 Check if this object doesn't hold any lines. More...
 
GPIOD_API iterator begin (void) noexcept
 Returns an iterator to the first line. More...
 
GPIOD_API iterator end (void) noexcept
 Returns an iterator to the element following the last line. More...
 

Static Public Attributes

static GPIOD_API const unsigned int MAX_LINES
 Max number of lines that this object can hold.
 

Detailed Description

Represents a set of GPIO lines.

Internally an object of this class stores an array of line objects owned by a single chip.

Definition at line 572 of file gpiod.hpp.

Constructor & Destructor Documentation

◆ line_bulk() [1/4]

GPIOD_API gpiod::line_bulk::line_bulk ( void  )
default

Default constructor.

Creates an empty line_bulk object.

◆ line_bulk() [2/4]

GPIOD_API gpiod::line_bulk::line_bulk ( const ::std::vector< line > &  lines)

Construct a line_bulk from a vector of lines.

Parameters
linesVector of gpiod::line objects.
Note
All lines must be owned by the same GPIO chip.

◆ line_bulk() [3/4]

GPIOD_API gpiod::line_bulk::line_bulk ( const line_bulk other)
default

Copy constructor.

Parameters
otherOther line_bulk object.

◆ line_bulk() [4/4]

GPIOD_API gpiod::line_bulk::line_bulk ( line_bulk &&  other)
default

Move constructor.

Parameters
otherOther line_bulk object.

Member Function Documentation

◆ append()

GPIOD_API void gpiod::line_bulk::append ( const line new_line)

Add a line to this line_bulk object.

Parameters
new_lineLine to add.
Note
The new line must be owned by the same chip as all the other lines already held by this line_bulk object.

◆ begin()

GPIOD_API iterator gpiod::line_bulk::begin ( void  )
noexcept

Returns an iterator to the first line.

Returns
A line_bulk iterator.

◆ empty()

GPIOD_API bool gpiod::line_bulk::empty ( void  ) const
noexcept

Check if this line_bulk doesn't hold any lines.

Returns
True if this object is empty, false otherwise.

◆ end()

GPIOD_API iterator gpiod::line_bulk::end ( void  )
noexcept

Returns an iterator to the element following the last line.

Returns
A line_bulk iterator.

◆ event_wait()

GPIOD_API line_bulk gpiod::line_bulk::event_wait ( const ::std::chrono::nanoseconds &  timeout) const

Poll the set of lines for line events.

Parameters
timeoutNumber of nanoseconds to wait before returning an empty line_bulk.
Returns
Returns a line_bulk object containing lines on which events occurred.

◆ get()

GPIOD_API line& gpiod::line_bulk::get ( unsigned int  offset)

Get the line at given offset.

Parameters
offsetOffset of the line to get.
Returns
Reference to the line object.

◆ get_values()

GPIOD_API ::std::vector<int> gpiod::line_bulk::get_values ( void  ) const

Read values from all lines held by this object.

Returns
Vector containing line values the order of which corresponds with the order of lines in the internal array.

◆ operator bool()

GPIOD_API gpiod::line_bulk::operator bool ( void  ) const
explicitnoexcept

Check if this object holds any lines.

Returns
True if this line_bulk holds at least one line, false otherwise.

◆ operator!()

GPIOD_API bool gpiod::line_bulk::operator! ( void  ) const
noexcept

Check if this object doesn't hold any lines.

Returns
True if this line_bulk is empty, false otherwise.

◆ operator=() [1/2]

GPIOD_API line_bulk& gpiod::line_bulk::operator= ( const line_bulk other)
default

Assignment operator.

Parameters
otherOther line_bulk object.
Returns
Reference to this object.

◆ operator=() [2/2]

GPIOD_API line_bulk& gpiod::line_bulk::operator= ( line_bulk &&  other)
default

Move assignment operator.

Parameters
otherOther line_bulk object.
Returns
Reference to this object.

◆ operator[]()

GPIOD_API line& gpiod::line_bulk::operator[] ( unsigned int  offset)

Get the line at given offset without bounds checking.

Parameters
offsetOffset of the line to get.
Returns
Reference to the line object.
Note
No bounds checking is performed.

◆ request()

GPIOD_API void gpiod::line_bulk::request ( const line_request config,
const ::std::vector< int >  default_vals = ::std::vector< int >() 
) const

Request all lines held by this object.

Parameters
configRequest config (see gpiod::line_request).
default_valsVector of default values. Only relevant for output direction requests.

◆ set_config()

GPIOD_API void gpiod::line_bulk::set_config ( int  direction,
::std::bitset< 32 >  flags,
const ::std::vector< int >  values = ::std::vector< int >() 
) const

Set configuration of all lines held by this object.

Parameters
directionNew direction.
flagsReplacement flags.
valuesVector of values to set. Must be the same size as the number of lines held by this line_bulk. Only relevant for output direction requests.

◆ set_direction_output()

GPIOD_API void gpiod::line_bulk::set_direction_output ( const ::std::vector< int > &  values) const

Change the direction all lines held by this object to output.

Parameters
valuesVector of values to set. Must be the same size as the number of lines held by this line_bulk.

◆ set_flags()

GPIOD_API void gpiod::line_bulk::set_flags ( ::std::bitset< 32 >  flags) const

Set configuration flags of all lines held by this object.

Parameters
flagsReplacement flags.

◆ set_values()

GPIOD_API void gpiod::line_bulk::set_values ( const ::std::vector< int > &  values) const

Set values of all lines held by this object.

Parameters
valuesVector of values to set. Must be the same size as the number of lines held by this line_bulk.

◆ size()

GPIOD_API unsigned int gpiod::line_bulk::size ( void  ) const
noexcept

Get the number of lines currently held by this object.

Returns
Number of elements in this line_bulk.

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