# Copyright (c) 2023 Yuki Kimoto
# MIT License

class Sys::Poll::PollfdArray {
  version_from Sys;
  
  # Fields
  has length : ro int;
  
  has capacity : ro int;
  
  # Class Methods
  native static method new : Sys::Poll::PollfdArray ($length : int = 0, $capacity : int = -1);
  
  # Instance Methods
  native method DESTROY : void ();
  
  native method fd : int ($index : int);
  
  native method set_fd : void ($index : int, $fd : int);
  
  native method events : int ($index : int);
  
  native method set_events : void ($index : int, $events : int);
  
  native method revents : int ($index : int);
  
  native method set_revents : void ($index : int, $revents : int);
  
  native method push : void ($fd : int);
  
  native method remove : void ($index : int);
  
  private native method _maybe_extend : void ($min_capacity : int);
}