40 #include "PropertyHandles.hh" 41 #include "BaseProperty.hh" 42 #include "OpenVolumeMeshHandle.hh" 43 #include "../System/MemoryInclude.hh" 44 #include "../System/Deprecation.hh" 48 class ResourceManager;
58 template <
class PropT,
typename Entity>
59 class PropertyPtr :
protected ptr::shared_ptr<PropT>,
public BaseProperty {
62 friend class ResourceManager;
64 typedef typename PropT::value_type value_type;
65 typedef typename PropT::vector_type::const_iterator const_iterator;
66 typedef typename PropT::vector_type::iterator iterator;
67 typedef typename PropT::reference reference;
68 typedef typename PropT::const_reference const_reference;
70 using EntityHandleT = HandleT<Entity>;
85 using ptr::shared_ptr<PropT>::operator*;
86 using ptr::shared_ptr<PropT>::operator->;
87 using ptr::shared_ptr<PropT>::operator bool;
89 const std::string& name()
const override;
91 void delete_element(
size_t _idx)
override;
93 void swap_elements(
size_t _idx0,
size_t _idx1)
override;
95 void copy(
size_t _src_idx,
size_t _dst_idx)
override;
97 const_iterator begin()
const {
return ptr::shared_ptr<PropT>::get()->begin(); }
98 iterator begin() {
return ptr::shared_ptr<PropT>::get()->begin(); }
99 size_t size()
const override {
return ptr::shared_ptr<PropT>::get()->size(); }
101 const_iterator end()
const {
return ptr::shared_ptr<PropT>::get()->end(); }
102 iterator end() {
return ptr::shared_ptr<PropT>::get()->end(); }
104 #if OVM_ENABLE_DEPRECATED_APIS 105 OVM_DEPRECATED(
"use handles to index properties")
106 reference operator[](
size_t _idx) {
return (*ptr::shared_ptr<PropT>::get())[_idx]; }
107 OVM_DEPRECATED(
"use handles to index properties")
108 const_reference operator[](
size_t _idx)
const {
return (*ptr::shared_ptr<PropT>::get())[_idx]; }
111 reference operator[](
const EntityHandleT& _h) {
return (*ptr::shared_ptr<PropT>::get())[_h.
uidx()]; }
112 const_reference operator[](
const EntityHandleT& _h)
const {
return (*ptr::shared_ptr<PropT>::get())[_h.
uidx()]; }
114 void serialize(std::ostream& _ostr)
const override { ptr::shared_ptr<PropT>::get()->serialize(_ostr); }
115 void deserialize(std::istream& _istr)
override { ptr::shared_ptr<PropT>::get()->deserialize(_istr); }
119 bool persistent()
const override {
return ptr::shared_ptr<PropT>::get()->persistent(); }
121 bool anonymous()
const override {
return ptr::shared_ptr<PropT>::get()->name().empty(); }
124 const std::string &internal_type_name()
const override {
return ptr::shared_ptr<PropT>::get()->internal_type_name(); }
129 void delete_multiple_entries(
const std::vector<bool>& _tags)
override;
131 void resize(
size_t _size)
override;
138 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYPTRT_CC) 139 #include "PropertyPtrT_impl.hh" PropertyPtr()
Constructor.
~PropertyPtr() override
Destructor.
size_t uidx() const
return unsigned idx - handle must be valid
void assign_values_from(const BaseProperty *other) override
void move_values_from(BaseProperty *other) override