actions.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include <RobotAPI/interface/armem/actions.h>
6 
8 {
9  // Business objects to make working with the Armem
10  // action interface easier. To see an example usage,
11  // check the ExampleMemory.
12 
13  struct MenuEntry
14  {
15  MenuEntry(const std::string& id,
16  const std::string& text,
17  const std::vector<MenuEntry>& entries = {});
18 
19  MenuEntry& add(const std::string& id,
20  const std::string& text,
21  const std::vector<MenuEntry>& entries = {});
22 
23  data::MenuEntryPtr toIce() const;
24 
25  static MenuEntry fromIce(const data::MenuEntryPtr& ice);
26 
27  public:
28  std::string id;
29  std::string text;
30  std::vector<MenuEntry> entries;
31  };
32 
33 
34  struct Action : public MenuEntry
35  {
36  Action(const std::string& id, const std::string& text);
37  };
38 
39  struct SubMenu : public MenuEntry
40  {
41  SubMenu(const std::string& id,
42  const std::string& text,
43  const std::vector<MenuEntry>& entries = {});
44 
45  MenuEntry& add(const std::string& id,
46  const std::string& text,
47  const std::vector<MenuEntry>& entries = {});
48  };
49 
50 
51  class Menu
52  {
53 
54  public:
55  Menu(std::initializer_list<MenuEntry> entries);
56 
57  Menu(const std::vector<MenuEntry>& entries = {});
58 
59  MenuEntry& add(const std::string& id,
60  const std::string& text,
61  const std::vector<MenuEntry>& entries = {});
62 
63  data::MenuPtr toIce() const;
64 
65  static Menu fromIce(const data::MenuPtr& ice);
66 
67  public:
68  std::vector<MenuEntry> entries;
69  };
70 
71  using data::ExecuteActionInputSeq;
72  using data::ExecuteActionOutputSeq;
73  using data::GetActionsInputSeq;
74  using data::GetActionsOutputSeq;
75  using data::ActionPath;
76 
77 } // namespace armarx::armem::actions
armarx::armem::actions::MenuEntry::fromIce
static MenuEntry fromIce(const data::MenuEntryPtr &ice)
Definition: actions.cpp:40
armarx::armem::actions::SubMenu::SubMenu
SubMenu(const std::string &id, const std::string &text, const std::vector< MenuEntry > &entries={})
Definition: actions.cpp:60
armarx::armem::actions::Menu::Menu
Menu(std::initializer_list< MenuEntry > entries)
Definition: actions.cpp:76
armarx::armem::actions::Menu::toIce
data::MenuPtr toIce() const
Definition: actions.cpp:92
armarx::armem::actions::MenuEntry::text
std::string text
Definition: actions.h:29
armarx::armem::actions::MenuEntry
Definition: actions.h:13
armarx::armem::actions::Menu::entries
std::vector< MenuEntry > entries
Definition: actions.h:68
armarx::armem::actions::MenuEntry::entries
std::vector< MenuEntry > entries
Definition: actions.h:30
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::armem::actions::Action::Action
Action(const std::string &id, const std::string &text)
Definition: actions.cpp:56
armarx::armem::actions::MenuEntry::toIce
data::MenuEntryPtr toIce() const
Definition: actions.cpp:24
armarx::armem::actions::Menu::fromIce
static Menu fromIce(const data::MenuPtr &ice)
Definition: actions.cpp:103
armarx::armem::actions::Menu::add
MenuEntry & add(const std::string &id, const std::string &text, const std::vector< MenuEntry > &entries={})
Definition: actions.cpp:86
armarx::armem::actions::MenuEntry::MenuEntry
MenuEntry(const std::string &id, const std::string &text, const std::vector< MenuEntry > &entries={})
Definition: actions.cpp:8
armarx::armem::actions::MenuEntry::add
MenuEntry & add(const std::string &id, const std::string &text, const std::vector< MenuEntry > &entries={})
Definition: actions.cpp:16
armarx::armem::actions::SubMenu::add
MenuEntry & add(const std::string &id, const std::string &text, const std::vector< MenuEntry > &entries={})
Definition: actions.cpp:68
armarx::armem::actions::SubMenu
Definition: actions.h:39
armarx::armem::actions
Definition: actions.cpp:5
armarx::armem::actions::MenuEntry::id
std::string id
Definition: actions.h:28
armarx::armem::actions::Menu
Definition: actions.h:51
armarx::armem::actions::Action
Definition: actions.h:34