]> sigrok.org Git - pulseview.git/blobdiff - pv/view/rowitemowner.cpp
ViewItemPaintParams: Added missing include
[pulseview.git] / pv / view / rowitemowner.cpp
index 6f7cbb269663ecb36e9c61dec225051c945a8aea..49e6e1a59afca5b796252f44c26e93b90450b2c1 100644 (file)
 
 #include <cassert>
 
-#include "rowitem.h"
-#include "rowitemowner.h"
+#include "rowitem.hpp"
+#include "rowitemowner.hpp"
+#include "trace.hpp"
 
+using std::dynamic_pointer_cast;
 using std::max;
 using std::make_pair;
 using std::min;
 using std::pair;
+using std::set;
 using std::shared_ptr;
 using std::vector;
 
@@ -92,9 +95,33 @@ RowItemOwner::const_iterator RowItemOwner::end() const
        return const_iterator(this);
 }
 
+set< RowItemOwner* > RowItemOwner::list_row_item_owners()
+{
+       set< RowItemOwner* > owners;
+       for (const auto &r : *this)
+               owners.insert(r->owner());
+       return owners;
+}
+
+template<class T>
+set< shared_ptr<T> > RowItemOwner::list_by_type()
+{
+       set< shared_ptr<T> > items;
+       for (const auto &r : *this) {
+               shared_ptr<T> p = dynamic_pointer_cast<T>(r);
+               if (p)
+                       items.insert(p);
+       }
+
+       return items;
+}
+
+template set< shared_ptr<Trace> > RowItemOwner::list_by_type();
+
 pair<int, int> RowItemOwner::v_extents() const
 {
-       pair<int, int> extents(0, 0);
+       pair<int, int> extents(INT_MAX, INT_MIN);
+
        for (const shared_ptr<RowItem> r : child_items()) {
                assert(r);
                if (!r->enabled())