OilFunctionClass

## OilFunctionClass OilFunctionClass — Functions for manipulating function classes |

## Synopsis

                        OilFunctionClass;
    #define             OIL_DECLARE_CLASS                   (klass)
    #define             OIL_DEFINE_CLASS_FULL               (klass, string, test)
    #define             OIL_DEFINE_CLASS                    (klass, string)
    OilFunctionClass *  oil_class_get_by_index              (int i);
    OilFunctionClass *  oil_class_get                       (const char *class_name);
    void                oil_class_optimize                  (OilFunctionClass *klass);
    int                 oil_class_get_n_classes             (void);
    void                oil_class_choose_by_name            (OilFunctionClass *klass,
                                                             const char *name);
    void                oil_class_register_impl_by_name     (const char *klass_name,
                                                             OilFunctionImpl *impl);
    void                oil_class_register_impl             (OilFunctionClass *klass,
                                                             OilFunctionImpl *impl);
    void                oil_class_register_impl_full        (OilFunctionClass *klass,
                                                             void (funcvoid) (),
                                                             const char *name,
                                                             unsigned int flags);

## Description

Functions operate on arrays of data. The arrays can be either source arrays (input only), destination arrays (output only), or in-place arrays (both input and output).

The interpretation of a parameter can usually be determined from its name. Parameters for arrays are of the form d1_1xn, where the first character represents the direction (source, destination, or in-place), the second represents the index for that particular direction, and the characters after the underscore indicate the size of the array. In this case, "1xn" represents an array that is 1 by N. Note that the index and the size can both be omitted, giving a default of 1 for the index and 1xn for the size.

Parameters that represent strides are of the form "d1s". The interpretation is similar to above, except that the s indicates a stride parameter.

The exceptions to the above rule are "dest", "src", "dstr", "sstr", etc. These are aliases for "d1", "s1", "d1s", and "s1s", respectively. This form is deprecated and will be removed in the 0.4 series.

Two special parameters are "n" and "m", which determine the size of the arrays in other parameters.

Data arrays are laid out such that rows are separated by the number of bytes given by the corresponding stride. Elements in each row are contiguous. If there is no stride parameter corresponding to an array, the rows of the array are contiguous.

## Details

### OilFunctionClass

    typedef struct {
    } OilFunctionClass;

An opaque structure representing a function class.

### OIL_DECLARE_CLASS()

    #define             OIL_DECLARE_CLASS(klass)

Declares the Liboil function class `klass`.

`klass` : | the name of a function class (without the oil_ prefix)

### OIL_DEFINE_CLASS_FULL()

    #define             OIL_DEFINE_CLASS_FULL(klass, string, test)

Defines a OilFunctionClass structure for `klass`. Classes defined this way will be automatically at Liboil initialization time.

`klass` : | name of class to declare (without oil_ prefix)
`string` : | prototype of class
`test` : | test function

### OIL_DEFINE_CLASS()

    #define             OIL_DEFINE_CLASS(klass, string)

Defines a OilFunctionClass structure for `klass`. Classes defined this way will be automatically at Liboil initialization time.

`klass` : | name of class to declare (without oil_ prefix)
`string` : | prototype of class

### oil_class_get_by_index ()

    OilFunctionClass *  oil_class_get_by_index              (int i);

Returns a pointer to the function class with index `i`.

`i` : | index
Returns : | an `OilFunctionClass`

### oil_class_get ()

    OilFunctionClass *  oil_class_get                       (const char *class_name);

Returns a pointer to the function class that has the given class name. If no such class is found, NULL is returned.

`class_name` : | the name of the function class
Returns : | a pointer to a function class

### oil_class_optimize ()

    void                oil_class_optimize                  (OilFunctionClass *klass);

Tests and profiles each implementation for the given function class. Testing compares the output of running each implementation on random input against the reference implementation for the same input.

`klass` : | a function class

### oil_class_get_n_classes ()

    int                 oil_class_get_n_classes             (void);

Returns the number of function classes.

Returns : | the number of function classes

### oil_class_choose_by_name ()

    void                oil_class_choose_by_name            (OilFunctionClass *klass,
                                                             const char *name);

Sets the chosen implementation for the given function class to the implementation with the given name. If no implementation having the given name is found, the chosen implementation is not changed.

`klass` : | a function class
`name` : | the name of an implementation

### oil_class_register_impl_by_name ()

    void                oil_class_register_impl_by_name     (const char *klass_name,
                                                             OilFunctionImpl *impl);

Adds `impl` to the list of implementations associated with the function class given by `klass_name`.

`klass_name` : | the name of the class
`impl` : | an implementation

### oil_class_register_impl ()

    void                oil_class_register_impl             (OilFunctionClass *klass,
                                                             OilFunctionImpl *impl);

Adds `impl` to the list of implementations associated with the function class given by `klass`.

`klass` : | the class
`impl` : | an implementation

### oil_class_register_impl_full ()

    void                oil_class_register_impl_full        (OilFunctionClass *klass,
                                                             void (funcvoid) (),
                                                             const char *name,
                                                             unsigned int flags);

Adds `func` to the list of implementations associated with the function class given by `klass`.

`klass` : | the class
`func` : | the function
`name` : | name of the function
`flags` : | CPU flags