A buffer event structure, strongly associated to a connection, an input buffer and an output_buffer

Introduced properties

fun enable(operation: Int)

libevent :: NativeBufferEvent :: enable

Enable a bufferevent.
fun input_buffer: InputNativeEvBuffer

libevent :: NativeBufferEvent :: input_buffer

The input buffer associated to self
fun output_buffer: OutputNativeEvBuffer

libevent :: NativeBufferEvent :: output_buffer

The output buffer associated to self
fun read_buffer(buf: NativeEvBuffer): Int

libevent :: NativeBufferEvent :: read_buffer

Read data from this buffer
fun setcb(conn: Connection)

libevent :: NativeBufferEvent :: setcb

Set callbacks to read_callback_native, write_callback and event_callback of conn
init socket(base: NativeEventBase, fd: Int, options: Int): NativeBufferEvent

libevent :: NativeBufferEvent :: socket

Socket-based NativeBufferEvent that reads and writes data onto a network
fun write(line: CString, length: Int): Int

libevent :: NativeBufferEvent :: write

Write length bytes of line
fun write_buffer(buf: NativeEvBuffer): Int

libevent :: NativeBufferEvent :: write_buffer

Write data to this buffer
fun write_byte(value: Int): Int

libevent :: NativeBufferEvent :: write_byte

Write the byte value

Redefined properties

redef type SELF: NativeBufferEvent

libevent $ NativeBufferEvent :: SELF

Type of this instance, automatically specialized in every class
redef fun free

libevent $ NativeBufferEvent :: free

Free the memory pointed by this pointer

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun enable(operation: Int)

libevent :: NativeBufferEvent :: enable

Enable a bufferevent.
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun input_buffer: InputNativeEvBuffer

libevent :: NativeBufferEvent :: input_buffer

The input buffer associated to self
fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
fun output_buffer: OutputNativeEvBuffer

libevent :: NativeBufferEvent :: output_buffer

The output buffer associated to self
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun read_buffer(buf: NativeEvBuffer): Int

libevent :: NativeBufferEvent :: read_buffer

Read data from this buffer
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun setcb(conn: Connection)

libevent :: NativeBufferEvent :: setcb

Set callbacks to read_callback_native, write_callback and event_callback of conn
init socket(base: NativeEventBase, fd: Int, options: Int): NativeBufferEvent

libevent :: NativeBufferEvent :: socket

Socket-based NativeBufferEvent that reads and writes data onto a network
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun write(line: CString, length: Int): Int

libevent :: NativeBufferEvent :: write

Write length bytes of line
fun write_buffer(buf: NativeEvBuffer): Int

libevent :: NativeBufferEvent :: write_buffer

Write data to this buffer
fun write_byte(value: Int): Int

libevent :: NativeBufferEvent :: write_byte

Write the byte value
package_diagram libevent::NativeBufferEvent NativeBufferEvent core::Pointer Pointer libevent::NativeBufferEvent->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

libevent $ NativeBufferEvent
# A buffer event structure, strongly associated to a connection, an input buffer and an output_buffer
extern class NativeBufferEvent `{ struct bufferevent * `}

	# Socket-based `NativeBufferEvent` that reads and writes data onto a network
	new socket(base: NativeEventBase, fd, options: Int) `{
		return bufferevent_socket_new(base, fd, options);
	`}

	# Enable a bufferevent.
	fun enable(operation: Int) `{
		bufferevent_enable(self, operation);
	`}

	# Set callbacks to `read_callback_native`, `write_callback` and `event_callback` of `conn`
	fun setcb(conn: Connection) import Connection.read_callback_native,
	Connection.write_callback, Connection.event_callback, CString `{
		Connection_incr_ref(conn);
		bufferevent_setcb(self,
			(bufferevent_data_cb)c_read_cb,
			(bufferevent_data_cb)c_write_cb,
			(bufferevent_event_cb)c_event_cb, conn);
	`}

	# Write `length` bytes of `line`
	fun write(line: CString, length: Int): Int `{
		return bufferevent_write(self, line, length);
	`}

	# Write the byte `value`
	fun write_byte(value: Int): Int `{
		unsigned char byt = (unsigned char)value;
		return bufferevent_write(self, &byt, 1);
	`}

	redef fun free `{ bufferevent_free(self); `}

	# The output buffer associated to `self`
	fun output_buffer: OutputNativeEvBuffer `{ return bufferevent_get_output(self); `}

	# The input buffer associated to `self`
	fun input_buffer: InputNativeEvBuffer `{ return bufferevent_get_input(self); `}

	# Read data from this buffer
	fun read_buffer(buf: NativeEvBuffer): Int `{ return bufferevent_read_buffer(self, buf); `}

	# Write data to this buffer
	fun write_buffer(buf: NativeEvBuffer): Int `{ return bufferevent_write_buffer(self, buf); `}
end
lib/libevent/libevent.nit:341,1--388,3