Move *_full to fractal.hpp and add valid token check

This commit is contained in:
Madeline Busig 2025-04-29 06:04:55 -07:00
parent 66fe6ba388
commit 62ec3b7be6
2 changed files with 9 additions and 6 deletions

View File

@ -101,7 +101,12 @@ public:
* *
* @ret @c true if the number of tokens in the ruleset equals @c g_max_tokens, @c false otherwise * @ret @c true if the number of tokens in the ruleset equals @c g_max_tokens, @c false otherwise
*/ */
bool tokens_full() const; bool tokens_full() const {
return m_tokens.full();
}
bool valid_token(token_id_t tok) const {
return tok < m_tokens.size();
}
/** /**
* @brief Add new token variable that can be used in this ruleset * @brief Add new token variable that can be used in this ruleset
@ -120,7 +125,9 @@ public:
* *
* @ret @c true if the number of group characteristics in the ruleset equals @c g_max_cgroups, @c false otherwise * @ret @c true if the number of group characteristics in the ruleset equals @c g_max_cgroups, @c false otherwise
*/ */
bool group_characteristics_full() const; bool group_characteristics_full() const {
return m_group_characteristics.full();
}
/** /**
* @brief Add new group characteristic * @brief Add new group characteristic

View File

@ -8,10 +8,6 @@ namespace log = mtl::log;
namespace fractal { namespace fractal {
bool ruleset_t::tokens_full() const {
return m_tokens.full();
}
token_id_t ruleset_t::add_token(token_type_e type, mtl::fixed value) { token_id_t ruleset_t::add_token(token_type_e type, mtl::fixed value) {
if (m_tokens.full()) { if (m_tokens.full()) {
throw mtl::length_error(); throw mtl::length_error();