40 #include "BaseProperty.hh" 41 #include "OpenVolumeMeshHandle.hh" 42 #include "../System/MemoryInclude.hh" 43 #include "../System/Deprecation.hh" 47 class ResourceManager;
57 template <
class PropT,
class HandleT>
58 class PropertyPtr :
protected ptr::shared_ptr<PropT>,
public BaseProperty {
61 friend class ResourceManager;
63 typedef typename PropT::value_type value_type;
64 typedef typename PropT::vector_type::const_iterator const_iterator;
65 typedef typename PropT::vector_type::iterator iterator;
66 typedef typename PropT::reference reference;
67 typedef typename PropT::const_reference const_reference;
72 PropertyPtr(PropT* _ptr, ResourceManager& _resMan, HandleT _handle);
77 using ptr::shared_ptr<PropT>::operator*;
78 using ptr::shared_ptr<PropT>::operator->;
79 using ptr::shared_ptr<PropT>::operator bool;
81 virtual const std::string& name()
const;
83 virtual void delete_element(
size_t _idx);
85 virtual void swap_elements(
size_t _idx0,
size_t _idx1);
87 virtual void copy(
size_t _src_idx,
size_t _dst_idx);
89 const_iterator begin()
const {
return ptr::shared_ptr<PropT>::get()->begin(); }
90 iterator begin() {
return ptr::shared_ptr<PropT>::get()->begin(); }
92 const_iterator end()
const {
return ptr::shared_ptr<PropT>::get()->end(); }
93 iterator end() {
return ptr::shared_ptr<PropT>::get()->end(); }
95 OVM_DEPRECATED(
"use handles to index properties")
96 reference operator[](
size_t _idx) {
return (*ptr::shared_ptr<PropT>::get())[_idx]; }
97 OVM_DEPRECATED(
"use handles to index properties")
98 const_reference operator[](
size_t _idx)
const {
return (*ptr::shared_ptr<PropT>::get())[_idx]; }
100 reference operator[](
const EntityHandleT& _h) {
return (*ptr::shared_ptr<PropT>::get())[_h.idx()]; }
101 const_reference operator[](
const EntityHandleT& _h)
const {
return (*ptr::shared_ptr<PropT>::get())[_h.idx()]; }
103 virtual OpenVolumeMeshHandle handle()
const;
105 virtual bool persistent()
const {
return ptr::shared_ptr<PropT>::get()->persistent(); }
107 virtual bool anonymous()
const {
return ptr::shared_ptr<PropT>::get()->name().empty(); }
111 virtual void delete_multiple_entries(
const std::vector<bool>& _tags);
113 virtual void resize(
size_t _size);
115 virtual void set_handle(
const OpenVolumeMeshHandle& _handle);
120 #if defined(INCLUDE_TEMPLATES) && !defined(PROPERTYPTRT_CC) 121 #include "PropertyPtrT_impl.hh"
PropertyPtr(PropT *_ptr, ResourceManager &_resMan, HandleT _handle)
Constructor.
virtual ~PropertyPtr()
Destructor.