<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Parrot - An instance of a class</title> <link rel="stylesheet" type="text/css" href="../../../resources/parrot.css" media="all"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="wrapper"> <div id="header"> <a href="http://www.parrot.org"> <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot"> </a> </div> <!-- "header" --> <div id="divider"></div> <div id="mainbody"> <div id="breadcrumb"> <a href="../../../html/index.html">Home</a> » <a href="../../../html/pmc.html">PMCs</a> » An instance of a class </div> <h1><a name="NAME" >NAME</a></h1> <p>src/pmc/object.pmc - An instance of a class</p> <h1><a name="DESCRIPTION" >DESCRIPTION</a></h1> <p>Implements an instance of a class.</p> <h2><a name="Functions" >Functions</a></h2> <dl> <dt><a name="static_INTVAL_get_attrib_index(PARROT_INTERP,_PMC_*self,_STRING_*name)" ><b><code>static INTVAL get_attrib_index(PARROT_INTERP, PMC *self, STRING *name)</b></code></a></dt> <dt><a name="static_INTVAL_get_attrib_index_keyed(PARROT_INTERP,_PMC_*self,_PMC_*key,_STRING_*name)" ><b><code>static INTVAL get_attrib_index_keyed(PARROT_INTERP, PMC *self, PMC *key, STRING *name)</b></code></a></dt> This variation bypasses the cache and finds the index of a particular parent's attribute in an object's attribute store and returns it. Returns <code>-1</code> if the attribute does not exist. <dt><a name="static_PMC_*_find_cached(PARROT_INTERP,_PMC_*_class,_STRING_*name)" ><b><code>static PMC * find_cached(PARROT_INTERP, PMC *_class, STRING *name)</b></code></a></dt> <dt><a name="static_void_cache_method(PARROT_INTERP,_PMC_*_class,_STRING_*name,_PMC_*method)" ><b><code>static void cache_method(PARROT_INTERP, PMC *_class, STRING *name, PMC *method)</b></code></a></dt> <dt><a name="void_init()" ><b><code>void init()</b></code></a></dt> Raises an exception; you can only instantiate objects from a class. <dt><a name="void_init_pmc(PMC_*class)" ><b><code>void init_pmc(PMC *class)</b></code></a></dt> Raises an exception; you can only instantiate objects from a class. <dt><a name="void_destroy()" ><b><code>void destroy()</b></code></a></dt> Just to avoid the automatic generation of one. <dt><a name="STRING_*name()" ><b><code>STRING *name()</b></code></a></dt> Returns the fully qualified name of the object's class. <dt><a name="void_mark()" ><b><code>void mark()</b></code></a></dt> Mark any referenced strings and PMCs. <dt><a name="PMC_*get_attr_str(STRING_*name)" ><b><code>PMC *get_attr_str(STRING *name)</b></code></a></dt> Gets the value of an attribute for this object. Will find the first attribute of the given name walking up the inheritance tree. <dt><a name="PMC_*get_attr_keyed(PMC_*key,_STRING_*name)" ><b><code>PMC *get_attr_keyed(PMC *key, STRING *name)</b></code></a></dt> Gets the value of an attribute for this object. Will only look for attributes defined in the parent identified by the given key. <dt><a name="void_set_attr_str(STRING_*name,_PMC_*value)" ><b><code>void set_attr_str(STRING *name, PMC *value)</b></code></a></dt> Sets the value of an attribute for this object. Will set the first attribute of the given name walking up the inheritance tree. <dt><a name="void_set_attr_keyed(PMC_*key,_STRING_*name,_PMC_*value)" ><b><code>void set_attr_keyed(PMC *key, STRING *name, PMC *value)</b></code></a></dt> Sets the value of an attribute for this object. Will only set attributes defined in the parent identified by the given key. <dt><a name="PMC_*find_method(STRING_*name)" ><b><code>PMC *find_method(STRING *name)</b></code></a></dt> Queries this object's class to find the method with the given name. <dt><a name="INTVAL_get_integer()" ><b><code>INTVAL get_integer()</b></code></a></dt> Invoke the PIR-defined vtable override, or call the default get_integer. <dt><a name="PMC_*get_class()" ><b><code>PMC *get_class()</b></code></a></dt> Get the class PMC representing the class that this object is an instance of. <dt><a name="PMC_*get_namespace()" ><b><code>PMC *get_namespace()</b></code></a></dt> Get the namespace PMC associated with the class that this object is an instance of. <dt><a name="INTVAL_can(STRING_*method_name)" ><b><code>INTVAL can(STRING *method_name)</b></code></a></dt> Returns 0 if the class does not have a method with the given name and a non-zero value if it does. <dt><a name="INTVAL_isa_pmc(PMC_*lookup)" ><b><code>INTVAL isa_pmc(PMC *lookup)</b></code></a></dt> Returns whether the object's class is or inherits from <code>lookup</code>. <dt><a name="INTVAL_isa(STRING_*classname)" ><b><code>INTVAL isa(STRING *classname)</b></code></a></dt> Returns whether the class is or inherits from <code>*classname</code>. <dt><a name="INTVAL_does(STRING_*role_name)" ><b><code>INTVAL does(STRING *role_name)</b></code></a></dt> Returns whether the object's class does the role with name <code>*role_name</code>. <dt><a name="INTVAL_does_pmc(PMC_*role)" ><b><code>INTVAL does_pmc(PMC *role)</b></code></a></dt> Returns whether the object's class does <code>*role</code>. <dt><a name="opcode_t_*invoke(void_*next)" ><b><code>opcode_t *invoke(void *next)</b></code></a></dt> Invokes the object (if this vtable function is overridden). <dt><a name="INTVAL_type()" ><b><code>INTVAL type()</b></code></a></dt> Returns the integer type of the object's class. <dt><a name="PMC_*_clone()" ><b><code>PMC * clone()</b></code></a></dt> Creates a clone of the object. <dt><a name="void_visit(PMC_*info)" ><b><code>void visit(PMC *info)</b></code></a></dt> This is used by freeze/thaw to visit the contents of the object.<code>*info</code> is the visit info, (see <em>include/parrot/pmc_freeze.h</em>). <dt><a name="void_freeze(PMC_*info)" ><b><code>void freeze(PMC *info)</b></code></a></dt> <dt><a name="void_thaw(PMC_*info)" ><b><code>void thaw(PMC *info)</b></code></a></dt> Realias magically generated methods so they don't wreak havoc. <dt><a name="void_thawfinish(PMC_*info)" ><b><code>void thawfinish(PMC *info)</b></code></a></dt> Called after the object has been thawed. <dt><a name="void_morph(PMC*_type)" ><b><code>void morph(PMC* type)</b></code></a></dt> Changes the PMC to a PMC of a new type</dl> <h1><a name="SEE_ALSO" >SEE ALSO</a></h1> <p><em>docs/pdds/pdd15_objects.pod</em>.</p> </div> <!-- "mainbody" --> <div id="divider"></div> <div id="footer"> Copyright © 2002-2011, Parrot Foundation. </div> </div> <!-- "wrapper" --> </body> </html>