OSFI-C++
3.10.0
OpenSF Integration Library
|
Foreign-function interface to the CLP module of OSFI-C++. More...
#include "ffi_base.h"
Go to the source code of this file.
CLP module | |
Contains routines that wrap those in the CLP class. The CLP object must first be created using the osfi_clp_create() function, and then other methods can be called on it. When done, the object must be destroyed using osfi_clp_destroy(). | |
enum | osfi_clp_filetype { OSFI_CLP_FT_CONF , OSFI_CLP_FT_INP , OSFI_CLP_FT_OUT } |
typedef struct OSFI_CLP_t | OSFI_CLP |
OSFI_CLP * | osfi_clp_create (int argc, char *argv[]) |
void | osfi_clp_destroy (OSFI_CLP **clp) |
int | osfi_clp_get_num_files (const OSFI_CLP *clp, enum osfi_clp_filetype type) |
bool | osfi_clp_get_file (const OSFI_CLP *clp, enum osfi_clp_filetype type, int index, char *fileName, int *bufSz) |
Foreign-function interface to the CLP module of OSFI-C++.
This file exposes an interface to the OSFI functions that can be called without C++ name mangling or other C++-specific features such as exception handling. It is not the OSFI-C interface, which resides in "OSFIC.h". It is intended as an intermediate layer to create bindings to OSFI-C++ from other languages; currently C and Fortran are supported through it.
typedef struct OSFI_CLP_t OSFI_CLP |
Command Line Parser object, in the FFI.
enum osfi_clp_filetype |
Type of file in calls to osfi_clp_get_num_files() and osfi_clp_get_file().
Enumerator | |
---|---|
OSFI_CLP_FT_CONF | Configuration files (1st argument) |
OSFI_CLP_FT_INP | Input files (2nd argument) |
OSFI_CLP_FT_OUT | Output files (3rd argument) |
OSFI_CLP* osfi_clp_create | ( | int | argc, |
char * | argv[] | ||
) |
Create an instance of the CLP class with the given arguments. Returns a null pointer in case of error.
void osfi_clp_destroy | ( | OSFI_CLP ** | clp | ) |
Call delete
on *clp and nullify the pointer. No-op if either clp or *clp are null.
bool osfi_clp_get_file | ( | const OSFI_CLP * | clp, |
enum osfi_clp_filetype | type, | ||
int | index, | ||
char * | fileName, | ||
int * | bufSz | ||
) |
Copy the name of the file identified by type and index into the given buffer. On output, *bufSz contains zero if the input arguments (clp, type, index) are invalid. Otherwise, it contains the minimum size of the buffer required for that file as a C string. Note that even an empty file name will have a buffer size of 1 (for the null terminator).
clp | The instance to operate on. |
type | The type of the file to search. |
index | Index of the file (starting at 0). See osfi_clp_get_num_files(). |
fileName | The buffer to use, or NULL. If buffer is not large enough it is filled with a properly null-terminated, but truncated, C string. |
bufSz | On input, it must be the actual size of the buffer, if one is passed. On output, see the above description. |
true
if the buffer contains the requested file name (not truncated); false
on any error. int osfi_clp_get_num_files | ( | const OSFI_CLP * | clp, |
enum osfi_clp_filetype | type | ||
) |
Get the number of arguments (files) of the given type. Returns a negative value on error.