PCE version 4C man_modulenamespaceid_tablemodified current_idOIxN class/classN referenceC hash_tablerefersizeOIxNbothIget_method, ->send_method and ->instance_variable are used to expand or redefine the behaviour of a class. They are normally used right after the class has been created. The following restrictions apply: * Instance variables cannot be redefined or extended after instances of subclasses of the class have been created. * The name of a instance variable may not already appear as an instance variable in one of the super-classes. * Behaviour of each type (send/get) may be defined both using variables and methods. If a variable has `send' access there should not be a send_method and if a variable has `get' access there should not be a get_method with the same name. If both exist, the method is used instead of the variable. Note that both the Prolog and Lisp language interfaces provide an interface for defining methods. See their resp. manual. The methods `object ->slot', `object ->send_super', `object <-get_super' and friends are designed to support the definition of method implementations. See also class code.CchainsizeOIxIeN$predicates$22eN$class/method$C.methodeN$class/object$M.object.G.slotEN#$class/object$M.object.S.get_methodXnnnnsNV.class.instance_sizeCman_variable_card identifiermodule last_modifiednamesummary descriptionsee_alsoinheritdefaultsOIxNV.class.instance_sizeRIOIx(¯è)N instance_sizenOI xcSize of an instance in bytes. Note that this does not include the size of `parts' of the instance.nnnsNV.class.changed_functionOI xNV.class.changed_functionRIOI x(¯ÒƒNchanged_functionnOI xjC-function activated if a slot of an instance is changed and `Object <->inspect' for this instance is @on.OI xIENV.class.changed_messagesXnnsNV.class.neighbour_indexOIxNV.class.neighbour_indexRIOIx,…ÆFNneighbour_indexnnnOIxIENV.class.tree_indexXnsNM.class.S.prepend_delegateOIxNM.class.S.prepend_delegateRIOIx,…³aNprepend_delegatennnOIxIENV.class.delegateXnnnsNM.class.G.instance_variableOIxNM.class.G.instance_variableRIOIx,…¾ëNinstance_variablenOIx¥Resolve the variable object from the named instance variable or the offset (1-based) of the variable. See also <-instance_variables, <-send_method or <-get_method.nnnnnsNV.class.tree_indexOIxNV.class.tree_indexRIOIx0µ¦$N tree_indexnOIxUsed for very fast implementation of `class ->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)nnnsNV.class.instance_variablesOIxNV.class.instance_variablesRIOIx9éÜNinstance_variablesnOIxþVector object holding *all* instance variables of this class. Initially a copy of the super-class. The variable object at index of this vector describes the -th slot of the object. See also `object <-slot'. The `variable <-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)))nnnsNV.class.in_event_areaOIxNV.class.in_event_areaRIOIx(¯à N in_event_areanOIxpC-function pointer to validate whether an event should be regarded to have happened `inside' a graphical object.OI xIEN,$class/graphical$M.graphical.S.in_event_areaXnnsNM.class.G.get_methodOI!xNM.class.G.get_methodRIOI"x5¦&oN get_methodnOI#xwResolve a selector name to its implementation. The returned value is either a method object or a variable. These methods operate at the class level. The methods `object <-get_method' and `object <-send_method' operate at the object level and take care of object-level defined behaviour as well as delegation. See also `object ->has_get_method' and `object <-get_method'.nnnnnsNM.class.S.delegateOI$xNM.class.S.delegateRIOI%x,…¹ŸNdelegatennnOI&xIENV.class.delegateXnnnsNV.class.get_catch_allOI'xNV.class.get_catch_allRIOI(x,…´¬N get_catch_allnOI)xIThese variables provide fast access to the methods `object <->catch_all'.OI*xIENV.class.delegate_classesXnnsNM.class.G.lookupOI+xNM.class.G.lookupRIOI,x,…­SNlookupnOI-x`Lookup the name of the class in the hash_table object @classes. If `super' is specified, <-lookup verifies the super and generates an error message on a mismatch. This method ensures that ?- get(class(point), instance, 4, 5, P). Actually returns an instance of the existing class point instead of returning an instance of a new class named point.nnnnnsNM.class.S.record_instancesOI.xNM.class.S.record_instancesRIOI/x,ìŸæNrecord_instancesnnnOI0xIENV.class.instancesXnnnsNM.class.S.realiseOI1xNM.class.S.realiseRIOI2x.äÖ0NrealisenOI3x¼Realises a class (i.e. fills the class definition). Called by the kernel if details are requested for a class that has been registered using `@pce ->define_class'. See also <-realised.nnnnnsNM.class.G.super_class_nameOI4xNM.class.G.super_class_nameRIOI5x,…±Nsuper_class_namennnOI6xIENV.class.sub_classesXnnnsNM.class.S.changed_messageOI7xNM.class.S.changed_messageRIOI8x(NO«Nchanged_messagennOI9xIEN $class/object$M.object.S.inspectXOI:xIENV.class.changed_messagesXnnnsNM.class.G.no_freedOI;xNM.class.G.no_freedRIOIxNV.class.save_styleRIOI?x,…¿åN save_stylenOI@xZFlag to help `object ->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 <-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 `file <-object'.OIAxIEN%$class/object$M.object.S.save_in_fileXnnsNM.class.S.created_messageOIBxNM.class.S.created_messageRIOICx(NO«Ncreated_messagennOIDxIEN $class/object$M.object.S.inspectXOIExIENV.class.created_messagesXnnnsNV.class.no_freedOIFxNV.class.no_freedRIOIGx*·—Nno_freednnOIHxIEN $class/pce$M.pce.G.objects_freedXOIIxIENV.class.no_createdXnsNV.class.super_classOIJxNV.class.super_classRIOIKx,…°N super_classnnnOILxIENV.class.sub_classesXnsNV.class.selection_styleOIMxNV.class.selection_styleRIOINx6¤¦ŽNselection_stylenOIOx If class is a subclass of class graphical, the selection_style determines the visual feedback of graphical objects that have `graphical <->selected: @on'. See also graphical.selection_style. This class_variable object is redefined for each subclass of graphical.nnnsNV.class.term_namesOIPxNV.class.term_namesRIOIQx,…ÅÔN term_namesnOIRx Vector of selectors of get_methods that do not require arguments. The elements of this vector object are used by `object <-_arg' to return the nth (1-based) argument of the term-description. If element of this vector has value , the class must define <- and the nth (1-based) result of `object <-_arg' is the result of <- on the object. For example, class point defined <-term_functor: point and <-term_vector vector(x,y). Therefore the term has the form: point(`point<-x', `point<-y')OISxIeN$class/object$M.object.G._argEN $topics$69XnnsNV.class.delegateOITxNV.class.delegateRIOIUx0µ£~NdelegatenOIVxýThe chain <-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. ->delegate Adds a variable at the end ->prepend_delegate Adds a variable at the start See also `class <-send_method' and `class <-get_method'.nnnsNV.class.send_tableOIWxNV.class.send_tableRIOIXx,…È-N send_tablennnOIYxIENV.class.get_tableXnsNM.class.S.handleOIZxNM.class.S.handleRIOI[x(¯qNhandlennOI\xIeN$predicates$20eN $topics$138eN%$class/graphical$M.graphical.S.handleEN $topics$91XOI]xIENV.class.handlesXnnnsNV.class.freed_messagesOI^xNV.class.freed_messagesRIOI_x,…ĉNfreed_messagesnOI`x/When an instance of this class is freed that has `object <->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 `->changed_message' and `->created_message'.OIaxIeNV.class.created_messagesENV.class.changed_messagesXnnsNV.class.clone_functionOIbxNV.class.clone_functionRIOIcx,}E—Nclone_functionnOIdxeC-function pointer. This function is responsible for cloning alien data associated with an instance.OIexIEN $topics$139XnnsNM.class.S.save_style_variableOIfxNM.class.S.save_style_variableRIOIgx,…ÀNsave_style_variablenOIhx3Set the `variable <-save_style' for named variable.nnnnnsNV.class.sourceOIixNV.class.sourceRIOIjx(SYNsourcennOIkxIEN $tools$14XnnsNV.class.send_methodsOIlxNV.class.send_methodsRIOImx,…»âN send_methodsnnnOInxIENV.class.get_methodsXnsNM.class.S.freed_messageOIoxNM.class.S.freed_messageRIOIpx(NO«N freed_messagennOIqxIEN $class/object$M.object.S.inspectXOIrxIENV.class.freed_messagesXnnnsNV.class.realisedOIsxNV.class.realisedRIOItx-c"NrealisednOIuxVBool indicating whether or not the class is fully built. A class that is not realised <-name, <-super_class, <-sub_classes, <-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 ->realise on the class to build the class.nOIvxIENM.class.S.realiseXnsNV.class.handlesOIwxNV.class.handlesRIOIxx5~^JNhandlesnOIyx9Graphical classes only. This chain contains handles that are available to each instance of the class. Note that handles can be defined simultaneous at the class- and the instance-level. Handles at the class level are normally declared using the handle/4 construct expanded by the Prolog defined class compiler.OIzxIeN $topics$138eN$$class/graphical$V.graphical.handleseN$class/handle$C.handleXnnsN V.class.solidOI{xN V.class.solidRIOI|x(zìñNsolidnnOI}xIEN+$class/device$V.device.area_must_be_clearedXnnsNM.class.G.send_methodOI~xNM.class.G.send_methodRIOIx,…¾¢N send_methodnnnOI€xIENM.class.G.get_methodXnnnsNM.class.S.is_aOIxNM.class.S.is_aRIOI‚x0µ­ñNis_anOIƒx‡Succeeds if the receiver is the same class of the argument or an (indirect) sibling of the argument. See also `object ->instance_of'.OI„xIEN#$class/object$M.object.S.same_classXnnnnsNM.class.S.send_methodOI…xNM.class.S.send_methodRIOI†x,…º N send_methodnnOI‡xIeN$predicates$21eN$class/method$C.methodeN$class/object$M.object.S.slotEN$$class/object$M.object.S.send_methodXOIˆxIENM.class.S.get_methodXnnnsNV.class.get_methodsOI‰xNV.class.get_methodsRIOIŠx,…¼aN get_methodsnOI‹xøChain of methods of the indicated type (send/get) (re)defined for this class. Inherited or delegated methods are not in this chain. See also <-get_method and <-send_method, `object <-send_method' and `object <-get_method', for resolving methods.OIŒxIENV.class.get_tableXnnsNM.class.S.initialiseOIxNM.class.S.initialiseRIOIŽx,9eN initialisenOIxInitialise a class specified name. The new class is (initially) a copy of the provided super-class. After creation of a new class the following methods are commonly used to refine it: * ->instance_variable * ->delegate * ->send_method * ->get_methodnnnnnsNV.class.get_tableOIxNV.class.get_tableRIOI‘x,…ÈõN get_tablenOI’x±The -local_table maps instance_variable names onto instance variables and is used by `object <->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 <-instance_variable -get_table <-get_method -send_table <-send_methodOI“xIENV.class.get_methodsXnnsNM.class.G.instanceOI”xNM.class.G.instanceRIOI•x>øHPNinstancenOI–xžCreate an instance of this class. Creating an instance entails the following steps: * Memory is allocated for the instance. All slots are filled with `variable<-alloc_value' of the corresponding variable object. * If it concerns a global object, a named reference is created. * if the class has instance variables with non-constant initial value or a function as initial value (see `variable -initial_value'), execute these funcions and assign the slot values. * The PCE virtual machine invokes `object ->initialise' to the new object with the arguments given to this method. * If `object ->initialise' fails, the exception `initialise_failed' is raised using `@pce ->exception'. The context parameter is the (incomplete) object reference. * If ->initialise succeeds, `Class <-instance' returns the new object. NOTE: `@pce <-instance: Class, any ...' is an alternative for creating objects. This gate has two advantages: type conversion allows you to specify the class-name rather than the class, and -if the class does not yet exist-, an exception is raised allowing the class autoloading to create it. See also class create and new/2OI—xIeNM.class.G.converteN$class/pce$M.pce.S.exceptioneN#$class/object$M.object.S.initialiseeN($class/variable$V.variable.initial_valueeN$class/pce$M.pce.G.instanceeN $predicates$1eNV.class.created_messagesEN $topics$7XnnnnsN V.class.nameOI˜xN V.class.nameRIOI™x,…²XNnamenOIšx€Name of the class. Class names are global and must be unique. The table @classes maps class-names into class objects. PCE 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_.nnnsNM.class.S.instance_variableOI›xNM.class.S.instance_variableRIOIœx,…¹÷Ninstance_variablennOIxIeN$class/variable$C.variableEN$predicates$18XOIžxIENM.class.S.get_methodXnnnsNV.class.un_answerOIŸxNV.class.un_answerRIOI x0´H]N un_answernOI¡xHint for the incremental garbage collector. By default, fresh created instances (either by new/2 or some get method that generates an instance) are stored in a special table. As these instances are `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 <-un_answer flags to @off. This tells `variable ->send' not to remove the chain from the answer table.nnnsNM.class.S.clone_style_variableOI¢xNM.class.S.clone_style_variableRIOI£x,…±¦Nclone_style_variablenOI¤x¦Set `variable <-clone_style' of named variable. Equivalent to get(Class, instance_variable, Name, Var), send(Var, clone_style, Style) See also `object <-clone'.nnnnnsNV.class.local_tableOI¥xNV.class.local_tableRIOI¦x,…È5N local_tablennnOI§xIENV.class.get_tableXnsNC.classCman_class_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherituser_interfacebugsOI¨xNC.classRIOI©x5}JGNclassnOIªx9Class class describes a PCE class. All classes (including class class itself) are an instance of this class. The classes are organised in a single-inheritance hierarchy. Class object is the root of the PCE class hierarchy. A class can be regarded meta-data describing (among others) the following properties of its instances: # Instance variables (slots, attributes) The instance variables define the data-structure (types and access permissions) of the instances of the class. # Send methods A collection of methods that can be activated by the `send' virtual machine operation. # Get methods A collection of methods that can be activated by the `get' virtual machine operation. # Class variables Class-constants that can be initialised from the Defaults file, see `@pce ->load_defaults'. The user may create and modify classes to extend the PCE system. Classes are created just like any other PCE object: ?- new(X, class(person, object)). Creates a class named person below class object. Initially class person only differs from class object by its name.OI«xIeN $topics$87eN $topics$96eN$class/method$C.methodeN$tools$3eN$class/variable$C.variableeN $class/interceptor$C.interceptoreN$class/code$C.codeeN$class/behaviour$C.behaviourXnnnsNV.class.created_messagesOI¬xNV.class.created_messagesRIOI­x2ˆœ´Ncreated_messagesnOI®xcChain of code objects invoked when an instance of this class is created. After successful creation of an instance, the following arguments are forwarded to each code object in the chain: @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 `file <-object' clone Cloned using `object <-clone' May be used to keep track of the set of instances of this class in combination wit ->freed_message. See also ->changed_message and ->record_instances.OI¯xIeNV.class.freed_messageseNV.class.changed_messageseN $predicates$1ENM.class.G.instanceXnnsNV.class.instancesOI°xNV.class.instancesRIOI±x2ˆœ„N instancesnOI²xThe hash_table object <-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 <-clone and `file <-object'. This table is attached using ->record_instances. If the first argument is @on or @default an <-instances table is attached. If this argument is @off a possible associated table is detached. If the second (`recursive') argument is @on (default), ->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 ->created_message and ->freed_message.nnnsNV.class.lookup_methodOI³xNV.class.lookup_methodRIOI´x,…ÉN lookup_methodnnnOIµxIENV.class.initialise_methodXnsNV.class.changed_messagesOI¶xNV.class.changed_messagesRIOI·x,…à Nchanged_messagesnOI¸xîChain of code objects activated after a slot of an instance has changed that has `object ->inspect: @on'. 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 ->created_message and ->freed_message.OI¹xIeNV.class.freed_messageseNV.class.created_messageseN $class/object$M.object.S.inspectENV.class.changed_functionXnnsNV.class.no_createdOIºxNV.class.no_createdRIOI»x<ÈJêN no_creatednOI¼xNumber of instances created/freed. By default it returns the number of created instances of the class itself. If `subtoo' is @on it adds the number of instances created in all <-sub_classes recursively. To find the actual number of existing instances, subtract <-no_freed.OI½xIEN$$clasc.pce$M.pce.G.objects_allocatedXnnsNV.class.initialise_methodOI¾xNV.class.initialise_methodRIOI¿x,…ÉNinitialise_methodnOIÀxºDirect pointers to these methods for two reasons: * Get the system started while there are no chains or hash_tables yet. * Fast implementation of object creation and type conversion.nnnsNM.class.G.convertOIÁxNM.class.G.convertRIOIÂx,…«ªNconvertnOIÃx/Converts a class-name or type object of `type <-kind: class' into a class object. If a class does not exist and the argument is a name, the `@pce ->exception: undefined_class' with context argument the name of the required class is generated. This mechanism is used by the autoloader (pce_autoload/2).OIÄxIeN$predicates$17eN$class/pce$M.pce.S.exceptionENM.class.G.instanceXnnnnsNV.class.sub_classesOIÅxNV.class.sub_classesRIOIÆx,…±8N sub_classesnOIÇxAThe variables <-sub_classes and <-super_class define the class hierarchy. The class hierarchy is visualised using the `Class Hierarchy' tool from the online manual tools. The <-super_class of class object is @nil. The method <-super_class_name is used to create the appropriate term description (see `object <-_arg').nnnsNV.class.convert_methodOIÈxNV.class.convert_methodRIOIÉx,…É(Nconvert_methodnnOIÊxIEN $topics$118XOIËxIENV.class.initialise_methodXOIÌxInherited from the super-class.sNV.class.clone_styleOIÍxNV.class.clone_styleRIOIÎx,ËŸN clone_stylenOIÏx/Determines how an instance of this class is cloned. Possible values: # recursive Clone this instance and all its parts recursively. # none The instance itself is returned. Used for reusable objects. # nil `Object <-clone' returns @nil. See also `object <-clone' and `variable <-clone_style'.OIÐxIeN $topics$139EN$class/object$M.object.G.cloneXnnsNV.class.send_catch_allOIÑxNV.class.send_catch_allRIOIÒx(¯ÛxNsend_catch_allnnOIÓxIENV.class.delegate_classesXOIÔxIENV.class.get_catch_allXnXaCnumber O IÕxx