Command system¶
There are three command sources types:
command line : send command from the internal falcon processing
keyboard : send command via keyboard shortcut
cloud : send command via zmq network
The namespace “commands” is used to contain the command system logic. Each sources derived from CommandSource and are added in the CommandHandler during the setup part of the main.
-
class CommandSource
Subclassed by commands::CommandLineCommands, commands::KeyboardCommands, commands::ZMQCommands
Public Functions
-
inline virtual bool getcommand(std::deque<std::string> &command)
-
inline virtual bool sendreply(const std::deque<std::string> &command, std::deque<std::string> &reply)
-
inline virtual bool getcommand(std::deque<std::string> &command)
Commands are requested (serially) from sources and handled by CommandHandler class in main thread. Graph commands are forwarded to GraphManager and handled in graph thread. Replies are sent to the original requester of the command.
-
class CommandHandler
Public Functions
-
inline CommandHandler(GlobalContext &context)
-
inline void addSource(CommandSource &source)
Add a source to receive commands from it (example: cloud/zmq, command line, keyboard)
- Parameters
source – class defining the source of commands derived from CommandSource
-
bool HandleCommand(std::deque<std::string> &command, std::deque<std::string> &reply)
Receive commands and delegate to the graph thread in case of a graph command or handle it directly
- Parameters
command –
reply – buffer for the answer from the graph socket
- Returns
if falcon should be safely (closing all threads) terminated
-
bool DelegateGraphCommand(std::deque<std::string> &command, std::deque<std::string> &reply)
Send commands to the graph thread via it graph socket
- Parameters
command – keyword send to the graph thread
reply – buffer for the answer from the graph socket
- Returns
always false - no command to the graph can terminate the main thread
-
bool DelegateResourcesCommand(std::deque<std::string> &command, std::deque<std::string> &reply)
Manage sub-command for the resources command
- Parameters
sub-command – keyword
reply – buffer for the answer from the graph socket
- Returns
always false - no resources command can terminate the main thread
-
void start()
Once start is launched the main thread is busy only listening, processing and replying to messages coming from listed sources
-
inline CommandHandler(GlobalContext &context)