Skip to content

Commit

Permalink
Merge pull request #11 from oroneta/add-doc
Browse files Browse the repository at this point in the history
Documentation of functions added
  • Loading branch information
ZhengLinLei authored May 4, 2024
2 parents ec0892e + c2a91dc commit e1c7ea7
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/h/base_DB.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,49 @@
#include <libpq-fe.h>
#include <cstring>


/*!
* \brief Establishes a connection to the database.
* \param user : The username for the databse.
* \param password : The password for the database.
*
* \return A pointer to the connection object.
*/
PGconn* DB_connection(const char* user, const char* password);

/*!
* \brief Checks if a drone exists in the database.
* \param conn : The database connection.
* \param dic : The drone identifier code.
*
* \return True if the drone exists, false otherwise.
*/
bool checkDic(PGconn* conn, const char* dic);

/*!
* \brief Inserts a new route into the database.
* \param conn : The database connection.
* \param dic : The drone identification code.
* \param auth_code : The authentication code for the drone.
* \param route : The route to insert. The route should be a string with the format: "[[x0,y0],[x1,y1],...]".
*/
void insertRoute(PGconn* conn, const char* dic, const char* auth_code, const char* route);

/*!
* \brief Cheks if the authorization code for a drone is valid.
* \param dic : The drone identifier code.
* \param authCode : The authentication code to check.
*
* \return True if the authentication code is correct, false otherwise.
*/
bool checkAuthCode(PGconn* conn, const char* dic, const char* authCode);

/*!
* \brief Checks for collisions on a given route.
* \param dic : The drone identifier code.
* \param route : The route to check for collisions. The route should be a string with the format: "[[x0,y0],[x1,y1],...]".
*
* \return The number of potential collisions on the route
*/
int checkColissions(PGconn* conn, const char* dic, const char* route);

#endif

0 comments on commit e1c7ea7

Please sign in to comment.