Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
256 lines (161 sloc) 8.3 KB

Module ephp_object

This module is intended to store the object collection based on an array.

Description

The original PHP has an array to collect all of the instances from all of the possible objects. When a new instance is generated, it's allocated in an empty position of that array.

The variables only referenciate to that object so, all of the variables which contains objects are pointers indeed.

Function Index

add/2stores an object searching an empty slot for it and returning the Object ID where it was stored.
add_link/1Equivalent to add_link / 2.
add_link/2increases the number of links for an object.
clone/2clones an object generating a new one and executing its __clone function by the way.
destroy/2Destroy the Objects storage.
get/1retrieves an object based on the Object ID.
get/2retrieves an object based on the Object ID.
get_class/1retrieves the class record for a provided Object ID.
get_class/2retrieves the class record for a provided Object ID.
get_class_name/1Equivalent to get_class_name / 2.
get_class_name/2retrieves the class name for a provided Object ID.
get_context/1Equivalent to get_context / 2.
get_context/2retrieves the object context for an provided Object ID.
remove/2Equivalent to remove / 3.
remove/3decreases the number of links for an object.
remove_all/2removes all of the objects stored using objects_id.
set/2stores an object given the Object ID.
set/3stores an object given the Object ID.
set_class/2set a class for an existent object.
start_link/0creates a new Objects storage.

Function Details

add/2


add(Objects::ephp:objects_id(), Object::ephp_object()) -> object_id()

stores an object searching an empty slot for it and returning the Object ID where it was stored.

add_link/1


add_link(Obj_ref::obj_ref()) -> ok

Equivalent to add_link / 2.

add_link/2


add_link(Objects::ephp:objects_id(), ObjectId::object_id()) -> ok

increases the number of links for an object.

clone/2


clone(Context::context(), Obj_ref::obj_ref()) -> obj_ref()

clones an object generating a new one and executing its __clone function by the way.

destroy/2


destroy(Context::context(), Ref::ephp:objects_id()) -> ok

Destroy the Objects storage.

get/1


get(Obj_ref::obj_ref()) -> undefined | ephp_object()

retrieves an object based on the Object ID.

get/2


get(Ref::ephp:objects_id(), ObjectId::object_id()) -> undefined | ephp_object()

retrieves an object based on the Object ID.

get_class/1


get_class(Obj_ref::obj_ref()) -> class()

retrieves the class record for a provided Object ID.

get_class/2


get_class(Objects::ephp:objects_id(), ObjectId::object_id()) -> class()

retrieves the class record for a provided Object ID.

get_class_name/1


get_class_name(Obj_ref::obj_ref()) -> class_name()

Equivalent to get_class_name / 2.

get_class_name/2


get_class_name(Objects::ephp:objects_id(), ObjectId::object_id()) -> class_name()

retrieves the class name for a provided Object ID.

get_context/1


get_context(Obj_ref::obj_ref()) -> context()

Equivalent to get_context / 2.

get_context/2


get_context(Objects::ephp:objects_id(), ObjectId::object_id()) -> context()

retrieves the object context for an provided Object ID.

remove/2


remove(Context::context(), Obj_ref::obj_ref()) -> ok

Equivalent to remove / 3.

remove/3


remove(Context::context(), Objects::ephp:objects_id(), ObjectId::object_id()) -> ok

decreases the number of links for an object. If arrives to zero, the object is removed.

remove_all/2


remove_all(Context::context(), Objects::ephp:objects_id()) -> ok

removes all of the objects stored using objects_id.

set/2


set(Obj_ref::obj_ref(), Object::ephp_object()) -> ok

stores an object given the Object ID.

set/3


set(Objects::ephp:objects_id(), ObjectId::object_id(), Object::ephp_object()) -> ok

stores an object given the Object ID.

set_class/2


set_class(Obj_ref::ephp:objects_id(), Class::class()) -> ok

set a class for an existent object.

start_link/0


start_link() -> {ok, ephp:objects_id()}

creates a new Objects storage.