projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unify get_samples() semantics for AnalogSegment and LogicSegment
[pulseview.git]
/
pv
/
data
/
analog.cpp
diff --git
a/pv/data/analog.cpp
b/pv/data/analog.cpp
index 8245186b97ab21af6b89d8d9f54e4137bbd519a6..217cdfd742b3e4c84557f87178aee195ba82d5f4 100644
(file)
--- a/
pv/data/analog.cpp
+++ b/
pv/data/analog.cpp
@@
-14,33
+14,56
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
*/
-#include "analog.h"
-#include "analogsnapshot.h"
+#include <cassert>
-using namespace boost;
-using namespace std;
+#include "analog.hpp"
+#include "analogsegment.hpp"
+
+using std::deque;
+using std::max;
+using std::shared_ptr;
+using std::vector;
namespace pv {
namespace data {
namespace pv {
namespace data {
-Analog::Analog(const sr_datafeed_meta_analog&,
- uint64_t samplerate) :
- SignalData(samplerate)
+Analog::Analog() :
+ SignalData()
+{
+}
+
+void Analog::push_segment(shared_ptr<AnalogSegment> &segment)
+{
+ segments_.push_front(segment);
+}
+
+const deque< shared_ptr<AnalogSegment> >& Analog::analog_segments() const
+{
+ return segments_;
+}
+
+vector< shared_ptr<Segment> > Analog::segments() const
{
{
+ return vector< shared_ptr<Segment> >(
+ segments_.begin(), segments_.end());
}
}
-void Analog::
push_snapshot(shared_ptr<AnalogSnapshot> &snapshot
)
+void Analog::
clear(
)
{
{
-
_snapshots.push_front(snapshot
);
+
segments_.clear(
);
}
}
-deque< shared_ptr<AnalogSnapshot> >& Analog::get_snapshots()
+uint64_t Analog::max_sample_count() const
{
{
- return _snapshots;
+ uint64_t l = 0;
+ for (const std::shared_ptr<AnalogSegment> s : segments_) {
+ assert(s);
+ l = max(l, s->get_sample_count());
+ }
+ return l;
}
} // namespace data
}
} // namespace data