Fuse.Problem
|
The problem container class that abstract the device of filesystem. More...
#include <problem.h>
Public Member Functions | |
Problem (const char *dl) | |
Initialization, calls init method. More... | |
~Problem () | |
Destroyes the Problem<FP> class. More... | |
size_t | write (FunctionInput type, const char *buf) |
representation of the libfuse write operation More... | |
int | read (int type, char *buf, size_t size, size_t offset) |
representation of the libfuse read operation More... | |
int | pathid (const char *path) |
gives a number that identifies the file in path More... | |
size_t | size (FunctionOutput t) |
Returns the size (dimensions) of specified element. More... | |
size_t | filesize (FunctionOutput t, int i=0) |
number of characters in file More... | |
Public Attributes | |
vector< FP > | x |
vector< FP > | p |
vector< FP > | y |
The problem container class that abstract the device of filesystem.
This is a container of the problem. It handles loading and unloading of the shared object and also parses filesystem input. It contains string representation for the files and pointer to externally declared functions. The problem precision is unader the template class FP, and it can be float or double. Usually the real problem precision is described in PROBLEM_PRECISION macro.
Initialization, calls init method.
The initialization function calls the init method and set some of the internal properties to initial values.
dl | path to external shared object |
Destroyes the Problem<FP> class.
Calls close method.
size_t Problem< FP >::filesize | ( | FunctionOutput | t, |
int | i = 0 |
||
) |
number of characters in file
Number of characters in specified file. The second argument is used to specify the number of output file.
t | type of file to query |
i | element number in y_file vector, default to 0 when not needed |
int Problem< FP >::pathid | ( | const char * | path | ) |
gives a number that identifies the file in path
Returns a number that identifies the file in path. It returns a PROBLEM_E_NOFILE when the file does not exist. If number is negative, it is one of the fixed files, while if it is positive is one of the output files.
path | the required file path |
int Problem< FP >::read | ( | int | type, |
char * | buf, | ||
size_t | size, | ||
size_t | offset | ||
) |
representation of the libfuse read operation
It is the equivalent of the read operation from fuse. The first int value is the file identification from pathid, and the content of the file is inserted into the buffer buf, starting from the offset point, till reaching the size. Obviously, file size is truncated when requested segment is bigger than content. The function returns an integer, that is the number of bytes written into buf. This int format is required libfuse. That means we set a direct I/O filesystem type (see fpr_read function)
type | file that is currently required |
buf | the buffer in which informations will be copied |
size | the number of byte maximum for buf |
offset | the offset in byte since last reading |
size_t Problem< FP >::size | ( | FunctionOutput | t | ) |
Returns the size (dimensions) of specified element.
Returns the number of dimensions for vector x, vector p and number of functions in f.
t | type of vector size to query |
size_t Problem< FP >::write | ( | FunctionInput | type, |
const char * | buf | ||
) |
representation of the libfuse write operation
It is the equivalent of the write operation from fuse. Already handles size, thus it is not in parameter list. Once called, it also calls update method to regenerate all internal representations. TODO: must be simplified and broken in smaller pieces.
type | FunctionInput enum value to understand what is being written |
buf | the buffer that is being written. |
vector<FP> Problem< FP >::p |
last values of parameters p
vector<FP> Problem< FP >::x |
last values of input x
vector<FP> Problem< FP >::y |
last value of last evaluated function (it is garbage)