| Did you know ... | Search Documentation: |
| Instance variables |
<->inspect’for this instance
is @on.
-changed_messages->inspect.
Each code object is
activated in turn and the returned status of the execution is ignored.
Argument binding:
@arg1 Instance who's slot changed @arg2 Name of the changed slot.
Changes are not notified before the initialisation of the instance is complete or after the destruction has started.
This trap is used by the inspector tool. See also class->created_message
and
class->freed_message.
<-clone
returns @nil.
See also object<-clone
and variable<-clone_style.
<-clone
@arg1 Name of the class @arg2 Reference to the new instance @arg3 Action that caused the creation of the object
Possible values for @arg3 are:
new Normal creation (new/2 or class <-instance)loaded Loaded by source_sink <-objectclone Cloned using object <-clone
May be used to keep track of the set of instances of this class in
combination wit class->freed_message.
See also class->changed_message
and class->record_instances.
-freed_messages -changed_messages <-instance<-delegate
consists of instance variable
objects that should be used for delegation. The PCE message passing
system will try to forward an incoming message to the values of these
instance variables after it failed to locate an implementation at the
object or class level. The elements of this chain are tried in the order
they appear in the chain.
class ->delegateAdds a variable at the end class ->prepend_delegateAdds a variable at the start
See also class<-send_method
and class<-get_method.
<->inspect:
@on’,
its reference will be passed to the code
objects in this chain. Argument binding:
@arg1: Object to be freed.
This message is sent as the first action of object->free.
See also
class->changed_message
and class->created_message.
-created_messages -changed_messages<->catch_all’.
<-get_method
and class<-send_method, object<-send_method
and‘object
class<-get_method’,
for resolving methods.
-get_table<->slot.
The -get_table and -send_table both map selectors onto implementations.
The implementation is either a method or a variable. All these tables
only contain the currently resolved methods: they are initially empty.
Used and maintained by:
-local_table class <-instance_variable-get_table class <-get_method-send_table class <-send_method
-get_methodsHandles at the class level are normally declared using the handle/4 construct expanded by the Prolog defined class compiler.
-handles inside a graphical
object.
->in_event_area
parts of the instance.<-slot.
The behaviour<-context
argument may be used to find the class on which a variable is defined.
The following code returns a chain of instance variables not
inherited:
new(Vs, chain),
send(Class?instance_variables, for_all,
if(@arg1?context == Class,
message(Vs, append, @arg1)))
<-instances
contains all instances of this class that have been created since the
table was attached to the class. Note that instances of sub-classes are not
in this table. The table is maintained by the new() and free()
virtual machine operations as well as by object<-clone
and
source_sink<-object.
This table is attached using class->record_instances.
If the first argument is @on
or @default an class<-instances
table is attached. If this argument is @off
a possible associated table is detached. If the second (recursive)
argument is @on
(default), class->record_instances
will be invoked with the same arguments on all sub-classes. Thus
?- send(class(object), record_instances).
Will record the instances of all classes.
See also class->created_message
and class->freed_message.
-get_tablePCE built-in classes have relatively short and simple names. It is adviced to prefix application classes with a common prefix to avoid conflicts with other packages or future PCE classes. For example, all classes consituting PceDraw are called draw_<something>.
subtoo is @on
it adds the number of instances created in all
class<-sub_classes
recursively.
To find the actual number of existing instances, subtract
class<-no_freed.
<-objects_allocated<-name, class<-super_class, class<-sub_classes,
class<-summary and -make_class_function
are defined. All other slots have undefined values.
When information or instances of a non-realised class are requested,
XPCE will invoke class->realise
on the class to build the class.
Inherits description from: class->realise
->save_in_file.
If this methods encounters a slot holding an instance of this class it
will save the instance according to the value of class<-save_style:
normal Save the instance to the file external Save the (named) reference to the file nil Write @nil to the file
See also variable<-save_style
and source_sink<-object.
->save_in_file<->selected: @on’.
See also graphical.selection_style. This
class_variable
object is redefined for each subclass of graphical.-get_table<-sub_classes
and class<-super_class
define the class hierarchy. The class hierarchy is visualised using the‘Class
Hierarchy’tool from the online manual tools. The class<-super_class
of class object is @nil.
The method class<-super_class_name
is used to create the appropriate term description (see object<-_arg).
<-_arg
to return the nth (1-based) argument of the term-description.
If element <n> of this vector has value <selector>, the
class must define <-<selector> and the nth (1-based) result of object<-_arg
is the result of <-<selector> on the object.
For example, class point
defined class<-term_functor: point and class<-term_vector
vector(x,y). Therefore the term has the form:
point(`point<-x`, `point<-y`)
<-_arg ->is_a
and object->instance_of.
After a modification on the class hierarchy (normally a class created),
PCE numbers the class-hierarchy top-down and left-to-right.
The slot -tree_index is assigned the current number when this class
is first reached, while the slot -neighbour_index is assigned the
current number after numbering the subtree below this class. Now,
a class A is_a B iff
(A<-tree_index) >= (B<-tree_index) AND (A<-tree_index) < (B<-neighbour_index)
answers to methods, this table is called the answer
table internally.
If an object is made an attribute of another object, it will be
removed from the answer table and reclaimed by the garbage collector it
its reference count drops to zero. Object remaining in the answer table
are reclaimed if the context in which they where created is
ended. The main event-loop starts/ends such a context and likewise do
all method executions.
Now consider the code below, which produces an alphabetically ordered list of class-names:
?- new(Chain, chain),
send(@classes, for_all,
message(Chain, append, @arg1)),
send(Chain, sort).
With the above schema, Chain will be an answer object
after creation. It will be made a slot of the message
object, thus loosing its answer status. After the chain->for_all,
PCE will garbage collect the message. The reference count of the chain
drops to zero and thus the chain is reclaimed too.
This situation is common and therefore class code
sets the class<-un_answer
flags to @off.
This tells variable->send
not to remove the chain from the answer table.