|
nexuslua
|
Functions related to agents or plugins, which are (un-)installable agents with meta data like a version, see class nexuslua::Agent. More...
#include <agents.hpp>


Public Member Functions | |
| agents () | |
| virtual | ~agents () |
| void | DeleteAgents () |
| const std::map< std::string, std::shared_ptr< const Agent > > & | GetPlugins () |
| key is plugin name, same as AgentPlugin::GetName() | |
| void | InvalidatePluginScan () |
| after calling this function, the next call to agents::GetPlugins will rescan the plugin directory | |
| PluginInstallResult | InstallPlugin (const std::filesystem::path &srcFolder, std::string &errorMessage) |
| user selects a directory with a plugin to be installed. This function installs it. In case of ERROR_WHILE_CREATING_INSTANCE, errorMessage will contain an English error description | |
| PluginInstallResult | InstallPlugin (const std::shared_ptr<::nexuslua::Agent > &agent, const std::filesystem::path &srcFolder, std::string &errorMessage) |
| user selects a directory with a plugin to be installed. This function installs it. In case of ERROR_WHILE_CREATING_INSTANCE, errorMessage will contain an English error description | |
| PluginUninstallResult | UninstallPlugin (const std::string &name) |
| the name is identical with AgentPlugin::GetName() | |
| void | RestorePersistentPluginFolder (const std::shared_ptr<::nexuslua::Agent > &plugin, const std::filesystem::path &srcFolder) |
| copy the persistent subfolder from the given directory to the plugin folder | |
| const AgentMessage & | GetMessage (const std::string &agentName, const std::string &messageName) |
| return the given message | |
| std::shared_ptr< AgentCpp > | Add (const std::string &agentName, const CppHandler &cppHandler, const LuaTable &predefinedTable={}) |
| creates a new hardware thread that calls cppHandler as soon as a message is sent to it via either nexuslua send, or nexuslua::AgentMessage::Send | |
| std::shared_ptr< AgentLua > | Add (const std::string &agentName, const std::filesystem::path &pathToLuaFile, const std::string &luaCode="", const LuaTable &predefinedTable={}) |
| creates a new hardware thread that calls luaCode, if not empty, otherwise the given lua file | |
| std::shared_ptr< Agent > | GetAgent (const std::string &agentName) |
| returns the Agent instance associated with the given agent name, or nullptr if there is no such agent | |
| void | AddMessageForCppAgent (const std::string &agentName, const std::string &messageName) |
| registers a message for an nexuslua::Agent that has been created via nexuslua::agents::Add. | |
| void | WaitUntilMessageQueueIsEmpty () |
| wait until the nexuslua agents processed all remaining messages | |
| void | ShutdownAgents () |
| if the main application quits, it should use this function to make sure all threads have ended before the main function returned or the shared library is being unloaded | |
Static Public Member Functions | |
| static int64_t | TotalSizeOfMessagesQueues () |
Functions related to agents or plugins, which are (un-)installable agents with meta data like a version, see class nexuslua::Agent.
| nexuslua::agents::agents | ( | ) |
|
virtual |
| std::shared_ptr< AgentCpp > nexuslua::agents::Add | ( | const std::string & | agentName, |
| const CppHandler & | cppHandler, | ||
| const LuaTable & | predefinedTable = {} ) |
creates a new hardware thread that calls cppHandler as soon as a message is sent to it via either nexuslua send, or nexuslua::AgentMessage::Send
| agentName | the name of the agent to be added |
| cppHandler | the handler for the agent, which needs to have the signature CppHandler |
| predefinedTable | can be used to predefine arbitrary Lua tables, e. g. the default table arg containing command line arguments of the Lua executable |
| std::shared_ptr< AgentLua > nexuslua::agents::Add | ( | const std::string & | agentName, |
| const std::filesystem::path & | pathToLuaFile, | ||
| const std::string & | luaCode = "", | ||
| const LuaTable & | predefinedTable = {} ) |
creates a new hardware thread that calls luaCode, if not empty, otherwise the given lua file
| agentName | the name of the agent to be added |
| pathToLuaFile | either the path of the Lua file that shall be used to handle messages, or the path to the Lua file that contains the luaCode given in the third parameter |
| luaCode | optional Lua code as string that shall be used to handle messages to this agent |
| predefinedTable | can be used to predefine arbitrary Lua tables, e. g. the default table arg containing command line arguments of the Lua executable |
| void nexuslua::agents::AddMessageForCppAgent | ( | const std::string & | agentName, |
| const std::string & | messageName ) |
registers a message for an nexuslua::Agent that has been created via nexuslua::agents::Add.
| agentName | the name of the agent for which the message shall be registered |
| messageName | the name of the new message |
| void nexuslua::agents::DeleteAgents | ( | ) |
| std::shared_ptr< Agent > nexuslua::agents::GetAgent | ( | const std::string & | agentName | ) |
| const AgentMessage & nexuslua::agents::GetMessage | ( | const std::string & | agentName, |
| const std::string & | messageName ) |
return the given message
| const std::map< std::string, std::shared_ptr< const Agent > > & nexuslua::agents::GetPlugins | ( | ) |
key is plugin name, same as AgentPlugin::GetName()
| PluginInstallResult nexuslua::agents::InstallPlugin | ( | const std::filesystem::path & | srcFolder, |
| std::string & | errorMessage ) |
user selects a directory with a plugin to be installed. This function installs it. In case of ERROR_WHILE_CREATING_INSTANCE, errorMessage will contain an English error description
| PluginInstallResult nexuslua::agents::InstallPlugin | ( | const std::shared_ptr<::nexuslua::Agent > & | agent, |
| const std::filesystem::path & | srcFolder, | ||
| std::string & | errorMessage ) |
user selects a directory with a plugin to be installed. This function installs it. In case of ERROR_WHILE_CREATING_INSTANCE, errorMessage will contain an English error description
| void nexuslua::agents::InvalidatePluginScan | ( | ) |
after calling this function, the next call to agents::GetPlugins will rescan the plugin directory
| void nexuslua::agents::RestorePersistentPluginFolder | ( | const std::shared_ptr<::nexuslua::Agent > & | plugin, |
| const std::filesystem::path & | srcFolder ) |
copy the persistent subfolder from the given directory to the plugin folder
| void nexuslua::agents::ShutdownAgents | ( | ) |
if the main application quits, it should use this function to make sure all threads have ended before the main function returned or the shared library is being unloaded
|
static |
| PluginUninstallResult nexuslua::agents::UninstallPlugin | ( | const std::string & | name | ) |
the name is identical with AgentPlugin::GetName()
| void nexuslua::agents::WaitUntilMessageQueueIsEmpty | ( | ) |
wait until the nexuslua agents processed all remaining messages