| ancestors() | children() | chparents() | create() | data() |
| del_objname() | destroy() | has_ancestor() | lookup() | objname() |
| objnum() | parents() | set_objname() |
ancestors()
LIST ancestors([SYMBOL order])
This function returns a list of the ancestors of the current object. The order of the list is specified by sending either 'depth or 'breadth (for a depth-first or breadth-first order, respectively). If no order is specified, the order is depth-first. The current object is always the first element in this list. The hierarchy
$root
/ \
$obj_a |
| |
$obj_b $obj_c
\ /
$obj_d
is used in the following examples, as called from $obj_d:
ancestors()
=> [$obj_d, $obj_b, $obj_a, $obj_c, $root]
ancestors('breadth)
=> [$obj_d, $obj_b, $obj_c, $obj_a, $root]
children()
LIST children()
This function returns a list of object names for the children of the current object, in no particular order.
chparents()
INTEGER chparents(LIST parents)
This function changes the parents of the current object to the list of dbrefs in parents. If any of the dbrefs in parents do not refer to an existing object, then the error ~objnf is thrown. If any object in parents has the current object as an ancestor or is the current object, then the error ~parent is thrown. If parents is an empty list, then ~perm is thrown. Otherwise a 1 (one) is returned.
create()
OBJNUM create(LIST parents)
This function creates and returns the objnum of an object with the parents in the list parents, which should be a list of dbrefs referring to existing objects. If any of the parent dbrefs do not refer to existing objects, then the error ~objnf is thrown.
data()
DICTIONARY data([OBJNUM ancestor])
This administrative function is used to retrieve all instances of object variables the current object has, as well as the values of any object variable they define. If ancestor is not defined it will return all instances defined by any ancestor. If ancestor is defined it will only return data which is defined by the specific ancestor.
The data is returned as a dictionary in which each object variable is a key and the association to the key is the value for the object variable. If no ancestor is specified and all instances are returned, each ancestor's values are contained within another dictionary, where the key is the ancestor.
If an ancestor defines an object variable, but no instance of that variable has been created for the current object (or the instance has been cleared with the function clear_var()), it is not included in the dictionary.
The keys in a dictionary returned by this function do not have any particular ordering.
del_objname()
INTEGER del_objname()
This function deletes an objname associated with the current object. When an objname is deleted the object may only be referenced with it's objnum (for more information on objnames and objnums read Referencing Objects). If the current object does not have an objname, the error ~namenf is thrown.
destroy()
INTEGER destroy()
This function marks the current object for removal from the database. The object is destroyed when all methods executing on it are completed (suspended and preempted methods as well as the current task). Objects left orphaned by the destruction of their only parent are reparented to the parents of the parent which was destroyed.
Attempts to destroy the root or system objects will fail with the error ~perm.
has_ancestor()
INTEGER has_ancestor(OBJNUM ancestor)
This function returns 1 (true) if the current object has ancestor as an ancestor or if the current object is ancestor. Otherwise, it returns 0 (false).
lookup()
OBJNUM lookup(SYMBOL name)
This function finds the object number for the object name specified by the argument name. If no object exists with that name, the error ~namenf is thrown.
lookup('root)
=> #1
objname()
SYMBOL objname()
This function returns the symbol representation of the current object's name. If the current object does not have an object name assigned, this function throws the error ~namenf.
objnum()
INTEGER objnum()
This function returns an integer representing the current object's object number.
parents()
LIST parents()
This function returns a list of the objnames for the parents of the current object.
set_objname()
INTEGER set_objname(SYMBOL name)
This function sets the argument name as the current object's objname. If another object already has the object name name, the error ~error is thrown. If the current object already has an object name, it is replaced with the new name.
set_objname('user_bob)
=> 1