PulseView  0.3.0
A Qt-based sigrok GUI
decoder.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef PULSEVIEW_PV_DATA_DECODE_DECODER_HPP
22 #define PULSEVIEW_PV_DATA_DECODE_DECODER_HPP
23 
24 #include <map>
25 #include <memory>
26 #include <set>
27 
28 #include <glib.h>
29 
30 struct srd_decoder;
31 struct srd_decoder_inst;
32 struct srd_channel;
33 struct srd_session;
34 
35 namespace pv {
36 
37 namespace view {
38 class LogicSignal;
39 }
40 
41 namespace data {
42 
43 class Logic;
44 
45 namespace decode {
46 
47 class Decoder
48 {
49 public:
50  Decoder(const srd_decoder *const decoder);
51 
52  virtual ~Decoder();
53 
54  const srd_decoder* decoder() const;
55 
56  bool shown() const;
57  void show(bool show = true);
58 
59  const std::map<const srd_channel*,
60  std::shared_ptr<view::LogicSignal> >& channels() const;
61  void set_channels(std::map<const srd_channel*,
62  std::shared_ptr<view::LogicSignal> > channels);
63 
64  const std::map<std::string, GVariant*>& options() const;
65 
66  void set_option(const char *id, GVariant *value);
67 
68  bool have_required_channels() const;
69 
70  srd_decoder_inst* create_decoder_inst(
71  srd_session *session) const;
72 
73  std::set< std::shared_ptr<pv::data::Logic> > get_data();
74 
75 private:
76  const srd_decoder *const decoder_;
77 
78  bool shown_;
79 
80  std::map<const srd_channel*, std::shared_ptr<pv::view::LogicSignal> >
82  std::map<std::string, GVariant*> options_;
83 };
84 
85 } // namespace decode
86 } // namespace data
87 } // namespace pv
88 
89 #endif // PULSEVIEW_PV_DATA_DECODE_DECODER_HPP
std::map< const srd_channel *, std::shared_ptr< pv::view::LogicSignal > > channels_
Definition: decoder.hpp:81
const srd_decoder *const decoder_
Definition: decoder.hpp:76
void set_channels(std::map< const srd_channel *, std::shared_ptr< view::LogicSignal > > channels)
Definition: decoder.cpp:72
std::map< std::string, GVariant * > options_
Definition: decoder.hpp:82
const srd_decoder * decoder() const
Definition: decoder.cpp:51
const std::map< const srd_channel *, std::shared_ptr< view::LogicSignal > > & channels() const
Definition: decoder.cpp:67
Decoder(const srd_decoder *const decoder)
Definition: decoder.cpp:39
bool shown() const
Definition: decoder.cpp:56
void set_option(const char *id, GVariant *value)
Definition: decoder.cpp:83
bool have_required_channels() const
Definition: decoder.cpp:90
std::set< std::shared_ptr< pv::data::Logic > > get_data()
Definition: decoder.cpp:102
const std::map< std::string, GVariant * > & options() const
Definition: decoder.cpp:78
srd_decoder_inst * create_decoder_inst(srd_session *session) const
Definition: decoder.cpp:114
void show(bool show=true)
Definition: decoder.cpp:61