card: use vectors with get_xxxs() methods
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 6 Nov 2015 20:15:07 +0000 (22:15 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 6 Nov 2015 20:15:07 +0000 (22:15 +0200)
libkms++/card.cpp
libkms++/card.h

index 3aaa8a6ee0ac691c884b9e3c11d842251fc9bcd3..038d494ee7d7c653e124c6d11530a920ec66f9d9 100644 (file)
@@ -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)
index 25261be4e73520ad69b5ed2aa73edaecc7775734..cfc1cf20b9c06c148b46583b9cca9c9cf394b6cf 100644 (file)
@@ -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();