Motorcortex Core  version: 2.7.6
ps_actbuffer.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2015 VECTIONEER.
4  */
5 
6 #ifndef PS_ACTBUFFER_H
7 #define PS_ACTBUFFER_H
8 
9 #include "utl_buffer.h"
10 #include <string>
11 
12 namespace mcx {
13 
14 namespace parameter_server {
15 
16 class Parameter;
17 
18 enum ActionType {
19  NONE = 0,
20  START_PUBLISH,
21  STOP_PUBLISH,
22  PUBLISH_ONCE,
23  NEW_VALUE,
24  OVERWRITE_OUTPUT,
25  OVERWRITE_INPUT,
26  ACTIVATE_OVERWRITE_OUTPUT,
27  ACTIVATE_OVERWRITE_INPUT,
28  DEACTIVATE_OVERWRITE,
29  ACTIVATE_LINK,
30  DEACTIVATE_LINK,
31 };
32 
33 struct Action {
34  ActionType type;
35  Parameter* param;
36 };
37 
38 class ActionBuffer {
39 public:
40  ActionBuffer();
41 
42  virtual ~ActionBuffer();
43 
44  void setName(const char* name);
45 
46  void allocate(uint32_t element_size);
47 
48  void deallocate();
49 
50  bool push(const Action& new_action);
51 
52  bool pull(Action& action);
53 
54  bool isEmpty();
55 
56  ActionBuffer(const ActionBuffer&) = delete;
57 
58  ActionBuffer& operator=(const ActionBuffer&) = delete;
59 
60 private:
62  uint32_t counter_;
63  std::string name_;
64 };
65 
66 } // namespace parameter_server
67 
68 } // namespace mcx
69 
70 #endif /* PS_INBUFFER_H */
mcx::parameter_server::Parameter
Definition: ps_parameter.h:45
mcx::parameter_server::ActionBuffer
Definition: ps_actbuffer.h:38
mcx::parameter_server::Action
Definition: ps_actbuffer.h:33
mcx::utils::MpmcQueue
Definition: utl_buffer.h:70