AuboCaps  0.5.0
variable_factory.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_VARIABLE_FACTORY_H
2 #define AUBO_SCOPE_VARIABLE_FACTORY_H
3 
6 
7 namespace arcs {
8 namespace aubo_scope {
9 ARCS_CLASS_FORWARD(VariableFactory);
10 
11 /**
12  * <p>
13  * This interface supplies methods to create variable objects.
14  * </p>
15  *
16  * <b>NOTE:</b> Only use this functionality in a AuboCap program node (not
17  * relevant for an installation node).
18  */
20 {
21 public:
24  ~VariableFactory();
25 
26  /**
27  * <p>
28  * Creates a global variable. Registering the variable in AuboScope (by
29  * storing it in a {@link DataModel} instance or using it for the
30  * configuration of a built-in AuboScope program node) will make it
31  * accessible to all program nodes.
32  * </p>
33  *
34  * <b>NOTE:</b> Only use this method in a AuboCap program node (not relevant
35  * for an installation node).
36  *
37  * @param suggested_name Suggested name of the variable. Valid names must
38  * match regex [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters.
39  *
40  * @return GlobalVariable.
41  * @throws VariableException In case of an illegal name.
42  */
43  GlobalVariablePtr createGlobalVariable(const std::string &suggested_name);
44 
45  /**
46  * <p>
47  * Creates a global variable.
48  * </p>
49  *
50  * <p>
51  * Registering the variable in AuboScope (by storing it in a {@link
52  * DataModel} instance or using it for the configuration of a built-in
53  * AuboScope program node) will make it accessible to all program nodes.
54  * </p>
55  *
56  * <p>
57  * Setting an initial value will make it possible to read from the variable
58  * immediately without having to assign a value to it first. This can be
59  * useful in various constructs which requires an initial value, e.g. 'var_1
60  * = var_1 + 1' or 'if (var_2 =):'.
61  * </p>
62  *
63  * <b>NOTE:</b> Only use this method in a AuboCap program node (not relevant
64  * for an installation node).
65  *
66  * @param suggested_name Suggested name of the variable. Valid names must
67  * match regex [a-zA-Z][a-zA-Z0-9_]{0,14} for a total of 15 characters.
68  * @param initialValue The expression that will be evaluated in order to
69  * initialize the value of the variable. This value is assigned before the
70  * actual program runs.
71  *
72  * @return GlobalVariable.
73  * @throws VariableException In case of an illegal name.
74  */
75  GlobalVariablePtr createGlobalVariable(const std::string &suggested_name,
76  ExpressionPtr initialValue);
77 
78 private:
79  friend class DataSwitch;
81  void *d_{ nullptr };
82 };
83 
84 } // namespace aubo_scope
85 } // namespace arcs
86 #endif // AUBO_SCOPE_VARIABLE_FACTORY_H
ARCS_CLASS_FORWARD(GripForceCapability)
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16