add entity documentation

This commit is contained in:
Chris Cromer 2022-12-10 18:29:21 -03:00
parent b908bdf89b
commit 541ae2db28
Signed by: cromer
GPG Key ID: FA91071797BEEEC2
1 changed files with 73 additions and 0 deletions

View File

@ -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