summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-11-06 22:15:07 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-11-06 22:15:07 +0200
commit7dd018ab42a055a5c3d3c3c3d64690a48a1feb80 (patch)
tree657785cc812ee9fe233b4f3077e15e9c9cc8b16f
parente398869b2b41e15fcc70e409f59233a0b3ea7189 (diff)
card: use vectors with get_xxxs() methods
-rw-r--r--libkms++/card.cpp35
-rw-r--r--libkms++/card.h11
2 files changed, 8 insertions, 38 deletions
diff --git a/libkms++/card.cpp b/libkms++/card.cpp
index 3aaa8a6..038d494 100644
--- a/libkms++/card.cpp
+++ b/libkms++/card.cpp
@@ -182,40 +182,7 @@ DrmObject* Card::get_object(uint32_t id) const
return m_obmap.at(id);
}
-vector<Connector*> Card::get_connectors() const
-{
- vector<Connector*> v;
- for(auto pair : m_obmap) {
- auto p = dynamic_cast<Connector*>(pair.second);
- if (p)
- v.push_back(p);
- }
- return v;
-}
-
-vector<Crtc*> Card::get_crtcs() const
-{
- vector<Crtc*> v;
- for(auto pair : m_obmap) {
- auto p = dynamic_cast<Crtc*>(pair.second);
- if (p)
- v.push_back(p);
- }
- return v;
-}
-
-vector<Plane*> Card::get_planes() const
-{
- vector<Plane*> v;
- for(auto pair : m_obmap) {
- auto p = dynamic_cast<Plane*>(pair.second);
- if (p)
- v.push_back(p);
- }
- return v;
-}
-
-vector<DrmObject*> Card::get_objects() const
+const vector<DrmObject*> Card::get_objects() const
{
vector<DrmObject*> v;
for(auto pair : m_obmap)
diff --git a/libkms++/card.h b/libkms++/card.h
index 25261be..cfc1cf2 100644
--- a/libkms++/card.h
+++ b/libkms++/card.h
@@ -37,10 +37,13 @@ public:
void print_short() const;
- std::vector<Connector*> get_connectors() const;
- std::vector<Crtc*> get_crtcs() const;
- std::vector<DrmObject*> get_objects() const;
- std::vector<Plane*> get_planes() const;
+ const std::vector<Connector*> get_connectors() const { return m_connectors; }
+ const std::vector<Encoder*> get_encoders() const { return m_encoders; }
+ const std::vector<Crtc*> get_crtcs() const { return m_crtcs; }
+ const std::vector<Plane*> get_planes() const { return m_planes; }
+ const std::vector<Property*> get_properties() const { return m_properties; }
+
+ const std::vector<DrmObject*> get_objects() const;
std::vector<Pipeline> get_connected_pipelines();