MCPcopy Create free account
hub / github.com/DFHack/dfhack / command_result plugin_init

Method command_result plugin_init

plugins/debug.cpp:1080–1103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078} } /* namespace debug */
1079
1080DFhackCExport DFHack::command_result plugin_init(DFHack::color_ostream& out,
1081 std::vector<DFHack::PluginCommand>& commands)
1082{
1083 commands.emplace_back(
1084 "debugfilter",
1085 "Manage runtime debug print filters",
1086 DFHack::debugPlugin::commandDebugFilter);
1087 auto& filMan = DFHack::debugPlugin::FilterManager::getInstance();
1088 DFHack::command_result rv = DFHack::CR_OK;
1089 if ((rv = filMan.loadConfig(out)) != DFHack::CR_OK)
1090 return rv;
1091 auto& catMan = DFHack::DebugManager::getInstance();
1092 std::lock_guard<std::mutex> lock(catMan.access_mutex_);
1093 for (auto* cat: catMan) {
1094 for (auto& filterPair: filMan) {
1095 DFHack::debugPlugin::Filter& filter = filterPair.second;
1096 filter.apply(*cat);
1097 }
1098 }
1099 INFO(init,out).print("plugin_init with {}, {} filters and {} categories\n",
1100 commands.size(), filMan.size(), catMan.size());
1101 filMan.connectTo(catMan.categorySignal);
1102 return rv;
1103}
1104
1105DFhackCExport DFHack::command_result plugin_shutdown(DFHack::color_ostream& out)
1106{

Callers

nothing calls this directly

Calls 5

loadConfigMethod · 0.80
connectToMethod · 0.80
applyMethod · 0.45
printMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected