AuboCaps  0.6.0
loop_node.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_LOOP_NODE_H
2 #define AUBO_SCOPE_LOOP_NODE_H
3 
7 
8 namespace arcs {
9 namespace aubo_scope {
10 ARCS_CLASS_FORWARD(LoopNode);
11 
13 {
14 public:
15  /**
16  * The configuration type used to determine which type of configuration this
17  * instance is.
18  */
20  {
21 
22  /**
23  * <p>
24  * Looping infinitely has been selected.
25  * </p>
26  *
27  * The config instance can be cast to {@link AlwaysLoopNodeConfig}
28  */
30 
31  /**
32  * <p>
33  * Looping a certain number of times has been selected.
34  * </p>
35  *
36  * The config instance can be cast to {@link CounterLoopNodeConfig}
37  */
39 
40  /**
41  * <p>
42  * Looping as long as the evaluation of an expression is true has been
43  * selected.
44  * </p>
45  *
46  * The config instance can be cast to {@link ExpressionLoopNodeConfig}
47  */
48  EXPRESSION
49  };
50 
51  LoopNode(LoopNode &f);
52  LoopNode(LoopNode &&f);
53  virtual ~LoopNode();
54 
55  /**
56  * This method returns the type of configuration. Cast this instance
57  * appropriately to have access to specific getters.
58  *
59  * @return the type of this config.
60  */
61  ConfigType getConfigType();
62  void setConfigType(ConfigType type);
63 
64  /**
65  * Creates a loop counter configuration.
66  *
67  * @param loopCount the number of iterations through the loop node.
68  * @param errorHandler error handler for handling validation. If using
69  * {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
70  * nearest valid loop count value.
71  * @return the configuration.
72  */
73  void setLoopCount(int loop_count);
74  int getLoopCount();
75 
76  /**
77  * Create a loop expression configuration.
78  *
79  * @param expression the expression whose evaluation must be true to
80  * continue looping, not <code>null</code>.
81  * @param evaluateContinuously if <code>true</code> the expression will be
82  * evaluated continuously during the looping (i.e. the loop can be
83  * interrupted anytime during its execution), otherwise <code>false</code>
84  * and the expression will be evaluated once per loop iteration.
85  * @return the configuration.
86  */
87  void setExpression(ExpressionPtr expression);
88  ExpressionPtr getExpression();
89 
90  /**
91  *
92  * @return <code>true</code> if the expression will be evaluated
93  * continuously during the looping (i.e. the loop can be interrupted anytime
94  * during its execution), otherwise <code>false</code> and the expression
95  * will be evaluated once per loop iteration.
96  */
97  bool isEvaluateContinously();
98  void setEvaluateContinously(bool cont);
99 
100  /**
101  *
102  * @return the variable for storing the loop count
103  */
104  void setLoopCountVariable(VariablePtr var);
105  VariablePtr getLoopCountVariable();
106 
107 private:
108  friend class DataSwitch;
109  LoopNode();
110  void *d_{ nullptr };
111 };
112 
113 } // namespace aubo_scope
114 } // namespace arcs
115 #endif // AUBO_SCOPE_LOOP_NODE_H
ARCS_CLASS_FORWARD(GripForceCapability)
ConfigType
The configuration type used to determine which type of configuration this instance is...
Definition: loop_node.h:19
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16