OSFI-C++  3.10.0
OpenSF Integration Library
CLP.h File Reference

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_CLPosfi_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)
 

Detailed Description

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 Documentation

◆ OSFI_CLP

typedef struct OSFI_CLP_t OSFI_CLP

Command Line Parser object, in the FFI.

Enumeration Type Documentation

◆ 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)

Function Documentation

◆ osfi_clp_create()

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.

◆ osfi_clp_destroy()

void osfi_clp_destroy ( OSFI_CLP **  clp)

Call delete on *clp and nullify the pointer. No-op if either clp or *clp are null.

◆ osfi_clp_get_file()

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).

Parameters
clpThe instance to operate on.
typeThe type of the file to search.
indexIndex of the file (starting at 0). See osfi_clp_get_num_files().
fileNameThe buffer to use, or NULL. If buffer is not large enough it is filled with a properly null-terminated, but truncated, C string.
bufSzOn input, it must be the actual size of the buffer, if one is passed. On output, see the above description.
Returns
true if the buffer contains the requested file name (not truncated); false on any error.

◆ osfi_clp_get_num_files()

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.