[68] | 1 | #ifndef ECCAD_H_ |
---|
| 2 | #define ECCAD_H_ |
---|
| 3 | #include <sys/types.h> |
---|
| 4 | #include <sys/stat.h> |
---|
| 5 | #include <unistd.h> |
---|
| 6 | |
---|
| 7 | #include "grid.h" |
---|
| 8 | #include "cmap.h" |
---|
| 9 | #include "list.h" |
---|
| 10 | #include <gd.h> |
---|
| 11 | #include <libpq-fe.h> |
---|
| 12 | #include <libpq/libpq-fs.h> |
---|
| 13 | |
---|
| 14 | typedef PGconn* EccadDB; |
---|
| 15 | |
---|
| 16 | /** Cet Objet est l'objet principal gérant la connection à la base de donnée ECCAD |
---|
| 17 | * ainsi que la récupération de données et métadonées de cette base. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | // =======================Constructors/Destructors======================= |
---|
| 21 | |
---|
| 22 | /** Constructor, connect to the ECCAD database |
---|
| 23 | * @param server The server name |
---|
| 24 | * @param dbName The database name |
---|
| 25 | * @param user The user name used to connect to the database |
---|
| 26 | * @param pass The user's password |
---|
| 27 | * @param port The database server's port |
---|
| 28 | * @return EccadDB The object containing the connection, NULL if a probleme occurs |
---|
| 29 | */ |
---|
| 30 | EccadDB connectEccadDB(const char* server, const char* dbName, const char* user, const char* pass, const char* port); |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | /** Constructor, connect to the ECCAD database |
---|
| 34 | * @param server The server name |
---|
| 35 | * @param dbName The database name |
---|
| 36 | * @param user The user name used to connect to the database |
---|
| 37 | * @param pass The user's password |
---|
| 38 | * @return EccadDB The object containing the connection, NULL if a problem occurs |
---|
| 39 | */ |
---|
| 40 | EccadDB connectEccadDB_a(char const* server, char const* dbName, char const* user, char const* pass); |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | /** Constructor, connect to the ECCAD database |
---|
| 44 | * @param server The server name |
---|
| 45 | * @param dbName The database name |
---|
| 46 | * @return EccadDB The object containing the connection, NULL if a problem occurs |
---|
| 47 | */ |
---|
| 48 | EccadDB connectEccadDB_b(const char* server, const char* dbName); |
---|
| 49 | |
---|
| 50 | /** Destructor, closes the connection to the ECCAD database |
---|
| 51 | * @param conn The object containing the connection |
---|
| 52 | */ |
---|
| 53 | void closeEccadDB(EccadDB conn); |
---|
| 54 | |
---|
| 55 | // ============================ Functions ===================================== |
---|
| 56 | |
---|
| 57 | int checkConnectionStatus(EccadDB conn); |
---|
| 58 | int checkSQLErrors(PGresult* res); |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | LIST mapOfParamById(EccadDB conn, int idMap, double mini, double maxi); |
---|
| 63 | LIST mapOfParam(EccadDB conn, ptrParam p); |
---|
| 64 | |
---|
| 65 | void colorAllocate(gdImagePtr im, LIST cmap); |
---|
| 66 | char * getRaster(const char * dbHost, const char * dbName, |
---|
| 67 | const char * dbUser, int idGrille, int idMap); |
---|
| 68 | LIST getGrids(EccadDB db, int idProduct, ptrParam p, ptrZone z, |
---|
| 69 | const char* dateBegin, const char* dateEnd); |
---|
| 70 | |
---|
| 71 | ptrGrid getGrid(EccadDB db, int idGrille, ptrZone z); |
---|
| 72 | |
---|
| 73 | LIST initParams(EccadDB conn); |
---|
| 74 | |
---|
| 75 | ptrGridGL extractGridFromDb(EccadDB db, int idGrille, ptrZone z); |
---|
| 76 | gdImagePtr grid2img(EccadDB db, ptrGrid g, ptrParam p, int idMap); |
---|
| 77 | |
---|
| 78 | double* getMaxParam(int idGrid, EccadDB conn); |
---|
| 79 | double* getMinParam(int idGrid, EccadDB conn); |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | #endif /*ECCAD_H_*/ |
---|