From 62ec3b7be6e7d3279a83d9bbaa1febc898d3db0b Mon Sep 17 00:00:00 2001 From: Madeline Busig Date: Tue, 29 Apr 2025 06:04:55 -0700 Subject: [PATCH] Move *_full to fractal.hpp and add valid token check --- include/fractal.hpp | 11 +++++++++-- src/fractal.cpp | 4 ---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/fractal.hpp b/include/fractal.hpp index ff295af..dccee7e 100644 --- a/include/fractal.hpp +++ b/include/fractal.hpp @@ -101,7 +101,12 @@ public: * * @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 @@ -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 */ - bool group_characteristics_full() const; + bool group_characteristics_full() const { + return m_group_characteristics.full(); + } /** * @brief Add new group characteristic diff --git a/src/fractal.cpp b/src/fractal.cpp index 8f21041..20c0731 100644 --- a/src/fractal.cpp +++ b/src/fractal.cpp @@ -8,10 +8,6 @@ namespace log = mtl::log; 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) { if (m_tokens.full()) { throw mtl::length_error();