MCPcopy Create free account
hub / github.com/SoarGroup/Soar / DoExcise

Method DoExcise

Core/CLI/src/cli_excise.cpp:27–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace sml;
26
27bool CommandLineInterface::DoExcise(const ExciseBitset& options, const std::string* pProduction)
28{
29 int64_t exciseCount = 0;
30 agent* thisAgent = m_pAgentSML->GetSoarAgent();
31
32 // Process the general options
33 if (options.test(EXCISE_ALL))
34 {
35 exciseCount += thisAgent->num_productions_of_type[USER_PRODUCTION_TYPE];
36 exciseCount += thisAgent->num_productions_of_type[CHUNK_PRODUCTION_TYPE];
37 exciseCount += thisAgent->num_productions_of_type[JUSTIFICATION_PRODUCTION_TYPE];
38 exciseCount += thisAgent->num_productions_of_type[DEFAULT_PRODUCTION_TYPE];
39
40 excise_all_productions(thisAgent, false);
41
42 this->DoInitSoar(); // from the manual, init when --all or --task are executed
43 }
44 if (options.test(EXCISE_CHUNKS))
45 {
46 exciseCount += thisAgent->num_productions_of_type[CHUNK_PRODUCTION_TYPE];
47 exciseCount += thisAgent->num_productions_of_type[JUSTIFICATION_PRODUCTION_TYPE];
48
49 excise_all_productions_of_type(thisAgent, CHUNK_PRODUCTION_TYPE, false);
50 excise_all_productions_of_type(thisAgent, JUSTIFICATION_PRODUCTION_TYPE, false);
51 }
52 if (options.test(EXCISE_DEFAULT))
53 {
54 exciseCount += thisAgent->num_productions_of_type[DEFAULT_PRODUCTION_TYPE];
55
56 excise_all_productions_of_type(thisAgent, DEFAULT_PRODUCTION_TYPE, false);
57 }
58 if (options.test(EXCISE_RL))
59 {
60 for (production* prod = thisAgent->all_productions_of_type[DEFAULT_PRODUCTION_TYPE]; prod != NIL; prod = prod->next)
61 {
62 if (prod->rl_rule)
63 {
64 exciseCount++;
65 excise_production(thisAgent, prod, thisAgent->sysparams[TRACE_LOADING_SYSPARAM] != 0);
66 }
67 }
68
69 for (production* prod = thisAgent->all_productions_of_type[USER_PRODUCTION_TYPE]; prod != NIL; prod = prod->next)
70 {
71 if (prod->rl_rule)
72 {
73 exciseCount++;
74 excise_production(thisAgent, prod, thisAgent->sysparams[TRACE_LOADING_SYSPARAM] != 0);
75 }
76 }
77
78 for (production* prod = thisAgent->all_productions_of_type[CHUNK_PRODUCTION_TYPE]; prod != NIL; prod = prod->next)
79 {
80 if (prod->rl_rule)
81 {
82 exciseCount++;
83 excise_production(thisAgent, prod, thisAgent->sysparams[TRACE_LOADING_SYSPARAM] != 0);
84 }

Callers 1

ParseMethod · 0.45

Calls 7

DoInitSoarMethod · 0.95
excise_all_productionsFunction · 0.85
excise_productionFunction · 0.85
find_str_constantFunction · 0.85
SetErrorFunction · 0.85

Tested by

no test coverage detected