1 #pragma once 2 3 #include <map> 4 #include <memory> 5 6 #include "drmobject.h" 7 #include "decls.h" 8 9 namespace kms 10 { 11 class DrmPropObject : public DrmObject 12 { 13 friend class Card; 14 15 public: 16 void refresh_props(); 17 has_prop(const std::string & name)18 bool has_prop(const std::string& name) const { return !!get_prop(name); } 19 20 Property* get_prop(const std::string& name) const; 21 22 uint64_t get_prop_value(uint32_t id) const; 23 uint64_t get_prop_value(const std::string& name) const; 24 std::unique_ptr<Blob> get_prop_value_as_blob(const std::string& name) const; 25 get_prop_map()26 const std::map<uint32_t, uint64_t>& get_prop_map() const { return m_prop_values; } 27 28 int set_prop_value(Property* prop, uint64_t value); 29 int set_prop_value(uint32_t id, uint64_t value); 30 int set_prop_value(const std::string& name, uint64_t value); 31 32 protected: 33 DrmPropObject(Card& card, uint32_t object_type); 34 DrmPropObject(Card& card, uint32_t id, uint32_t object_type, uint32_t idx = 0); 35 36 ~DrmPropObject() override; 37 38 private: 39 std::map<uint32_t, uint64_t> m_prop_values; 40 }; 41 } // namespace kms 42