Max API  8.0.2
Class Module

Functions

t_max_err class_copy (t_symbol *src_name_space, t_symbol *src_classname, t_symbol *dst_name_space, t_symbol *dst_classname)
 Duplicates a previously registered object class, and registers a copy of this class. More...
 
void * jit_class_new (C74_CONST char *name, method mnew, method mfree, long size,...)
 Creates a new class with the name specified by the name argument. More...
 
t_jit_err jit_class_addmethod (void *c, method m, const char *name,...)
 Adds a named method to a class. More...
 
t_jit_err jit_class_addattr (void *c, t_jit_object *attr)
 Adds an attribute to a class. More...
 
t_jit_err jit_class_addadornment (void *c, t_jit_object *o)
 Adds an adornment to a class. More...
 
t_jit_err jit_class_addinterface (void *c, void *interfaceclass, long byteoffset, long flags)
 Adds an interface to a class. More...
 
void * jit_class_adornment_get (void *c, t_symbol *classname)
 Retrieves an adornment from a class. More...
 
t_jit_err jit_class_free (void *c)
 Frees a class. More...
 
t_symboljit_class_nameget (void *c)
 Retrieves the name of a class. More...
 
long jit_class_symcompare (void *c, t_symbol *name)
 Compares name of class with the name provided. More...
 
t_jit_err jit_class_register (void *c)
 Registers class in the class registry. More...
 
method jit_class_method (void *c, t_symbol *methodname)
 Retrieves method function pointer for named method. More...
 
t_messlistjit_class_mess (t_jit_class *c, t_symbol *methodname)
 Retrieves messlist entry for named method. More...
 
void * jit_class_attr_get (void *c, t_symbol *attrname)
 Retrieves attribute pointer associated with name provided. More...
 
void * jit_class_findbyname (t_symbol *classname)
 Retrieves class pointer associated with name provided. More...
 
t_jit_err jit_class_addtypedwrapper (void *c, method m, char *name,...)
 Adds a typed wrapper method to a class. More...
 
t_messlistjit_class_typedwrapper_get (void *c, t_symbol *s)
 Retrieves typed wrapper messlist pointer associated with name provided. More...
 
t_jit_err jit_class_method_addargsafe (void *c, char *argname, char *methodname)
 Marks a method as safe to call as an attribute style argument. More...
 
t_symboljit_class_method_argsafe_get (void *c, t_symbol *s)
 Checks to see if symbol is safe to call as an attribute style argument. More...
 

Detailed Description

Function Documentation

◆ class_copy()

t_max_err class_copy ( t_symbol src_name_space,
t_symbol src_classname,
t_symbol dst_name_space,
t_symbol dst_classname 
)

Duplicates a previously registered object class, and registers a copy of this class.

Parameters
src_name_spaceThe source class's name space.
src_classnameThe source class's class name.
dst_name_spaceThe copied class's name space.
dst_classnameThe copied class's class name.
Returns
This function returns the error code MAX_ERR_NONE if successful, or one of the other error codes defined in "ext_obex.h" if unsuccessful.

◆ jit_class_addadornment()

t_jit_err jit_class_addadornment ( void *  c,
t_jit_object o 
)

Adds an adornment to a class.

Adornments provide additional state and behavior to a class. This is most commonly used for the jit_mop adornment.

Parameters
cclass pointer
oobject to use as adornment
Returns
t_jit_err error code

References jit_err_from_max_err().

◆ jit_class_addattr()

t_jit_err jit_class_addattr ( void *  c,
t_jit_object attr 
)

Adds an attribute to a class.

Parameters
cclass pointer
attrattribute object
Returns
t_jit_err error code

References class_addattr(), and jit_err_from_max_err().

◆ jit_class_addinterface()

t_jit_err jit_class_addinterface ( void *  c,
void *  interfaceclass,
long  byteoffset,
long  flags 
)

Adds an interface to a class.

Automatically expose methods and attributes of an interface class to a classes. Can also be used for class containers or subclassing behavior. If method or attribute is present in interface class prior to this call, the inteface class' method or attribute will not be added. Use a nonzero byteoffset to contained class' object pointer in struct for container class. Use byte offset of zero for interface or subclassing behavior.

Parameters
cclass pointer
interfaceclassinterface class pointer
byteoffsetbyte offset (if for a contained object)
flagsreserved for future use
Returns
t_jit_err error code

References gensym(), hashtab_funall(), hashtab_new(), and hashtab_store().

◆ jit_class_addmethod()

t_jit_err jit_class_addmethod ( void *  c,
method  m,
const char *  name,
  ... 
)

Adds a named method to a class.

Parameters
cclass pointer
mfunction called when method is invoked
namemethod name
...type signature for the method in the standard Max type list format (see Chapter 3 of the Writing Externals in Max document for more information)
Returns
t_jit_err error code

References class_addmethod(), and jit_err_from_max_err().

◆ jit_class_addtypedwrapper()

t_jit_err jit_class_addtypedwrapper ( void *  c,
method  m,
char *  name,
  ... 
)

Adds a typed wrapper method to a class.

Typed wrappers typically are used when there is an existing private, untyped method defined for a Jitter class, but it is desirable to expose the method to language bindings which require a typed interface–e.g. Java or JavaScript.

Parameters
cclass pointer
mfunction called when method is invoked
namemethod name
...type signature for the method in the standard Max type list format (see Chapter 3 of the Writing Externals in Max document for more information)
Returns
t_jit_err error code

References jit_err_from_max_err().

◆ jit_class_adornment_get()

void* jit_class_adornment_get ( void *  c,
t_symbol classname 
)

Retrieves an adornment from a class.

Adornments provide additional state and behavior to a class. This is most commonly used for the jit_mop adornment.

Parameters
cclass pointer
classnameclassname of adornment to retrieve
Returns
t_jit_err error code

Referenced by max_jit_classex_mop_mproc(), max_jit_classex_mop_wrap(), and max_jit_mop_setup().

◆ jit_class_attr_get()

void* jit_class_attr_get ( void *  c,
t_symbol attrname 
)

Retrieves attribute pointer associated with name provided.

Parameters
cclass pointer
attrnameattribute name
Returns
attribute object pointer

◆ jit_class_findbyname()

void* jit_class_findbyname ( t_symbol classname)

Retrieves class pointer associated with name provided.

Parameters
classnameclass name
Returns
class pointer

References class_findbyname().

◆ jit_class_free()

t_jit_err jit_class_free ( void *  c)

Frees a class.

Warning
This function is not typically used outside of jitlib.
Parameters
cclass pointer
Returns
t_jit_err error code

References class_free(), and jit_err_from_max_err().

◆ jit_class_mess()

t_messlist* jit_class_mess ( t_jit_class c,
t_symbol methodname 
)

Retrieves messlist entry for named method.

Parameters
cclass pointer
methodnamemethod name
Returns
t_messlist pointer.

◆ jit_class_method()

method jit_class_method ( void *  c,
t_symbol methodname 
)

Retrieves method function pointer for named method.

Parameters
cclass pointer
methodnamemethod name
Returns
method function pointer.

◆ jit_class_method_addargsafe()

t_jit_err jit_class_method_addargsafe ( void *  c,
char *  argname,
char *  methodname 
)

Marks a method as safe to call as an attribute style argument.

Warning
It is important that no argument settable method causes any output into the patcher, or else it could lead to a crash, or other undesired behavior.
Parameters
cclass pointer
argnamename as used via argument
methodnamename of method to map the argument name to
Returns
t_jit_err error code

References gensym(), and jit_err_from_max_err().

◆ jit_class_method_argsafe_get()

t_symbol* jit_class_method_argsafe_get ( void *  c,
t_symbol s 
)

Checks to see if symbol is safe to call as an attribute style argument.

Parameters
cclass pointer
sname as used via argument
Returns
If successful, name of method to map the argument name to. Otherwise, NULL.

References gensym().

Referenced by jit_object_method_argsafe_get().

◆ jit_class_nameget()

t_symbol* jit_class_nameget ( void *  c)

Retrieves the name of a class.

Parameters
cclass pointer
Returns
t_symbol pointer containing name of class

References class_nameget().

Referenced by jit_class_symcompare().

◆ jit_class_new()

void* jit_class_new ( C74_CONST char *  name,
method  mnew,
method  mfree,
long  size,
  ... 
)

Creates a new class with the name specified by the name argument.

Parameters
nameclass name
mnewclass constructor
mfreeclass destructor
sizeobject struct size in bytes
...type signature for the constructor in the standard Max type list format (see Chapter 3 of the Writing Externals in Max document for more information)
Warning
In order for the Jitter class to be exposed to JavaScript and Java, it is important that the constructor is typed, even if no arguments are provided–i.e. do not use the older strategy of defining Jitter constructors as private and untyped with A_CANT.
Returns
class pointer to be used in other class functions

References A_CANT, A_GIMME, class_addmethod(), class_new(), jit_object_exportattrs(), and jit_object_importattrs().

◆ jit_class_register()

t_jit_err jit_class_register ( void *  c)

Registers class in the class registry.

Parameters
cclass pointer
Returns
t_jit_err error code

References class_register(), and jit_err_from_max_err().

◆ jit_class_symcompare()

long jit_class_symcompare ( void *  c,
t_symbol name 
)

Compares name of class with the name provided.

Parameters
cclass pointer
namename to compare with class name
Returns
1 if equal, 0 if not equal

References jit_class_nameget().

◆ jit_class_typedwrapper_get()

t_messlist* jit_class_typedwrapper_get ( void *  c,
t_symbol s 
)

Retrieves typed wrapper messlist pointer associated with name provided.

Parameters
cclass pointer
sname
Returns
t_messlist pointer