NAME ^

src/pmc/object.pmc - An instance of a class

DESCRIPTION ^

Implements an instance of a class.

Functions ^

void init()

Raises an exception; you can only instantiate objects from a class.

void init_pmc(PMC *class)

Raises an exception; you can only instantiate objects from a class.

void destroy()

Free the object's underlying struct.

STRING *name()

Returns the fully qualified name of the object's class.

void mark()

Mark any referenced strings and PMCs.

PMC *get_attr_str(STRING *name)

Gets the value of an attribute for this object. Will find the first attribute of the given name walking up the inheritance tree.

PMC *get_attr_keyed(PMC *key, STRING *name)

Gets the value of an attribute for this object. Will only look for attributes defined in the parent identified by the given key.

void set_attr_str(STRING *name, PMC *value)

Sets the value of an attribute for this object. Will set the first attribute of the given name walking up the inheritance tree.

void set_attr_keyed(PMC *key, STRING *name, PMC *value)

Sets the value of an attribute for this object. Will only set attributes defined in the parent identified by the given key.

PMC *find_method(STRING *name)

Queries this object's class to find the method with the given name.

PMC *get_class()

Get the class PMC representing the class that this object is an instance of.

INTVAL can(STRING *method_name)

Returns 0 if the class does not have a method with the given name and a non-zero value if it does.

INTVAL isa_pmc(PMC *classname)

Returns whether the object's class is or inherits from *classname.

INTVAL isa(STRING *classname)

Returns whether the class is or inherits from *classname.

INTVAL does(STRING *role_name)

Returns whether the object's class does the role with name *role_name.

INTVAL does_pmc(PMC *role)

Returns whether the object's class does *role.

opcode_t *invoke(void *next)

Invokes the object (if this vtable function is overridden).

INTVAL type()

Returns the integer type of the object's class.

PMC *clone()

Creates a clone of the object.

void visit(visit_info *info)

This is used by freeze/thaw to visit the contents of the object.

*info is the visit info, (see include/parrot/pmc_freeze.h).

void thaw(visit_info *info)

Used to unarchive the object.

void thawfinish(visit_info *info)

Called after the object has been thawed.

PMC *share_ro()

Used to mark a PMC as read-only shared.

void morph(INTVAL type)

Changes the PMC to a PMC of a new type

SEE ALSO ^

docs/pdds/pdd15_objects.pod.


parrot