From 1d292521268b918579f80a56cca60640b79f1808 Mon Sep 17 00:00:00 2001 From: Hans-Christian Ebke Date: Tue, 11 Sep 2012 18:16:01 +0000 Subject: [PATCH] Core/Utils/PropertyManager: Added createIfNotExists factory method. git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@669 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/Utils/PropertyManager.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/OpenMesh/Core/Utils/PropertyManager.hh b/src/OpenMesh/Core/Utils/PropertyManager.hh index 243e8cee..21dba558 100644 --- a/src/OpenMesh/Core/Utils/PropertyManager.hh +++ b/src/OpenMesh/Core/Utils/PropertyManager.hh @@ -131,6 +131,18 @@ class PropertyManager { return *this; } + + /** + * Create a property manager for the supplied property and mesh. + * If the property doesn't exist, it is created. In any case, + * lifecycle management is disabled. + */ + static PropertyManager createIfNotExists(MeshT &mesh, const char *propname) { + PROPTYPE dummy_prop; + PropertyManager pm(mesh, propname, mesh.get_property_handle(dummy_prop, propname)); + pm.retain(); + return std::move(pm); + } #endif /**