2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 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/>.
21 #include <libsigrokdecode/libsigrokdecode.h>
27 #include <pv/data/decode/annotation.hpp>
28 #include <pv/data/decode/decoder.hpp>
29 #include "pv/data/decode/rowdata.hpp"
37 Annotation::Annotation(uint64_t start_sample, uint64_t end_sample,
38 const vector<QString>* texts, Class ann_class_id, const RowData *data) :
39 start_sample_(start_sample),
40 end_sample_(end_sample),
42 ann_class_id_(ann_class_id),
47 Annotation::Annotation(Annotation&& a) :
48 start_sample_(a.start_sample_),
49 end_sample_(a.end_sample_),
51 ann_class_id_(a.ann_class_id_),
56 Annotation& Annotation::operator=(Annotation&& a)
59 start_sample_ = a.start_sample_;
60 end_sample_ = a.end_sample_;
62 ann_class_id_ = a.ann_class_id_;
69 const Row* Annotation::row() const
74 uint64_t Annotation::start_sample() const
79 uint64_t Annotation::end_sample() const
84 Annotation::Class Annotation::ann_class_id() const
89 const QString Annotation::ann_class_name() const
91 const AnnotationClass* ann_class =
92 data_->row()->decoder()->get_ann_class_by_id(ann_class_id_);
94 return QString(ann_class->name);
97 const vector<QString>* Annotation::annotations() const
102 const QString Annotation::longest_annotation() const
104 return texts_->front();
107 const QColor Annotation::color() const
109 return data_->row()->get_class_color(ann_class_id_);
112 const QColor Annotation::bright_color() const
114 return data_->row()->get_bright_class_color(ann_class_id_);
117 const QColor Annotation::dark_color() const
119 return data_->row()->get_dark_class_color(ann_class_id_);
122 bool Annotation::operator<(const Annotation &other) const
124 return (start_sample_ < other.start_sample_);
127 } // namespace decode