DLS  1.6
Channel.h
1 /*****************************************************************************
2  *
3  * This file is part of the Data Logging Service (DLS).
4  *
5  * DLS is free software: you can redistribute it and/or modify it under the
6  * terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version.
9  *
10  * DLS is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with DLS. If not, see <http://www.gnu.org/licenses/>.
17  *
18  ****************************************************************************/
19 
20 #ifndef LibDLSChannelH
21 #define LibDLSChannelH
22 
23 /****************************************************************************/
24 
25 
26 #include "Exception.h"
27 #include "Time.h"
28 
29 #include "Chunk.h"
30 #include "globals.h"
31 
32 #include <string>
33 #include <map>
34 #include <utility> // pair
35 #include <set>
36 #include <memory>
37 
38 /****************************************************************************/
39 
40 namespace DlsProto {
41  class ChannelInfo;
42 }
43 
44 namespace LibDLS {
45 
46 /****************************************************************************/
47 
48 class Job;
49 
50 /****************************************************************************/
51 
57  public Exception
58 {
59  public:
60  ChannelException(const std::string &pmsg):
61  Exception(pmsg) {};
62 };
63 
64 /****************************************************************************/
65 
66 
72 {
73 public:
74  Channel(Job *);
75  Channel(Job *, const DlsProto::ChannelInfo &);
76  Channel(const Channel &);
77  ~Channel();
78 
79  Job *getJob() const;
80 
81  void import(const std::string &, unsigned int);
82  std::pair<std::set<Chunk *>, std::set<int64_t> > fetch_chunks();
83  void fetch_data(Time, Time, unsigned int,
84  DataCallback, void *, unsigned int = 1);
85 
86  std::string path() const;
87  unsigned int dir_index() const;
88 
89  const std::string &name() const;
90  const std::string &unit() const;
91  std::string alias() const;
92  double scale() const;
93  double offset() const;
94  std::string color() const;
95  ChannelType type() const;
96 
97  typedef std::map<int64_t, Chunk> ChunkMap;
98  const ChunkMap &chunks() const;
99  bool has_same_chunks_as(const Channel &) const;
100 
101  Time start() const;
102  Time end() const;
103 
104  bool operator<(const Channel &other) const;
105 
106  void set_channel_info(DlsProto::ChannelInfo *) const;
107  void set_chunk_info(DlsProto::ChannelInfo *) const;
108 
109  void update_index();
110 
111 private:
112  struct Impl;
113  std::unique_ptr<Impl> impl;
114 
115  Channel();
116 };
117 
118 } // namespace
119 
120 /****************************************************************************/
121 
122 #endif
Base class for all LibDLS exceptions.
Definition: Exception.h:36
Darstellung eines Kanals in der Anzeige.
Definition: Channel.h:71
Global data structures and functions.
Measuring job.
Definition: Job.h:63
Definition: Channel.h:44
Datentyp zur Speicherung der Zeit in Mikrosekunden.
Definition: Time.h:46
Channel exception.
Definition: Channel.h:56
DLS_PUBLIC bool operator<(const RealChannel &a, const RealChannel &b)
Less operator for sorting RealChannel lists.
#define DLS_PUBLIC
Macro for public method definitions (empty on non-win32).
Definition: globals.h:57
ChannelType
Basic DLS channel datatype.
Definition: globals.h:73