class.h File Reference

Class header. More...

Go to the source code of this file.

Classes

struct  PmClass_s
struct  PmInstance_s
struct  PmMethod_s

Typedefs

typedef struct PmClass_s PmClass_t
typedef struct PmClass_spPmClass_t
typedef struct PmInstance_s PmInstance_t
typedef struct PmInstance_spPmInstance_t
typedef struct PmMethod_s PmMethod_t
typedef struct PmMethod_spPmMethod_t

Functions

PmReturn_t class_new (pPmObj_t pmeths, pPmObj_t pbases, pPmObj_t pname, pPmObj_t *r_pclass)
PmReturn_t class_instantiate (pPmObj_t pclass, pPmObj_t *r_pobj)
PmReturn_t class_method (pPmObj_t pinstance, pPmObj_t pfunc, pPmObj_t *r_pmeth)
PmReturn_t class_getAttr (pPmObj_t pobj, pPmObj_t pname, pPmObj_t *r_pobj)
uint8_t class_isSubclass (pPmObj_t ptest_class, pPmObj_t pbase_class)


Detailed Description

Class header.


Typedef Documentation

typedef struct PmClass_s PmClass_t

Class struct

This C struct is used for PyMite class objects Note: Exceptions are objects.

typedef struct PmInstance_s PmInstance_t

Class instance struct

typedef struct PmMethod_s PmMethod_t

Method struct


Function Documentation

PmReturn_t class_getAttr ( pPmObj_t  pobj,
pPmObj_t  pname,
pPmObj_t r_pobj 
)

Returns the first attribute named __init__ in the class' inheritance tree

Parameters:
pobj ptr to class or instance to search
pname ptr to name of attr to find
r_pobj Return by ref, ptr to attr if found, or undetermined
Returns:
Return status

PmReturn_t class_instantiate ( pPmObj_t  pclass,
pPmObj_t r_pobj 
)

Returns an instance of the given class

Parameters:
r_pobj The class object as input, instance object as return
Returns:
Return status

uint8_t class_isSubclass ( pPmObj_t  ptest_class,
pPmObj_t  pbase_class 
)

Returns a C boolean if the base class is found in the inheritance tree of the test class. NOTE: This function is recursive.

Parameters:
ptest_class ptr to class whose inheritance tree is searched
pbase_class ptr to class to look for
Returns:
Returns C_TRUE if pbase_class is found in the inheritance tree; C_FALSE otherwise.

PmReturn_t class_method ( pPmObj_t  pinstance,
pPmObj_t  pfunc,
pPmObj_t r_pmeth 
)

Returns a method based on the given inputs

Parameters:
pinstance ptr to instance
pfunc ptr to func
r_pmeth Return by ref, ptr to new method
Returns:
Return status

PmReturn_t class_new ( pPmObj_t  pmeths,
pPmObj_t  pbases,
pPmObj_t  pname,
pPmObj_t r_pclass 
)

Creates a new Class object from the methods dict, bases tuple, and name string.

Parameters:
pmeths ptr to methods dict.
pbases ptr to bases tuple.
pname ptr to name string.
r_pclass Return by ref, ptr to new class
Returns:
Return status


Generated on Wed Feb 24 13:37:02 2010 for Python-on-a-chip by  doxygen 1.5.9