Skip to content

Commit

Permalink
Added support for printing LTI's by their alias: print @color
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Mininger committed Sep 12, 2024
1 parent ab6814b commit 419e60b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions Core/CLI/src/cli_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,18 @@ void print_symbol(agent* thisAgent, const char* arg, bool print_filename, bool i
if (lLti_id)
{
lLti_id = thisAgent->SMem->lti_exists(lLti_id);
if (lLti_id == NIL)
{
thisAgent->outputManager->printa_sf(thisAgent, "LTI %s not found in semantic memory.", lexeme.string());
break;
}
}
else
{
// Treat the rest of the token as an LTI alias
std::string lti_alias(lexeme.string());
lti_alias = lti_alias.substr(1);
lLti_id = thisAgent->SMem->get_lti_with_alias(lti_alias);
}
if (lLti_id == NIL)
{
thisAgent->outputManager->printa_sf(thisAgent, "LTI %s not found in semantic memory.", lexeme.string());
break;
}
}
thisAgent->SMem->attach();
Expand Down
2 changes: 1 addition & 1 deletion Core/SoarKernel/src/semantic_memory/semantic_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class SMem_Manager

/* Methods for smem CLI commands*/
uint64_t lti_exists(uint64_t pLTI_ID);
uint64_t get_lti_with_alias(const std::string& lti_alias);
bool CLI_add(const char* str_to_LTMs, std::string** err_msg);
bool CLI_query(const char* ltms, std::string** err_msg, std::string** result_message, uint64_t number_to_retrieve);
bool CLI_remove(const char* ltms, std::string** err_msg, std::string** result_message, bool force = false);
Expand Down Expand Up @@ -162,7 +163,6 @@ class SMem_Manager
id_set print_LTM(uint64_t pLTI_ID, double lti_act, std::string* return_val, std::list<uint64_t>* history = NIL);

/* Methods for LTI aliases */
uint64_t get_lti_with_alias(const std::string& lti_alias);
uint64_t add_new_lti_with_alias(const std::string& lti_alias);
uint64_t get_or_add_lti_with_alias(const std::string& lti_alias);

Expand Down

0 comments on commit 419e60b

Please sign in to comment.