EPICS ARCHIVER V4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
ArchiveCommand.h
1 #ifndef EA4_PVRPC_ARCHIVE_COMMAND_H
2 #define EA4_PVRPC_ARCHIVE_COMMAND_H
3 
4 // epics 3
5 #include <epicsTime.h>
6 
7 // epics 4
8 #include "pv/pvData.h"
9 
10 #include "storage/CtrlInfo.h"
11 #include "storage/RawValue.h"
12 #include "storage/RPCServerConfig.h"
13 
14 namespace ea4 { namespace pvrpc {
15 
18 
19  public:
20 
22  static const int HOW_RAW = 0;
23 
25  static const int HOW_SHEET = 1;
26 
28  static const int HOW_OLD_AVERAGE = 2;
29 
31  static const int HOW_PLOTBIN = 3;
32 
34  static const int HOW_LINEAR = 4;
35 
37  static const int HOW_AVERAGE = 5;
38 
40  static const int META_TYPE_ENUM = 0;
41 
43  static const int META_TYPE_NUMERIC = 1;
44 
45  // XML-RPC does not define fault codes.
46  // The xml-rpc-c library uses -500, -501, ... (up to -510)
47 
49  static const int ARCH_DAT_SERV_FAULT = -600;
50 
52  static const int ARCH_DAT_NO_INDEX = -601;
53 
55  static const int ARCH_DAT_ARG_ERROR = -602;
56 
58  static const int ARCH_DAT_DATA_ERROR = -603;
59 
60  public:
61 
63  virtual const char* getName() const = 0;
64 
66  virtual epics::pvData::PVStructurePtr createRequest() = 0;
67 
69  virtual epics::pvData::PVStructurePtr
70  process(epics::pvData::PVStructurePtr const & request) = 0;
71 
72  protected:
73 
74  epics::pvData::StructureConstPtr createMetaType(const CtrlInfo* info);
75 
76  void setMeta(epics::pvData::PVStructurePtr& meta,
77  const CtrlInfo* info);
78 
79  protected:
80 
81  Index* createIndex(int key);
82 
83  epics::pvData::StructureConstPtr
84  createDbrTimeValueType(epics::pvData::ScalarType pv_type);
85 
86  protected:
87 
88  void dbr_type_to_pv_type(DbrType dbr_type,
89  DbrCount dbr_count,
90  epics::pvData::ScalarType& pv_type,
91  int& pv_count);
92 
93  void encode_value(DbrType dbr_type,
94  DbrCount dbr_count,
95  const epicsTime& time,
96  const RawValue::Data* data,
97  epics::pvData::ScalarType pv_type,
98  int pv_count,
99  epics::pvData::PVStructurePtr& values,
100  bool with_min_max = false,
101  double minimum = 0.0,
102  double maximum = 0.0);
103 
104  public:
105 
106  void epicsTime2pieces(const epicsTime& t,
107  int& secs,
108  int& nano);
109 
110  void pieces2epicsTime(int secs,
111  int nano,
112  epicsTime& t);
113 
114 };
115 
116 }}
117 
118 
119 #endif
virtual const char * getName() const =0
Returns the command name.
unsigned short DbrType
DbrType is used to hold dbr_time_xxx types.
Definition: RawValue.h:24
static const int ARCH_DAT_DATA_ERROR
&#39;data error&#39; fault code
Definition: ArchiveCommand.h:58
Meta-information for values: Units, limits, etc .
Definition: CtrlInfo.h:75
static const int HOW_OLD_AVERAGE
Averaged spreadsheet, delta = (end-start)/count.
Definition: ArchiveCommand.h:28
Basic class of the RPC commands.
Definition: ArchiveCommand.h:17
static const int HOW_AVERAGE
Averaged spreadsheet, delta = count.
Definition: ArchiveCommand.h:37
static const int HOW_SHEET
Raw data in &#39;filled&#39; spreadsheet.
Definition: ArchiveCommand.h:25
unsigned short DbrCount
DbrCount is used to hold the array size of CA channels.
Definition: RawValue.h:27
virtual epics::pvData::PVStructurePtr process(epics::pvData::PVStructurePtr const &request)=0
Processes the request.
static const int ARCH_DAT_SERV_FAULT
&#39;serv&#39; fault code
Definition: ArchiveCommand.h:49
static const int META_TYPE_ENUM
Meta type for the enum values.
Definition: ArchiveCommand.h:40
virtual epics::pvData::PVStructurePtr createRequest()=0
Creates the request structure of this command.
static const int HOW_RAW
Raw data, channel by channel.
Definition: ArchiveCommand.h:22
static const int ARCH_DAT_NO_INDEX
&#39;no index&#39; fault code
Definition: ArchiveCommand.h:52
static const int HOW_PLOTBIN
Plot-binned, channel by channel, &#39;count&#39; bins.
Definition: ArchiveCommand.h:31
Base interface for the archiver&#39;s indices.
Definition: Index.h:16
static const int META_TYPE_NUMERIC
Meta type for the numeric values.
Definition: ArchiveCommand.h:43
static const int ARCH_DAT_ARG_ERROR
&#39;arg error&#39; fault code
Definition: ArchiveCommand.h:55
dbr_time_double Data
Type for accessing the raw data and its common fields.
Definition: RawValue.h:55
static const int HOW_LINEAR
Linear interpolation spreadsheet, delta = (end-start)/count.
Definition: ArchiveCommand.h:34