This is Unofficial EPICS BASE Doxygen Site
nturi.h
Go to the documentation of this file.
1 /* nturi.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 #ifndef NTURI_H
7 #define NTURI_H
8 
9 #include <vector>
10 #include <string>
11 
12 #ifdef epicsExportSharedSymbols
13 # define nturiEpicsExportSharedSymbols
14 # undef epicsExportSharedSymbols
15 #endif
16 
17 #ifdef nturiEpicsExportSharedSymbols
18 # define epicsExportSharedSymbols
19 # undef nturiEpicsExportSharedSymbols
20 #endif
21 
22 #include <pv/ntfield.h>
23 
24 #include <shareLib.h>
25 
26 namespace epics { namespace nt {
27 
28 class NTURI;
29 typedef std::tr1::shared_ptr<NTURI> NTURIPtr;
30 
31 namespace detail {
32 
41  public std::tr1::enable_shared_from_this<NTURIBuilder>
42  {
43  public:
45 
50  shared_pointer addAuthority();
51 
58  shared_pointer addQueryString(std::string const & name);
59 
66  shared_pointer addQueryDouble(std::string const & name);
67 
74  shared_pointer addQueryInt(std::string const & name);
75 
81  epics::pvData::StructureConstPtr createStructure();
82 
89  epics::pvData::PVStructurePtr createPVStructure();
90 
98  NTURIPtr create();
99 
106  shared_pointer add(std::string const & name, epics::pvData::FieldConstPtr const & field);
107 
108  private:
109  NTURIBuilder();
110 
111  void reset();
112 
113  std::vector<std::string> queryFieldNames;
114  std::vector<epics::pvData::ScalarType> queryTypes;
115 
116  bool authority;
117 
118  // NOTE: this preserves order, however it does not handle duplicates
119  epics::pvData::StringArray extraFieldNames;
121 
122  friend class ::epics::nt::NTURI;
123  };
124 
125 }
126 
127 typedef std::tr1::shared_ptr<detail::NTURIBuilder> NTURIBuilderPtr;
128 
129 
130 
137 {
138 public:
140 
141  static const std::string URI;
142 
154  static shared_pointer wrap(epics::pvData::PVStructurePtr const & pvStructure);
155 
165  static shared_pointer wrapUnsafe(epics::pvData::PVStructurePtr const & pvStructure);
166 
178  static bool is_a(epics::pvData::StructureConstPtr const & structure);
179 
191  static bool is_a(epics::pvData::PVStructurePtr const & pvStructure);
192 
202  static bool isCompatible(
204 
214  static bool isCompatible(
215  epics::pvData::PVStructurePtr const &pvStructure);
216 
225  bool isValid();
226 
231  static NTURIBuilderPtr createBuilder();
232 
236  ~NTURI() {}
237 
242  epics::pvData::PVStructurePtr getPVStructure() const;
243 
248  epics::pvData::PVStringPtr getScheme() const;
249 
254  epics::pvData::PVStringPtr getAuthority() const;
255 
260  epics::pvData::PVStringPtr getPath() const;
261 
266  epics::pvData::PVStructurePtr getQuery() const;
267 
274  epics::pvData::StringArray const & getQueryNames() const;
275 
281  epics::pvData::PVFieldPtr getQueryField(std::string const & name) const;
282 
292  template<typename PVT>
293  std::tr1::shared_ptr<PVT> getQueryField(std::string const & name) const
294  {
295  epics::pvData::PVFieldPtr pvField = getQueryField(name);
296  if (pvField.get())
297  return std::tr1::dynamic_pointer_cast<PVT>(pvField);
298  else
299  return std::tr1::shared_ptr<PVT>();
300  }
301 
302 private:
303  NTURI(epics::pvData::PVStructurePtr const & pvStructure);
305  friend class detail::NTURIBuilder;
306 };
307 
308 }}
309 #endif /* NTURI_H */
Convenience Class for NTURI.
Definition: nturi.h:136
static const std::string URI
Definition: nturi.h:141
TODO only here because of the Lockable.
Definition: ntaggregate.cpp:16
std::tr1::shared_ptr< PVT > getQueryField(std::string const &name) const
Definition: nturi.h:293
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
Mark external symbols and entry points for shared libraries.
Interface for in-line creating of NTURI.
Definition: nturi.h:40
std::tr1::shared_ptr< NTURI > NTURIPtr
Definition: nturi.h:28
#define POINTER_DEFINITIONS(clazz)
Definition: sharedPtr.h:198
#define epicsShareClass
Definition: shareLib.h:206
std::vector< FieldConstPtr > FieldConstPtrArray
Definition: pvIntrospect.h:146
std::tr1::shared_ptr< const Field > FieldConstPtr
Definition: pvIntrospect.h:137
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
std::tr1::shared_ptr< PVString > PVStringPtr
Definition: pvData.h:540
std::vector< std::string > StringArray
Definition: pvType.h:110
std::tr1::shared_ptr< PVField > PVFieldPtr
Definition: pvData.h:66
std::tr1::shared_ptr< detail::NTURIBuilder > NTURIBuilderPtr
Definition: nturi.h:127