2 * This file is part of the PulseView project.
4 * Copyright (C) 2013 Joel Holdsworth <joel@airwebreathe.org.uk>
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.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef PULSEVIEW_PV_DATA_DECODE_DECODER_HPP
21 #define PULSEVIEW_PV_DATA_DECODE_DECODER_HPP
30 #include <pv/data/signalbase.hpp>
31 #include <pv/data/decode/row.hpp>
38 struct srd_decoder_inst;
53 struct AnnotationClass
64 uint16_t id; ///< Global numerical ID for the decode channels in the stack
65 uint16_t bit_id; ///< Tells which bit within a sample represents this channel
66 const bool is_optional;
67 const pv::data::SignalBase *assigned_signal;
68 const QString name, desc;
69 int initial_pin_state;
70 const shared_ptr<Decoder> decoder_;
71 const srd_channel *pdch_;
74 struct DecodeBinaryClassInfo
76 uint32_t bin_class_id;
85 Decoder(const srd_decoder *const dec);
89 const srd_decoder* get_srd_decoder() const;
91 const char* name() const;
94 void set_visible(bool visible);
96 const vector<DecodeChannel*>& channels() const;
97 void set_channels(vector<DecodeChannel*> channels);
99 const map<string, GVariant*>& options() const;
101 void set_option(const char *id, GVariant *value);
103 void apply_all_options();
105 bool have_required_channels() const;
107 srd_decoder_inst* create_decoder_inst(srd_session *session);
108 void invalidate_decoder_inst();
110 vector<Row*> get_rows();
111 Row* get_row_by_id(size_t id);
113 vector<const AnnotationClass*> ann_classes() const;
114 vector<AnnotationClass*> ann_classes();
115 AnnotationClass* get_ann_class_by_id(size_t id);
117 uint32_t get_binary_class_count() const;
118 const DecodeBinaryClassInfo* get_binary_class(uint32_t id) const;
121 const srd_decoder* const srd_decoder_;
125 vector<DecodeChannel*> channels_;
127 vector<AnnotationClass> ann_classes_;
128 vector<DecodeBinaryClassInfo> bin_classes_;
129 map<string, GVariant*> options_;
130 srd_decoder_inst *decoder_inst_;
133 } // namespace decode
137 #endif // PULSEVIEW_PV_DATA_DECODE_DECODER_HPP