OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | List of all members
OpenMesh::PropertyManager< PROPTYPE, MeshT > Class Template Reference

This class is intended to manage the lifecycle of properties. More...

`#include <OpenMesh/Core/Utils/PropertyManager.hh>`

## Classes
class | Proxy

## Public Member Functions
| PropertyManager (MeshT &mesh, const char *propname, bool existing=false)
| Constructor. More...
void | swap (PropertyManager &rhs)
bool | isValid () const
| operator bool () const
const PROPTYPE & | getRawProperty () const
const std::string & | getName () const
MeshT & | getMesh () const
| operator Proxy ()
| PropertyManager (Proxy p)
PropertyManager & | operator= (Proxy p)
void | retain (bool doRetain=true)
| Disable lifecycle management for this property. More...
PROPTYPE & | operator* ()
| Access the encapsulated property.
const PROPTYPE & | operator* () const
| Access the encapsulated property.
template<typename HandleType >
PROPTYPE::reference | operator[] (const HandleType &handle)
| Enables convenient access to the encapsulated property. More...
template<typename HandleType >
PROPTYPE::const_reference | operator[] (const HandleType &handle) const
| Enables convenient access to the encapsulated property. More...

## Static Public Member Functions
static bool | propertyExists (MeshT &mesh, const char *propname)
static Proxy | createIfNotExists (MeshT &mesh, const char *propname)
| Create a property manager for the supplied property and mesh. More...

## Detailed Description

### template<typename PROPTYPE, typename MeshT>
class OpenMesh::PropertyManager< PROPTYPE, MeshT >

This class is intended to manage the lifecycle of properties.

It also defines convenience operators to access the encapsulated property's value.

Usage example:

TriMesh mesh;
PropertyManager<VPropHandleT<bool>, MeshT> visited(mesh, "visited.plugin-example.i8.informatik.rwth-aachen.de");
for (TriMesh::VertexIter vh_it = mesh.begin(); ... ; ...) {
if (!visited[*vh_it]) {
visitComponent(mesh, *vh_it, visited);
}
}

## Constructor & Destructor Documentation

template<typename PROPTYPE , typename MeshT >

OpenMesh::PropertyManager< PROPTYPE, MeshT >::PropertyManager | ( | MeshT & | mesh,
|  | const char * | propname,
|  | bool | existing = `false`
| ) |  |
| inline

Constructor.

Throws an `std::runtime_error` if `existing` is true and no property named `propname` of the appropriate property type exists.

Parameters

  mesh | The mesh on which to create the property.
  propname | The name of the property.
  existing | If false, a new property is created and its lifecycle is managed (i.e. the property is deleted upon destruction of the PropertyManager instance). If true, the instance merely acts as a convenience wrapper around an existing property with no lifecycle management whatsoever.

## Member Function Documentation

template<typename PROPTYPE , typename MeshT >

static Proxy OpenMesh::PropertyManager< PROPTYPE, MeshT >::createIfNotExists | ( | MeshT & | mesh,
|  | const char * | propname
| ) |  |
| inline static

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.

template<typename PROPTYPE , typename MeshT >
template<typename HandleType >

PROPTYPE::reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator[] | ( | const HandleType & | handle | ) |
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

template<typename PROPTYPE , typename MeshT >
template<typename HandleType >

PROPTYPE::const_reference OpenMesh::PropertyManager< PROPTYPE, MeshT >::operator[] | ( | const HandleType & | handle | ) | const
| inline

Enables convenient access to the encapsulated property.

For a usage example see this class' documentation.

Parameters

  handle | A handle of the appropriate handle type. (I.e. `VertexHandle` for `VPropHandleT`, etc.)

template<typename PROPTYPE , typename MeshT >

void OpenMesh::PropertyManager< PROPTYPE, MeshT >::retain | ( | bool | doRetain = `true` | ) |
| inline

Disable lifecycle management for this property.

If this method is called, the encapsulated property will not be deleted upon destruction of the PropertyManager instance.

The documentation for this class was generated from the following file:

- OpenMesh/Core/Utils/PropertyManager.hh