From 541ae2db28eae2b7db207683be3c11c98259dc15 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sat, 10 Dec 2022 18:29:21 -0300 Subject: [PATCH] add entity documentation --- src/models/entity.h | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/src/models/entity.h b/src/models/entity.h index 7e4d0e0..7ede503 100644 --- a/src/models/entity.h +++ b/src/models/entity.h @@ -7,46 +7,119 @@ namespace obelisk { + /** + * @brief The Entity model represents either a left or right side entity, + * typically used in facts and rules. + * + */ class Entity { private: + /** + * @brief The ID of the Entity. + * + */ int id_; + /** + * @brief The name of the Entity. + * + */ std::string name_; public: + /** + * @brief Construct a new Entity object. + * + */ Entity() : id_(0), name_("") { } + /** + * @brief Construct a new Entity object. + * + * @param[in] id The ID of the Entity. + */ Entity(int id) : id_(id), name_("") { } + /** + * @brief Construct a new Entity object. + * + * @param[in] name The name of the Entity. + */ Entity(std::string name) : id_(0), name_(name) { } + /** + * @brief Construct a new Entity object. + * + * @param[in] id The ID of the Entity. + * @param[in] name The name of the Entity. + */ Entity(int id, std::string name) : id_(id), name_(name) { } + /** + * @brief Create the table in the knowledge base. + * + * @return const char* Returns the query used to create the table. + */ static const char* createTable(); + /** + * @brief Get the ID of the Entity. + * + * @return int& Returns the ID. + */ int& getId(); + + /** + * @brief Set the ID of the Entity. + * + * @param[in] id The ID of the Entity. + */ void setId(int id); + /** + * @brief Get the name of the Entity. + * + * @return std::string& The name of the Entity. + */ std::string& getName(); + + /** + * @brief Set the name of the Entity. + * + * @param[in] name The name of the Entity. + */ void setName(std::string name); + /** + * @brief Select an Entity from the database based on the object's + * ID. + * + * @param[in] dbConnection The database connection to use. + */ void selectEntity(sqlite3* dbConnection); + + /** + * @brief Insert an Entity into the database based on the object's + * fields. + * + * @param[in] dbConnection The database connection to use. + */ void insertEntity(sqlite3* dbConnection); }; } // namespace obelisk