obelisk/src/lib/models/action.h

129 lines
3.1 KiB
C
Raw Normal View History

2022-11-01 01:04:41 -03:00
#ifndef OBELISK_MODELS_ACTION_H
#define OBELISK_MODELS_ACTION_H
#include <sqlite3.h>
2022-11-01 01:04:41 -03:00
#include <string>
namespace obelisk
{
2022-12-10 18:13:01 -03:00
/**
* @brief The Action model represents an action to take when a fact is true
* or false.
2022-12-10 18:13:01 -03:00
*
*/
2022-11-01 01:04:41 -03:00
class Action
{
private:
2022-12-10 18:13:01 -03:00
/**
* @brief The ID of the Action in the KnowledgeBase.
2022-12-10 18:13:01 -03:00
*
*/
2022-11-01 01:04:41 -03:00
int id_;
2022-12-10 18:13:01 -03:00
/**
* @brief The name of the Action.
2022-12-10 18:13:01 -03:00
*
*/
2022-11-01 01:04:41 -03:00
std::string name_;
public:
2022-12-10 18:13:01 -03:00
/**
* @brief Construct a new Action object.
*
*/
2022-11-01 01:04:41 -03:00
Action() :
id_(0),
name_("")
{
}
2022-12-10 18:13:01 -03:00
/**
* @brief Construct a new Action object.
*
* @param[in] id The ID of the Action.
2022-12-10 18:13:01 -03:00
*/
2022-11-01 01:04:41 -03:00
Action(int id) :
id_(id),
name_("")
{
}
2022-12-10 18:13:01 -03:00
/**
* @brief Construct a new Action object.
*
* @param[in] name The name of the Action.
2022-12-10 18:13:01 -03:00
*/
2022-11-01 01:04:41 -03:00
Action(std::string name) :
id_(0),
name_(name)
{
}
2022-12-10 18:13:01 -03:00
/**
* @brief Construct a new Action object.
*
* @param[in] id The ID of the Action.
* @param[in] name The name of the Action.
2022-12-10 18:13:01 -03:00
*/
2022-11-01 01:04:41 -03:00
Action(int id, std::string name) :
id_(id),
name_(name)
{
}
2022-12-10 18:13:01 -03:00
/**
* @brief Create the Action table in the KnowledgeBase.
2022-12-10 18:13:01 -03:00
*
* @return const char* Returns the query used to create the table.
*/
2022-11-01 01:04:41 -03:00
static const char* createTable();
2022-12-10 18:13:01 -03:00
/**
* @brief Get the ID of the Action.
2022-12-10 18:13:01 -03:00
*
* @return int& Returns the ID.
*/
2022-11-26 00:32:06 -03:00
int& getId();
2022-12-10 18:13:01 -03:00
/**
* @brief Set the ID of the Action.
2022-12-10 18:13:01 -03:00
*
* @param[in] id Set the ID of the Action.
2022-12-10 18:13:01 -03:00
*/
2022-11-01 01:04:41 -03:00
void setId(int id);
2022-12-10 18:13:01 -03:00
/**
* @brief Get the name of the Action.
2022-12-10 18:13:01 -03:00
*
* @return std::string& The Action name.
2022-12-10 18:13:01 -03:00
*/
2022-11-26 00:32:06 -03:00
std::string& getName();
2022-12-10 18:13:01 -03:00
/**
* @brief Set the name of the Action.
2022-12-10 18:13:01 -03:00
*
* @param[in] name The name of the Action.
2022-12-10 18:13:01 -03:00
*/
2022-11-01 01:04:41 -03:00
void setName(std::string name);
/**
* @brief Select an Action from the datbase based on the object
* name.
*
* @param[in] dbConnection The database connection to use.
*/
void selectByName(sqlite3* dbConnection);
/**
* @brief Insert an Action into the KnowledgeBase based on the
* object's fields.
*
* @param[in] dbConnection The database connection to use.
*/
void insert(sqlite3* dbConnection);
2022-11-01 01:04:41 -03:00
};
} // namespace obelisk
#endif