]> sigrok.org Git - pulseview.git/commitdiff
Allow more than 256 binary output classes
authorSoeren Apel <redacted>
Thu, 12 Dec 2019 20:31:34 +0000 (21:31 +0100)
committerSoeren Apel <redacted>
Thu, 12 Dec 2019 20:31:34 +0000 (21:31 +0100)
pv/data/decode/decoder.cpp
pv/data/decode/decoder.hpp
pv/data/decodesignal.cpp
pv/data/decodesignal.hpp
pv/views/decoder_output/view.cpp
pv/views/decoder_output/view.hpp

index 8e7ffb50072b14577c0adce5ef4013d998eb18bd..14d298d24fd41b4835a9d0f9dc8ddc0222949805 100644 (file)
@@ -42,7 +42,7 @@ Decoder::Decoder(const srd_decoder *const dec) :
        decoder_inst_(nullptr)
 {
        // Query the decoder outputs
-       uint8_t i = 0;
+       uint32_t i = 0;
        for (GSList *l = dec->binary; l; l = l->next) {
                char **bin_class = (char**)l->data;
                char *name = bin_class[0];
@@ -184,12 +184,12 @@ void Decoder::invalidate_decoder_inst()
        decoder_inst_ = nullptr;
 }
 
-uint8_t Decoder::get_binary_class_count() const
+uint32_t Decoder::get_binary_class_count() const
 {
        return bin_classes_.size();
 }
 
-const DecodeBinaryClassInfo* Decoder::get_binary_class(uint8_t id) const
+const DecodeBinaryClassInfo* Decoder::get_binary_class(uint32_t id) const
 {
        return &(bin_classes_.at(id));
 }
index 2a7ef11ea14365fe8947e41154d493a3d46d9425..bc1673c97e032cc59ab900cd35cd1a926de7ad6a 100644 (file)
@@ -63,7 +63,7 @@ struct DecodeChannel
 
 struct DecodeBinaryClassInfo
 {
-       uint8_t bin_class_id;
+       uint32_t bin_class_id;
        char* name;
        char* description;
 };
@@ -97,8 +97,8 @@ public:
        srd_decoder_inst* create_decoder_inst(srd_session *session);
        void invalidate_decoder_inst();
 
-       uint8_t get_binary_class_count() const;
-       const DecodeBinaryClassInfo* get_binary_class(uint8_t id) const;
+       uint32_t get_binary_class_count() const;
+       const DecodeBinaryClassInfo* get_binary_class(uint32_t id) const;
 
 private:
        const srd_decoder *const decoder_;
index 9fddfdf96ac1d0a653ae6e4282cb54fbf114eb24..ad5a27a9f254f6c041dcd2d75e8eda252382dbf3 100644 (file)
@@ -535,7 +535,7 @@ void DecodeSignal::get_annotation_subset(
 }
 
 uint32_t DecodeSignal::get_binary_data_chunk_count(uint32_t segment_id,
-       const Decoder* dec, uint8_t bin_class_id) const
+       const Decoder* dec, uint32_t bin_class_id) const
 {
        try {
                const DecodeSegment *segment = &(segments_.at(segment_id));
@@ -551,7 +551,7 @@ uint32_t DecodeSignal::get_binary_data_chunk_count(uint32_t segment_id,
 }
 
 void DecodeSignal::get_binary_data_chunk(uint32_t segment_id,
-       const  Decoder* dec, uint8_t bin_class_id, uint32_t chunk_id,
+       const  Decoder* dec, uint32_t bin_class_id, uint32_t chunk_id,
        const vector<uint8_t> **dest, uint64_t *size)
 {
        try {
@@ -569,7 +569,7 @@ void DecodeSignal::get_binary_data_chunk(uint32_t segment_id,
 }
 
 void DecodeSignal::get_binary_data_chunks_merged(uint32_t segment_id,
-       const Decoder* dec, uint8_t bin_class_id, uint64_t start_sample,
+       const Decoder* dec, uint32_t bin_class_id, uint64_t start_sample,
        uint64_t end_sample, vector<uint8_t> *dest) const
 {
        assert(dest != nullptr);
@@ -610,7 +610,7 @@ void DecodeSignal::get_binary_data_chunks_merged(uint32_t segment_id,
 }
 
 const DecodeBinaryClass* DecodeSignal::get_binary_data_class(uint32_t segment_id,
-       const data::decode::Decoder* dec, uint8_t bin_class_id) const
+       const data::decode::Decoder* dec, uint32_t bin_class_id) const
 {
        try {
                const DecodeSegment *segment = &(segments_.at(segment_id));
@@ -1347,9 +1347,9 @@ void DecodeSignal::create_decode_segment()
 
        // Prepare our binary output classes
        for (const shared_ptr<decode::Decoder>& dec : stack_) {
-               uint8_t n = dec->get_binary_class_count();
+               uint32_t n = dec->get_binary_class_count();
 
-               for (uint8_t i = 0; i < n; i++)
+               for (uint32_t i = 0; i < n; i++)
                        segments_.back().binary_classes.push_back(
                                {dec.get(), dec->get_binary_class(i), vector<DecodeBinaryDataChunk>()});
        }
index 5755c80e11aa0dde925b50b5713457e08142d3fa..1fe696ebe329003397a731bc1725598f94a187a2 100644 (file)
@@ -159,15 +159,15 @@ public:
                uint32_t segment_id, uint64_t start_sample, uint64_t end_sample) const;
 
        uint32_t get_binary_data_chunk_count(uint32_t segment_id,
-               const data::decode::Decoder* dec, uint8_t bin_class_id) const;
+               const data::decode::Decoder* dec, uint32_t bin_class_id) const;
        void get_binary_data_chunk(uint32_t segment_id, const data::decode::Decoder* dec,
-               uint8_t bin_class_id, uint32_t chunk_id, const vector<uint8_t> **dest,
+               uint32_t bin_class_id, uint32_t chunk_id, const vector<uint8_t> **dest,
                uint64_t *size);
        void get_binary_data_chunks_merged(uint32_t segment_id, const data::decode::Decoder* dec,
-               uint8_t bin_class_id, uint64_t start_sample, uint64_t end_sample,
+               uint32_t bin_class_id, uint64_t start_sample, uint64_t end_sample,
                vector<uint8_t> *dest) const;
        const DecodeBinaryClass* get_binary_data_class(uint32_t segment_id,
-               const data::decode::Decoder* dec, uint8_t bin_class_id) const;
+               const data::decode::Decoder* dec, uint32_t bin_class_id) const;
 
        virtual void save_settings(QSettings &settings) const;
 
index 8bce3745f1aa3e83ef932f3c05f5f45a6910e817..d8bbb03a0cbf8fb6fda68252bae79852bbc0f4f0 100644 (file)
@@ -223,8 +223,8 @@ void View::on_selected_decoder_changed(int index)
 
        if (signal_) {
                // Populate binary class selector
-               uint8_t bin_classes = decoder_->get_binary_class_count();
-               for (uint8_t i = 0; i < bin_classes; i++) {
+               uint32_t bin_classes = decoder_->get_binary_class_count();
+               for (uint32_t i = 0; i < bin_classes; i++) {
                        const data::decode::DecodeBinaryClassInfo* class_info = decoder_->get_binary_class(i);
                        class_selector_->addItem(class_info->name, QVariant::fromValue(i));
                }
@@ -238,7 +238,7 @@ void View::on_selected_decoder_changed(int index)
 
 void View::on_selected_class_changed(int index)
 {
-       bin_class_id_ = class_selector_->itemData(index).value<uint8_t>();
+       bin_class_id_ = class_selector_->itemData(index).value<uint32_t>();
 
        update_data();
 }
index 58aec954f24a855c7a49b1657b44a2d9c66be0ce..23023efbe633d55bf3b326abcfc2af86a0f958d3 100644 (file)
@@ -81,7 +81,7 @@ private:
 
        data::DecodeSignal *signal_;
        const data::decode::Decoder *decoder_;
-       uint8_t bin_class_id_;
+       uint32_t bin_class_id_;
 };
 
 } // namespace decoder_output