PVData C++  8.0.2
standardField.h
1 /* standardField.h */
2 /*
3  * Copyright information and license terms for this software can be
4  * found in the file LICENSE that is included with the distribution
5  */
6 /**
7  * @author mrk
8  */
9 #ifndef STANDARDFIELD_H
10 #define STANDARDFIELD_H
11 
12 #include <string>
13 #include <stdexcept>
14 
15 #include <pv/pvIntrospect.h>
16 
17 #include <shareLib.h>
18 
19 namespace epics { namespace pvData {
20 
21 
22 class StandardField;
23 typedef std::tr1::shared_ptr<StandardField> StandardFieldPtr;
24 
25 /**
26  * @brief Standard Fields is a class or creating or sharing Field objects for standard fields.
27  *
28  * For each type of standard object two methods are defined:s
29  * one with no properties and with properties
30  * The property field is a comma separated string of property names of the following:
31  * alarm, timeStamp, display, control, and valueAlarm.
32  * An example is "alarm,timeStamp,valueAlarm".
33  * The method with properties creates a structure with fields named fieldName
34  * and each of the property names.
35  * Each property field is a structure defining the property.
36  * The details about each property is given in the section named "Property".
37  * For example the call:
38  * {@code
39  StructureConstPtr example = standardField->scalar(
40  std::string("value"),
41  pvDouble,
42  std::string("value,alarm,timeStamp"));
43  * }
44  * Will result in a Field definition that has the form: {@code
45  structure example
46  double value
47  structure alarm
48  int severity
49  int status
50  string message
51  structure timeStamp
52  long secondsPastEpoch
53  int nanoseconds
54  int userTag
55  * }
56  * In addition there are methods that create each of the property structures,
57  * i.e. the methods named: alarm, .... enumeratedAlarm."
58  *
59  * StandardField is a singleton class. The class is accessed via the statement: {@code
60  StandardField *standardField = getStandardField();
61  * }
62  */
63 class epicsShareClass StandardField {
64  static void once(void*);
65 public:
66  /**
67  * getStandardField returns the singleton.
68  * @return Shared pointer to StandardField.
69  */
70  static const StandardFieldPtr& getStandardField();
71  ~StandardField();
72  /** Create a structure that has a scalar value field.
73  * @param type The type.
74  * @param properties A comma separated list of properties.
75  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
76  * @return The const shared pointer to the structure.
77  */
79  /** Create a structure that has a union value field.
80  * @param punion The interface for value field.
81  * @param properties A comma separated list of properties.
82  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
83  * @return The const shared pointer to the structure.
84  */
86  UnionConstPtr const & punion,
87  std::string const & properties);
88  /** Create a structure that has a variant union value field.
89  * @param properties A comma separated list of properties.
90  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
91  * @return The const shared pointer to the structure.
92  */
94  /** Create a structure that has a scalarArray value field.
95  * @param elementType The element type.
96  * @param properties A comma separated list of properties.
97  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
98  * @return The const shared pointer to the structure.
99  */
101  /** Create a structure that has a structureArray value field.
102  * @param structure The Structure introspection object for elements of the value field.
103  * @param properties A comma separated list of properties.
104  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
105  * @return The const shared pointer to the structure.
106  */
109  std::string const & properties);
110  /** Create a structure that has a unionArray value field.
111  * @param punion The Union introspection object for elements of the value field.
112  * @param properties A comma separated list of properties.
113  * This is some combination of "alarm,timeStamp,display,control".
114  * @return The const shared pointer to the structure.
115  */
117  UnionConstPtr const & punion,
118  std::string const & properties);
119  /** Create a structure that has an enumerated structure value field.
120  * The id for the structure is "enum_t".
121  * @return The const shared pointer to the structure.
122  */
124  /** Create a structure that has an enumerated structure value field
125  * The id for the structure is "epics:nt/NTEnum:1.0".
126  * @param properties A comma separated list of properties.
127  * This is some combination of "alarm,timeStamp,display,control,valueAlarm".
128  * @return The const shared pointer to the structure.
129  */
131  /**
132  * create an alarm structure
133  * @return The const shared pointer to the structure.
134  */
135  inline const StructureConstPtr& alarm() const { return alarmField; }
136  /**
137  * create a timeStamp structure
138  * @return The const shared pointer to the structure.
139  */
140  inline const StructureConstPtr& timeStamp() const { return timeStampField; }
141  /**
142  * create a display structure
143  * @return The const shared pointer to the structure.
144  */
145  inline const StructureConstPtr& display() const { return displayField; }
146  /**
147  * create a control structure
148  * @return The const shared pointer to the structure.
149  */
150  inline const StructureConstPtr& control() const { return controlField; }
151  /**
152  * create a boolean alarm structure
153  * @return The const shared pointer to the structure.
154  */
155  inline const StructureConstPtr& booleanAlarm() const { return booleanAlarmField; }
156  /**
157  * create a byte alarm structure
158  * @return The const shared pointer to the structure.
159  */
160  inline const StructureConstPtr& byteAlarm() const { return byteAlarmField; }
161  /**
162  * create a unsigned byte alarm structure
163  * @return The const shared pointer to the structure.
164  */
165  inline const StructureConstPtr& ubyteAlarm() const { return ubyteAlarmField; }
166  /**
167  * create a short alarm structure
168  * @return The const shared pointer to the structure.
169  */
170  inline const StructureConstPtr& shortAlarm() const { return shortAlarmField; }
171  /**
172  * create a unsigned short alarm structure
173  * @return The const shared pointer to the structure.
174  */
175  inline const StructureConstPtr& ushortAlarm() const { return ushortAlarmField; }
176  /**
177  * create an int alarm structure
178  * @return The const shared pointer to the structure.
179  */
180  inline const StructureConstPtr& intAlarm() const { return intAlarmField; }
181  /**
182  * create a unsigned int alarm structure
183  * @return The const shared pointer to the structure.
184  */
185  inline const StructureConstPtr& uintAlarm() const { return uintAlarmField; }
186  /**
187  * create a long alarm structure
188  * @return The const shared pointer to the structure.
189  */
190  inline const StructureConstPtr& longAlarm() const { return longAlarmField; }
191  /**
192  * create a unsigned long alarm structure
193  * @return The const shared pointer to the structure.
194  */
195  inline const StructureConstPtr& ulongAlarm() const { return ulongAlarmField; }
196  /**
197  * create a float alarm structure
198  * @return The const shared pointer to the structure.
199  */
200  inline const StructureConstPtr& floatAlarm() const { return floatAlarmField; }
201  /**
202  * create a double alarm structure
203  * @return The const shared pointer to the structure.
204  */
205  inline const StructureConstPtr& doubleAlarm() const { return doubleAlarmField; }
206  /**
207  * create an enumerated alarm structure
208  * @return The const shared pointer to the structure.
209  */
210  inline const StructureConstPtr& enumeratedAlarm() const { return enumeratedAlarmField; }
211 private:
212  StandardField();
216  const std::string notImplemented;
217  const std::string valueFieldName;
234 };
235 
236 FORCE_INLINE const StandardFieldPtr& getStandardField() {
237  return StandardField::getStandardField();
238 }
239 
240 }}
241 #endif /* STANDARDFIELD_H */
Standard Fields is a class or creating or sharing Field objects for standard fields.
Definition: standardField.h:63
#define FORCE_INLINE
Definition: templateMeta.h:20
epicsShareFunc bool yajl_parse_helper(std::istream &src, yajl_handle handle)