MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
mgx::util::PlyFile::Element Class Reference

Class representing an element. More...

#include <PlyFile.hpp>

Public Member Functions

 Element (const QString &name, PlyFile *parent=0)
 Element constructor. More...
 
 ~Element ()
 The destructor takes care of detaching the element from the PLY file that contains it.
 
void allocate ()
 Allocate the memory for all the properties attached to the element.
 
void clear ()
 Remove any property attached to this element. More...
 
size_t nbProperties () const
 Number of properties in the element.
 
size_t size () const
 Number of items in the element.
 
void resize (size_t n)
 Change the number of items in the element. More...
 
QStringList properties () const
 Get the list of property names.
 
Propertyproperty (size_t pos)
 Access a property by index number.
 
const Propertyproperty (size_t pos) const
 Access a property by index number.
 
Propertyproperty (const QString &name)
 Access a property by name.
 
const Propertyproperty (const QString &name) const
 Access a property by name.
 
PropertycreateValue (const QString &name, TYPE file, TYPE mem=INVALID_TYPE)
 Create a new value property if the name doesn't already exist. More...
 
PropertycreateList (const QString &name, TYPE size, TYPE file, TYPE mem=INVALID_TYPE)
 Create a new value property if the name doesn't already exist. More...
 
bool error (const QString &str) const
 Write the error in the standard out and return false.
 
bool hasProperty (const QString &name) const
 Returns true if the element has a property names name.
 
bool attach (Property *prop)
 Attach a property to the element.
 
bool detach (Property *prop)
 Remove a property from the element.
 
Propertydetach (const QString &name)
 Remove a property from the element, and return the removed property.
 
const QStringname () const
 Name of the element.
 
bool rename (const QString &n)
 Rename the element, only if the containing PLY file doesn't already contain an element with the new name.
 
bool allocated () const
 Return true if the element has been allocated.
 
bool setParent (PlyFile *p)
 Change the parent of the element, only if the new parent doesn't have an element with the same name.
 
PlyFileparent ()
 Get the parent of the element.
 
const PlyFileparent () const
 Get the parent of the element.
 
void _rename_prop (Property *prop, const QString &new_name)
 
void _attach (Property *prop)
 
void _detach (Property *prop)
 

Protected Attributes

QString _name
 
size_t _nbElements
 
QList< Property * > _properties
 
QHash< QString, int > _property_map
 
PlyFile_parent
 
bool _allocated
 

Detailed Description

Class representing an element.

Constructor & Destructor Documentation

mgx::util::PlyFile::Element::Element ( const QString name,
PlyFile parent = 0 
)

Element constructor.

Parameters
nameName of the lement
parentPLY file holding the element

The name must be unique in the PLY file. If this is not the case, the element won't be attached to the PLY file and the parent won't be set.

Note
An element should be created using the PlyFile::createElement method.

Member Function Documentation

void mgx::util::PlyFile::Element::clear ( )

Remove any property attached to this element.

The properties will be deleted.

Property* mgx::util::PlyFile::Element::createList ( const QString name,
TYPE  size,
TYPE  file,
TYPE  mem = INVALID_TYPE 
)

Create a new value property if the name doesn't already exist.

Parameters
nameName of the new property
sizeFile type for the size of the list
fileFile type of the property
memMemory type. If INVALID_TYPE is specified here, the memory type will be equal to the file type
Property* mgx::util::PlyFile::Element::createValue ( const QString name,
TYPE  file,
TYPE  mem = INVALID_TYPE 
)

Create a new value property if the name doesn't already exist.

Parameters
nameName of the new property
fileFile type of the property
memMemory type. If INVALID_TYPE is specified here, the memory type will be equal to the file type
void mgx::util::PlyFile::Element::resize ( size_t  n)

Change the number of items in the element.

This will call Property::resize on all the properties of the element.


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