## liboilclass-unstable

liboilclass-unstable —

##

# Synopsis

    struct      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 (*func) (void),
                                                 const char *name,
                                                 unsigned int flags);

## Description

## Details

### struct OilFunctionClass

    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 (*func) (void),
                                                 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