Name

SPVM::Sys::Poll::PollfdArray - Array of struct pollfd in the C language

Description

Sys::Poll::PollfdArray class in SPVM represents the array of struct pollfd in the C language.

Usage

use Sys::Poll::PollfdArray;

my $pollfds = Sys::Poll::PollfdArray->new(1024);

Details

This class is a pointer class. The pointer the instance has is set to an struct pollfd array.

Fields

length

has length : ro int;

The length of the array.

Class Methods

new

static method new : Sys::Poll::PollfdArray ($length : int);

Creates a new Sys::Poll::PollfdArray object given the length $lenth.

Instance Methods

DESTROY

method DESTROY : void ();

The destructor.

length

method length : int ();

Gets the lenght of the array.

fd

method fd : int ($index : int);

Returns fd of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

set_fd

method set_fd : void ($index : int, $fd : int);

Sets fd of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

events

method events : int ($index : int);

Returns events of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

set_events

method set_events : void ($index : int, $events : int);

Sets events of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

See Sys::Poll::Constant about constant values given to $revents.

events

method revents : int ($index : int);

Returns revents of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

set_revents

method set_revents : void ($index : int, $revents : int);

Sets revents of the element at index $index.

Excetpions:

$index must be greater than or equal to 0. Otherwise an exception is thrown.

$index must be less than the length of the file descripters. Otherwise an exception is thrown.

See Sys::Poll::Constant about constant values given to $revents.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License