Implement add_group_characteristic
This commit is contained in:
parent
62ec3b7be6
commit
14655400e3
@ -19,6 +19,26 @@ token_id_t ruleset_t::add_token(token_type_e type, mtl::fixed value) {
|
||||
return m_tokens.size() - 1;
|
||||
}
|
||||
|
||||
group_id_t ruleset_t::add_group_characteristic(const etl::ivector<token_id_t>& tokens, uint32_t factor) {
|
||||
if (m_group_characteristics.full()) {
|
||||
throw mtl::length_error();
|
||||
}
|
||||
|
||||
m_group_characteristics.push_back(group_characteristic_t());
|
||||
group_characteristic_t& chr = m_group_characteristics.back();
|
||||
chr.m_factor = factor;
|
||||
|
||||
for (token_id_t tok : tokens) {
|
||||
if (!valid_token(tok)) {
|
||||
throw mtl::invalid_argument();
|
||||
}
|
||||
|
||||
chr.m_token_ids.push_back(tok);
|
||||
}
|
||||
|
||||
return m_group_characteristics.size() - 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
token_id_t generator_t::add_token(token_type_e type, mtl::fixed value) {
|
||||
log::debug << "Adding token with type " << (int)type << endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user