GenericContainer
GenericContainer a tool for C++ programming
Loading...
Searching...
No Matches
GenericContainerInterface_C.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*\
2 | |
3 | Copyright (C) 2013 |
4 | |
5 | , __ , __ |
6 | /|/ \ /|/ \ |
7 | | __/ _ ,_ | __/ _ ,_ |
8 | | \|/ / | | | | \|/ / | | | |
9 | |(__/|__/ |_/ \_/|/|(__/|__/ |_/ \_/|/ |
10 | /| /| |
11 | \| \| |
12 | |
13 | Enrico Bertolazzi |
14 | Dipartimento di Ingegneria Industriale |
15 | Università degli Studi di Trento |
16 | email: enrico.bertolazzi@unitn.it |
17 | |
18\*--------------------------------------------------------------------------*/
19
20#pragma once
21
22/*
23// file: GenericContainerCinterface.h
24*/
25
30
31#ifndef GENERIC_CONTAINER_INTERFACE_C_H
32#define GENERIC_CONTAINER_INTERFACE_C_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
40enum {
46};
47
50typedef struct {
51 double real;
52 double imag;
54
61int GC_new( char const id[] );
62
69int GC_select( char const id[] );
70
77int GC_delete( char const id[] );
78
85int GC_fill_for_test( char const id[] );
86
92
98
104
110
116
121char const * GC_get_type_name();
122
129void * GC_mem_ptr( char const id[] );
130
131// -----------------------------------------------------------------------------
132
139int GC_set_bool( int a );
140
151int GC_set_int( int a );
152
163int GC_set_real( double a );
164
177
190int GC_set_complex2( double re, double im );
191
202int GC_set_string( char const a[] );
203
204// -----------------------------------------------------------------------------
205
216
227
238
248double GC_get_real();
249
260
271
282
292char const * GC_get_string();
293
294// -----------------------------------------------------------------------------
295
307int GC_push_bool( int a );
308
320int GC_push_int( int a );
321
333int GC_push_real( double a );
334
347
360int GC_push_complex2( double re, double im );
361
372int GC_push_string( char const a[] );
373
374// -----------------------------------------------------------------------------
375
387int GC_get_bool_at_pos( int pos );
388
400int GC_get_int_at_pos( int pos );
401
413double GC_get_real_at_pos( int pos );
414
427
438
441
454
466char const * GC_get_string_at_pos( int pos );
467
468// -----------------------------------------------------------------------------
469
483double GC_get_real_at_coor( int i, int j );
484
499
513double GC_get_complex_real_at_coor( int i, int j );
514
528double GC_get_complex_imag_at_coor( int i, int j );
529
530// -----------------------------------------------------------------------------
531
541
551
561
571
581
582// -----------------------------------------------------------------------------
583
595int GC_set_vector_of_bool( int const * a, int nelem );
596
608int GC_set_vector_of_int( int const * a, int nelem );
609
621int GC_set_vector_of_real( double const * a, int nelem );
622
635int GC_set_vector_of_complex( double const * re, double const * im, int nelem );
636
648int GC_set_vector_of_string( char const ** a, int nelem );
649
650// -----------------------------------------------------------------------------
651
662int GC_set_vector( int nelem );
663
673
684
695
706
718
719// -----------------------------------------------------------------------------
720
731
742
752char const * GC_get_next_key( void );
753
764int GC_push_map_position( char const pos[] );
765
766#ifdef __cplusplus
767}
768#endif
769
770#endif
771
775
776/*
777// eof: GenericContainerCinterface.hh
778*/
int GC_set_real(double a)
Set the current element of the GenericContainer to a real number.
int GC_pop_head()
Move the head pointer up one level in the GenericContainer.
int GC_init_map_key()
Initialize the current element as a map key in the GenericContainer.
double GC_get_real()
Retrieve the real number value from the current element of the GenericContainer.
int GC_get_bool()
Retrieve the boolean value from the current element of the GenericContainer.
int GC_set_vector_of_bool(int const *a, int nelem)
Set the current element of the GenericContainer to a vector of booleans, and copy the provided values...
int GC_push_complex2(double re, double im)
Append a complex number to the currently selected vector using real and imaginary parts.
int GC_push_real(double a)
Append a floating-point value to the currently selected vector of real numbers in the GenericContaine...
int GC_get_matrix_num_rows()
Retrieve the number of rows in the current matrix of the GenericContainer.
int GC_set_complex2(double re, double im)
Set the current element of the GenericContainer to a complex number using real and imaginary parts.
c_complex_type GC_get_complex()
Retrieve the complex number from the current element of the GenericContainer.
int GC_push_string(char const a[])
Append a string to the currently selected vector of strings in the GenericContainer.
int GC_push_vector_position(int pos)
Set the insertion point in the current vector of the GenericContainer.
int GC_push_map_position(char const pos[])
Set the insertion point to the specified key in the current map of the GenericContainer.
void * GC_mem_ptr(char const id[])
Get a pointer to the internal memory of the GenericContainer object.
int GC_set_vector_of_string(char const **a, int nelem)
Set the current element of the GenericContainer to a vector of strings, and copy the provided values.
double GC_get_complex_real_at_coor(int i, int j)
Retrieve the real part of a complex number at the specified row and column from a matrix.
char const * GC_get_string_at_pos(int pos)
Retrieve a string at a specified position from a vector of strings in the GenericContainer.
double GC_get_real_at_coor(int i, int j)
Retrieve a real number at the specified row and column from a matrix of real numbers in the GenericCo...
int GC_select(char const id[])
Select an existing GenericContainer object.
double GC_get_complex_imag_at_coor(int i, int j)
Retrieve the imaginary part of a complex number at the specified row and column from a matrix.
int GC_set_string(char const a[])
Set the current element of the GenericContainer to a string.
int GC_get_bool_at_pos(int pos)
Retrieve a boolean value at a specified position from a vector of booleans in the GenericContainer.
int GC_get_vector_size()
Retrieve the number of elements in the current vector of the GenericContainer.
int GC_push_int(int a)
Append an integer value to the currently selected vector of integers in the GenericContainer.
int GC_fill_for_test(char const id[])
Fill a GenericContainer with test data.
char const * GC_get_type_name()
Retrieve the name of the type of the current element in the GenericContainer.
int GC_set_vector_of_complex(double const *re, double const *im, int nelem)
Set the current element of the GenericContainer to a vector of complex numbers, and copy the provided...
int GC_set_empty_vector_of_complex()
Initialize the current element of the GenericContainer to an empty vector of complex numbers.
int GC_get_type()
Retrieve the type of the current element pointed by the head in the GenericContainer.
c_complex_type GC_get_complex_at_coor(int i, int j)
Retrieve a complex number at the specified row and column from a matrix of complex numbers.
int GC_set_complex(c_complex_type const *a)
Set the current element of the GenericContainer to a complex number.
int GC_set_empty_vector_of_bool()
Initialize the current element of the GenericContainer to an empty vector of booleans.
int GC_set_bool(int a)
int GC_set_vector_of_real(double const *a, int nelem)
Set the current element of the GenericContainer to a vector of real numbers, and copy the provided va...
int GC_push_complex(c_complex_type const *a)
Append a complex number to the currently selected vector of complex numbers in the GenericContainer.
c_complex_type GC_get_complex_at_pos(int pos)
Retrieve a complex number at a specified position from a vector of complex numbers in the GenericCont...
int GC_reset_head()
Reset the head pointer to the first level in the GenericContainer.
int GC_delete(char const id[])
Delete a GenericContainer object.
int GC_set_empty_vector()
Set the current element of the GenericContainer to an empty vector of GenericContainer elements.
int GC_get_matrix_num_cols()
Retrieve the number of columns in the current matrix of the GenericContainer.
double GC_get_complex_im()
Retrieve the imaginary part of a complex number from the current element of the GenericContainer.
long GC_get_long()
Retrieve the long integer value from the current element of the GenericContainer.
int GC_push_bool(int a)
Append a boolean value to the currently selected vector of booleans in the GenericContainer.
double GC_get_complex_real_at_pos(int pos)
Retrieve the real part of a complex number at a specified position from a vector of complex numbers.
int GC_set_empty_vector_of_string()
Initialize the current element of the GenericContainer to an empty vector of strings.
int GC_dump()
Dump the contents of the current GenericContainer.
int GC_new(char const id[])
Create a new GenericContainer object.
char const * GC_get_string()
Retrieve the string from the current element of the GenericContainer.
double GC_get_real_at_pos(int pos)
Retrieve a real number at a specified position from a vector of real numbers in the GenericContainer.
char const * GC_get_next_key(void)
Retrieve the key of the next element in a map from the GenericContainer.
int GC_print_content_types()
Print the content types of the current GenericContainer.
int GC_set_empty_vector_of_real()
Initialize the current element of the GenericContainer to an empty vector of real numbers.
int GC_set_map()
Initialize the current element of the GenericContainer to a map.
int GC_set_vector_of_int(int const *a, int nelem)
Set the current element of the GenericContainer to a vector of integers, and copy the provided values...
int GC_set_empty_vector_of_int()
Initialize the current element of the GenericContainer to an empty vector of integers.
double GC_get_complex_imag_at_pos(int pos)
Retrieve the imaginary part of a complex number at a specified position from a vector of complex numb...
int GC_get_int_at_pos(int pos)
Retrieve an integer value at a specified position from a vector of integers in the GenericContainer.
double GC_get_complex_re()
Retrieve the real part of a complex number from the current element of the GenericContainer.
int GC_set_int(int a)
Set the current element of the GenericContainer to an integer value.
int GC_get_int()
Retrieve the integer value from the current element of the GenericContainer.
int GC_set_vector(int nelem)
Set the current element of the GenericContainer to a vector of GenericContainer elements with the spe...
@ GENERIC_CONTAINER_OK
Definition GenericContainerInterface_C.h:41
@ GENERIC_CONTAINER_BAD_HEAD
Definition GenericContainerInterface_C.h:45
@ GENERIC_CONTAINER_NO_DATA
Definition GenericContainerInterface_C.h:43
@ GENERIC_CONTAINER_BAD_TYPE
Definition GenericContainerInterface_C.h:42
@ GENERIC_CONTAINER_NOT_EMPTY
Definition GenericContainerInterface_C.h:44
A structure representing a complex number, with real and imaginary components.
Definition GenericContainerInterface_C.h:50
double real
Real part of the complex number.
Definition GenericContainerInterface_C.h:51
double imag
Imaginary part of the complex number.
Definition GenericContainerInterface_C.h:52