SDK
Arrays

Functions

void SPI_LOC_ClearTab ()
 Deallocates all arrays in memory.
 
int SPI_LOC_find_first_array ()
 Finds the first free array and return its number.
 
int SPI_LOC_read_one_in_array (int pos, void *adr, int ind)
 Reads a field in an array.
 
int SPI_LOC_read_one_int_in_array (int pos, int *ival, int ind)
 Reads an integer in an array.
 
int SPI_LOC_read_one_real_in_array (int pos, double *rval, int ind)
 Reads a real in an array.
 
int SPI_LOC_read_one_TR3_in_array (int pos, double *rval, int ind)
 Reads an array of 3 reals in an array.
 
int SPI_LOC_read_one_TR9_in_array (int pos, double *rval, int ind)
 Reads an array of 9 reals in an array.
 
int SPI_LOC_read_one_TC255_in_array (int pos, std::string &sval, int ind)
 Reads a string in an array.
 
int SPI_LOC_read_number_in_array (int ind)
 Reads the number of fields in an array.
 
int SPI_LOC_alloc_array (int typ, int nb, int ind)
 Allocates an array at a given size.
 
int SPI_LOC_write_one_in_array (int pos, const void *adr, int ind)
 Writes a field in an array.
 
int SPI_LOC_write_one_int_in_array (int pos, int ival, int ind)
 Writes an integer in an array.
 
int SPI_LOC_write_one_real_in_array (int pos, double rval, int ind)
 Writes a real in an array.
 
int SPI_LOC_write_one_TR3_in_array (int pos, const double *rval, int ind)
 Writes an array of 3 reals in an array.
 
int SPI_LOC_write_one_TR9_in_array (int pos, double *rval, int ind)
 Writes an array of 9 reals in an array.
 
int SPI_LOC_write_one_TC255_in_array (int pos, const std::string &sval, int ind)
 Writes a string in an array.
 
int SPI_LOC_free_array (int ind)
 Deallocates an array.
 
int SPI_LOC_realloc_array (int nnb, int ind)
 Reallocates an array to a given size.
 
int SPI_LOC_write_multi_in_array (int pos, int n, void *adr, int ind)
 Writes several values ​​in an array.
 
int SPI_LOC_read_multi_in_array (int pos, int n, void *adr, int ind)
 Reads several values ​​in an array.
 

Detailed Description

Arrays management

Function Documentation

◆ SPI_LOC_alloc_array()

int SPI_LOC_alloc_array ( int typ,
int nb,
int ind )

Allocates an array at a given size.

Parameters
[in]indarray index to allocate
[in]typtype of field to allocate (see doc Global)
[in]nbnumber of fields to allocate
Returns
SPI_YES if OK | SPI_NO if ind> = MAXAOC or allocation impossible...
Remarks
1) ALWAYS test the error at the output of the function
2) ALWAYS free the array before reallocating it

list of types available
  • SPI_LOC_TYPINT: integer
  • SPI_LOC_TYPDOU: double
  • SPI_LOC_TYPCHR: character
  • SPI_LOC_TYPC20: chain of 20 characters
  • SPI_LOC_TYPC40: chain of 40 characters
  • SPI_LOC_TYPC80: chain of 80 characters
  • SPI_LOC_TYPC255: chain of 255 characters
  • SPI_LOC_TYPTR3: Tables of 3 doubles (Point)
  • SPI_LOC_TYPTR9: Tables of 9 doubles (canonical forms)
iloc := ICALL(SPI_LOC_find_first_array);
ier := ICALL(SPI_LOC_alloc_array,SPI_LOC_TYPINT,10,iloc);
int SPI_LOC_alloc_array(int typ, int nb, int ind)
Allocates an array at a given size.
Definition sp_loc01.c:352
int SPI_LOC_find_first_array()
Finds the first free array and return its number.
Definition sp_loc01.c:58

◆ SPI_LOC_ClearTab()

void SPI_LOC_ClearTab ( )

Deallocates all arrays in memory.

Version
6.04

◆ SPI_LOC_find_first_array()

int SPI_LOC_find_first_array ( )

Finds the first free array and return its number.

Returns
array index | -1 if all occupied
iloc := ICALL(SPI_LOC_find_first_array);

◆ SPI_LOC_free_array()

int SPI_LOC_free_array ( int ind)

Deallocates an array.

Parameters
[in]indindex of the array to deallocate
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_LOC_free_array,iloc);
int SPI_LOC_free_array(int ind)
Deallocates an array.
Definition sp_loc01.c:649

◆ SPI_LOC_read_multi_in_array()

int SPI_LOC_read_multi_in_array ( int pos,
int n,
void * adr,
int ind )

Reads several values ​​in an array.

Parameters
[in]posposition in array
[in]nnumber of fields always >= 1
[in]indindex of the array in which to read
[out]adraddress of the table of fields to read
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_LOC_read_multi_in_array,1,3,pt,iloc);
int SPI_LOC_read_multi_in_array(int pos, int n, void *adr, int ind)
Reads several values ​​in an array.
Definition sp_loc01.c:773

◆ SPI_LOC_read_number_in_array()

int SPI_LOC_read_number_in_array ( int ind)

Reads the number of fields in an array.

Parameters
[in]indtable index
Returns
number of fields in the array
nb := ICALL(SPI_LOC_read_number_in_array,iloc);
int SPI_LOC_read_number_in_array(int ind)
Reads the number of fields in an array.
Definition sp_loc01.c:319

◆ SPI_LOC_read_one_in_array()

int SPI_LOC_read_one_in_array ( int pos,
void * adr,
int ind )

Reads a field in an array.

Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]adraddress of the value read
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_LOC_read_one_in_array,1,ival,iloc);
int SPI_LOC_read_one_in_array(int pos, void *adr, int ind)
Reads a field in an array.
Definition sp_loc01.c:90

◆ SPI_LOC_read_one_int_in_array()

int SPI_LOC_read_one_int_in_array ( int pos,
int * ival,
int ind )

Reads an integer in an array.

Version
6.04
Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]ivalinteger value read
Returns
SPI_YES si Ok | SPI_NO si erreur
ier := ICALL(SPI_LOC_read_one_int_in_array,1,ival,iloc);
int SPI_LOC_read_one_int_in_array(int pos, int *ival, int ind)
Reads an integer in an array.
Definition sp_loc01.c:128

◆ SPI_LOC_read_one_real_in_array()

int SPI_LOC_read_one_real_in_array ( int pos,
double * rval,
int ind )

Reads a real in an array.

Version
6.04
Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]rvalreal value read
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_read_one_real_in_array,1,rval,iloc);
int SPI_LOC_read_one_real_in_array(int pos, double *rval, int ind)
Reads a real in an array.
Definition sp_loc01.c:167

◆ SPI_LOC_read_one_TC255_in_array()

int SPI_LOC_read_one_TC255_in_array ( int pos,
std::string & sval,
int ind )

Reads a string in an array.

Version
6.04
Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]svalstring read
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_read_one_TC255_in_array,1,sval,iloc);
int SPI_LOC_read_one_TC255_in_array(int pos, std::string &sval, int ind)
Reads a string in an array.
Definition sp_loc01.c:276

◆ SPI_LOC_read_one_TR3_in_array()

int SPI_LOC_read_one_TR3_in_array ( int pos,
double * rval,
int ind )

Reads an array of 3 reals in an array.

Version
6.04
Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]rvalarray read
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_read_one_TR3_in_array,1,ival,iloc);
int SPI_LOC_read_one_TR3_in_array(int pos, double *rval, int ind)
Reads an array of 3 reals in an array.
Definition sp_loc01.c:202

◆ SPI_LOC_read_one_TR9_in_array()

int SPI_LOC_read_one_TR9_in_array ( int pos,
double * rval,
int ind )

Reads an array of 9 reals in an array.

Version
6.04
Parameters
[in]posposition in array
[in]indindex of the array in which to read
[out]rvalarray read
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_read_one_TR9_in_array,1,ival,iloc);
int SPI_LOC_read_one_TR9_in_array(int pos, double *rval, int ind)
Reads an array of 9 reals in an array.
Definition sp_loc01.c:237

◆ SPI_LOC_realloc_array()

int SPI_LOC_realloc_array ( int nnb,
int ind )

Reallocates an array to a given size.

Parameters
[in]indtable index to reallocate
[in]nnbtotal number of array fields
Returns
SPI_YES if OK | SPI_NO if ind> = MAXAOC or reallocation impossible ...
ier := ICALL(SPI_LOC_realloc_array,12,iloc);
int SPI_LOC_realloc_array(int nnb, int ind)
Reallocates an array to a given size.
Definition sp_loc01.c:691

◆ SPI_LOC_write_multi_in_array()

int SPI_LOC_write_multi_in_array ( int pos,
int n,
void * adr,
int ind )

Writes several values ​​in an array.

Parameters
[in]posposition in array
[in]nnumber of fields always >= 1
[in]adraddress of the table of fields to write
[in]indindex of the array in which to write
Returns
SPI_YES if Ok | SPI_NO if error
ier := ICALL(SPI_LOC_write_multi_in_array,1,3,pt,iloc);
int SPI_LOC_write_multi_in_array(int pos, int n, void *adr, int ind)
Writes several values ​​in an array.
Definition sp_loc01.c:732

◆ SPI_LOC_write_one_in_array()

int SPI_LOC_write_one_in_array ( int pos,
const void * adr,
int ind )

Writes a field in an array.

Parameters
[in]posposition in array
[in]adraddress of the variable to write
[in]indindex of the array in which to write
Returns
SPI_YES if Ok | SPI_NO if error
Remarks
Always use an address variable to write a value
ier := ICALL(SPI_LOC_write_one_in_array,1,ival,iloc);
int SPI_LOC_write_one_in_array(int pos, const void *adr, int ind)
Writes a field in an array.
Definition sp_loc01.c:428

◆ SPI_LOC_write_one_int_in_array()

int SPI_LOC_write_one_int_in_array ( int pos,
int ival,
int ind )

Writes an integer in an array.

Version
6.04
Parameters
[in]posposition in array
[in]ivalinteger to write
[in]indindex of the array in which to write
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_write_one_int_in_array,1,ival,iloc);
int SPI_LOC_write_one_int_in_array(int pos, int ival, int ind)
Writes an integer in an array.
Definition sp_loc01.c:471

◆ SPI_LOC_write_one_real_in_array()

int SPI_LOC_write_one_real_in_array ( int pos,
double rval,
int ind )

Writes a real in an array.

Version
6.04
Parameters
[in]posposition in array
[in]rvalreal to write
[in]indindex of the array in which to write
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_write_one_real_in_array,1,rval,iloc);
int SPI_LOC_write_one_real_in_array(int pos, double rval, int ind)
Writes a real in an array.
Definition sp_loc01.c:506

◆ SPI_LOC_write_one_TC255_in_array()

int SPI_LOC_write_one_TC255_in_array ( int pos,
const std::string & sval,
int ind )

Writes a string in an array.

Version
6.04
Parameters
[in]posposition in array
[in]svalstring to write
[in]indindex of the array in which to write
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_write_one_TC255_in_array,1,ival,iloc);
int SPI_LOC_write_one_TC255_in_array(int pos, const std::string &sval, int ind)
Writes a string in an array.
Definition sp_loc01.c:611

◆ SPI_LOC_write_one_TR3_in_array()

int SPI_LOC_write_one_TR3_in_array ( int pos,
const double * rval,
int ind )

Writes an array of 3 reals in an array.

Version
6.04
Parameters
[in]posposition in array
[in]rvalarray of 3 reals to write
[in]indindex of the array in which to write
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_write_one_TR3_in_array,1,ival,iloc);
int SPI_LOC_write_one_TR3_in_array(int pos, const double *rval, int ind)
Writes an array of 3 reals in an array.
Definition sp_loc01.c:541

◆ SPI_LOC_write_one_TR9_in_array()

int SPI_LOC_write_one_TR9_in_array ( int pos,
double * rval,
int ind )

Writes an array of 9 reals in an array.

Version
6.04
Parameters
[in]posposition in array
[in]rvalarray of 9 reals to write
[in]indindex of the array in which to write
Returns
SPI_YES : Ok | SPI_NO : error
ier := ICALL(SPI_LOC_write_one_TR9_in_array,1,ival,iloc);
int SPI_LOC_write_one_TR9_in_array(int pos, double *rval, int ind)
Writes an array of 9 reals in an array.
Definition sp_loc01.c:576