Commit a393ac8f authored by Mike Kremer's avatar Mike Kremer
Browse files

Corrected behaviour of persistent flag.

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@109 66977474-1d4b-4f09-8fe9-267525286df2
parent 2d0c5c16
...@@ -73,7 +73,7 @@ protected: ...@@ -73,7 +73,7 @@ protected:
*/ */
class Holder { class Holder {
public: public:
Holder(PropT* _ptr) : ptr_(_ptr), count_(1u) {} Holder(PropT* _ptr) : ptr_(_ptr), count_(1u), persistent_(false) {}
~Holder() { ~Holder() {
if(ptr_ != NULL) { if(ptr_ != NULL) {
delete ptr_; delete ptr_;
...@@ -83,6 +83,7 @@ protected: ...@@ -83,6 +83,7 @@ protected:
PropT* ptr_; PropT* ptr_;
unsigned int count_; unsigned int count_;
bool persistent_;
}; };
Holder* h_; Holder* h_;
......
...@@ -242,6 +242,8 @@ MeshPropertyT<T> ResourceManager::request_mesh_property(const std::string& _name ...@@ -242,6 +242,8 @@ MeshPropertyT<T> ResourceManager::request_mesh_property(const std::string& _name
template<class T> template<class T>
void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) { void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
VertexPropertyT<T>* prop = new VertexPropertyT<T>(_prop); VertexPropertyT<T>* prop = new VertexPropertyT<T>(_prop);
persistent_vprops_.push_back(prop); persistent_vprops_.push_back(prop);
} }
...@@ -249,6 +251,8 @@ void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) { ...@@ -249,6 +251,8 @@ void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) { void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
EdgePropertyT<T>* prop = new EdgePropertyT<T>(_prop); EdgePropertyT<T>* prop = new EdgePropertyT<T>(_prop);
persistent_eprops_.push_back(prop); persistent_eprops_.push_back(prop);
} }
...@@ -256,6 +260,8 @@ void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) { ...@@ -256,6 +260,8 @@ void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) { void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
HalfEdgePropertyT<T>* prop = new HalfEdgePropertyT<T>(_prop); HalfEdgePropertyT<T>* prop = new HalfEdgePropertyT<T>(_prop);
persistent_heprops_.push_back(prop); persistent_heprops_.push_back(prop);
} }
...@@ -263,6 +269,8 @@ void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) { ...@@ -263,6 +269,8 @@ void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(FacePropertyT<T>& _prop) { void ResourceManager::set_persistent(FacePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
FacePropertyT<T>* prop = new FacePropertyT<T>(_prop); FacePropertyT<T>* prop = new FacePropertyT<T>(_prop);
persistent_fprops_.push_back(prop); persistent_fprops_.push_back(prop);
} }
...@@ -270,6 +278,8 @@ void ResourceManager::set_persistent(FacePropertyT<T>& _prop) { ...@@ -270,6 +278,8 @@ void ResourceManager::set_persistent(FacePropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) { void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
HalfFacePropertyT<T>* prop = new HalfFacePropertyT<T>(_prop); HalfFacePropertyT<T>* prop = new HalfFacePropertyT<T>(_prop);
persistent_hfprops_.push_back(prop); persistent_hfprops_.push_back(prop);
} }
...@@ -277,6 +287,8 @@ void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) { ...@@ -277,6 +287,8 @@ void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(CellPropertyT<T>& _prop) { void ResourceManager::set_persistent(CellPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
CellPropertyT<T>* prop = new CellPropertyT<T>(_prop); CellPropertyT<T>* prop = new CellPropertyT<T>(_prop);
persistent_cprops_.push_back(prop); persistent_cprops_.push_back(prop);
} }
...@@ -284,6 +296,8 @@ void ResourceManager::set_persistent(CellPropertyT<T>& _prop) { ...@@ -284,6 +296,8 @@ void ResourceManager::set_persistent(CellPropertyT<T>& _prop) {
template<class T> template<class T>
void ResourceManager::set_persistent(MeshPropertyT<T>& _prop) { void ResourceManager::set_persistent(MeshPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
MeshPropertyT<T>* prop = new MeshPropertyT<T>(_prop); MeshPropertyT<T>* prop = new MeshPropertyT<T>(_prop);
persistent_mprops_.push_back(prop); persistent_mprops_.push_back(prop);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment