Commit a393ac8f authored by Mike Kremer's avatar Mike Kremer

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:
*/
class Holder {
public:
Holder(PropT* _ptr) : ptr_(_ptr), count_(1u) {}
Holder(PropT* _ptr) : ptr_(_ptr), count_(1u), persistent_(false) {}
~Holder() {
if(ptr_ != NULL) {
delete ptr_;
......@@ -83,6 +83,7 @@ protected:
PropT* ptr_;
unsigned int count_;
bool persistent_;
};
Holder* h_;
......
......@@ -242,6 +242,8 @@ MeshPropertyT<T> ResourceManager::request_mesh_property(const std::string& _name
template<class T>
void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
VertexPropertyT<T>* prop = new VertexPropertyT<T>(_prop);
persistent_vprops_.push_back(prop);
}
......@@ -249,6 +251,8 @@ void ResourceManager::set_persistent(VertexPropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
EdgePropertyT<T>* prop = new EdgePropertyT<T>(_prop);
persistent_eprops_.push_back(prop);
}
......@@ -256,6 +260,8 @@ void ResourceManager::set_persistent(EdgePropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
HalfEdgePropertyT<T>* prop = new HalfEdgePropertyT<T>(_prop);
persistent_heprops_.push_back(prop);
}
......@@ -263,6 +269,8 @@ void ResourceManager::set_persistent(HalfEdgePropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(FacePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
FacePropertyT<T>* prop = new FacePropertyT<T>(_prop);
persistent_fprops_.push_back(prop);
}
......@@ -270,6 +278,8 @@ void ResourceManager::set_persistent(FacePropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
HalfFacePropertyT<T>* prop = new HalfFacePropertyT<T>(_prop);
persistent_hfprops_.push_back(prop);
}
......@@ -277,6 +287,8 @@ void ResourceManager::set_persistent(HalfFacePropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(CellPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
CellPropertyT<T>* prop = new CellPropertyT<T>(_prop);
persistent_cprops_.push_back(prop);
}
......@@ -284,6 +296,8 @@ void ResourceManager::set_persistent(CellPropertyT<T>& _prop) {
template<class T>
void ResourceManager::set_persistent(MeshPropertyT<T>& _prop) {
if(_prop.h_->persistent_) return;
_prop.h_->persistent_ = true;
MeshPropertyT<T>* prop = new MeshPropertyT<T>(_prop);
persistent_mprops_.push_back(prop);
}
......
Markdown is supported
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