MorphoGraphX  2.0-1-227
Classes | Public Member Functions | List of all members
mgx::Attributes Class Reference

Holds a set of attributes. More...

#include <Attributes.hpp>

Public Member Functions

 Attributes ()
 Constructor. More...
 
virtual ~Attributes ()
 Destructor. More...
 
template<typename KeyT , typename ValueT >
AttrMap< KeyT, ValueT > & attrMap (const QString &name, bool saveRequired=true)
 Get the attribute, if it does not exist create it and add to the set If it exists, and if so load it from the byte array. More...
 
template<typename KeyT , typename ValueT >
const AttrMap< KeyT, ValueT > * getAttrMap (const QString &name) const
 Try to get a constant pointer to an attribute. More...
 
bool saveRequired (const QString &name) const
 Get a reference to the attribute's save status, it will be created if it doesn't exist. More...
 
bool setSaveRequired (const QString &name, bool saveReq)
 
void erase (const QString &name)
 Erase an attribute. More...
 
void clear ()
 Clear the attributes. More...
 
bool write (QIODevice &file)
 Write the attributes to a file. More...
 
bool read (QIODevice &file, bool clearAttr=true)
 Read the attributes from a file. More...
 
bool read (QIODevice &file, IntVtxMap *vMap, IntCellMap *cMap, bool clearAttr=true)
 Read the attributes from a file. More...
 
bool saveVtxCellMaps (IntVtxMap *vMap, IntCellMap *cMap, bool clearAttr)
 Set the saveId-vertex map for loading vertex and Index attributes Since the readAttr and writeAttr are global functions, attributes with vertex, or cell keys will need these tables. More...
 
virtual size_t size (QString _name)
 
QStringList getAttrList () const
 Return a list of attribute names. More...
 
QStringList clearNotparsedAttrList () const
 Return a list of unparsed attribute names. More...
 

Detailed Description

Holds a set of attributes.

Attributes are a collection of maps (Attribute objects). FIXME: what are the constraints on attributes?

Definition at line 917 of file Attributes.hpp.

Constructor & Destructor Documentation

◆ Attributes()

mgx::Attributes::Attributes ( )
inline

Constructor.

Parameters
nameName of the attribute

Definition at line 1098 of file Attributes.hpp.

◆ ~Attributes()

virtual mgx::Attributes::~Attributes ( )
inlinevirtual

Destructor.

Definition at line 1105 of file Attributes.hpp.

Member Function Documentation

◆ attrMap()

template<typename KeyT , typename ValueT >
AttrMap<KeyT, ValueT>& mgx::Attributes::attrMap ( const QString &  name,
bool  saveRequired = true 
)
inline

Get the attribute, if it does not exist create it and add to the set If it exists, and if so load it from the byte array.

Parameters
nameName of the attribute

Definition at line 1116 of file Attributes.hpp.

◆ clear()

void mgx::Attributes::clear ( )
inline

Clear the attributes.

Parameters
nameName of the attribute

Definition at line 1191 of file Attributes.hpp.

◆ clearNotparsedAttrList()

QStringList mgx::Attributes::clearNotparsedAttrList ( ) const
inline

Return a list of unparsed attribute names.

Definition at line 1418 of file Attributes.hpp.

◆ erase()

void mgx::Attributes::erase ( const QString &  name)
inline

Erase an attribute.

Parameters
nameName of the attribute

Definition at line 1178 of file Attributes.hpp.

◆ getAttrList()

QStringList mgx::Attributes::getAttrList ( ) const
inline

Return a list of attribute names.

Definition at line 1402 of file Attributes.hpp.

◆ getAttrMap()

template<typename KeyT , typename ValueT >
const AttrMap<KeyT, ValueT>* mgx::Attributes::getAttrMap ( const QString &  name) const
inline

Try to get a constant pointer to an attribute.

Return null if nothing exists under name or if existing data has another type.

Definition at line 1151 of file Attributes.hpp.

◆ read() [1/2]

bool mgx::Attributes::read ( QIODevice &  file,
bool  clearAttr = true 
)
inline

Read the attributes from a file.

Parameters
fileThe file to read
clearAttrClear the existing attributes first

Definition at line 1287 of file Attributes.hpp.

◆ read() [2/2]

bool mgx::Attributes::read ( QIODevice &  file,
IntVtxMap vMap,
IntCellMap cMap,
bool  clearAttr = true 
)
inline

Read the attributes from a file.

Parameters
fileThe file to read
vMapMap saveIds to vertices
clearClear the existing attributes first

Definition at line 1350 of file Attributes.hpp.

◆ saveRequired()

bool mgx::Attributes::saveRequired ( const QString &  name) const
inline

Get a reference to the attribute's save status, it will be created if it doesn't exist.

Parameters
nameName of the attribute

Definition at line 1165 of file Attributes.hpp.

◆ saveVtxCellMaps()

bool mgx::Attributes::saveVtxCellMaps ( IntVtxMap vMap,
IntCellMap cMap,
bool  clearAttr 
)
inline

Set the saveId-vertex map for loading vertex and Index attributes Since the readAttr and writeAttr are global functions, attributes with vertex, or cell keys will need these tables.

Definition at line 1364 of file Attributes.hpp.

◆ setSaveRequired()

bool mgx::Attributes::setSaveRequired ( const QString &  name,
bool  saveReq 
)
inline

Definition at line 1169 of file Attributes.hpp.

◆ size()

virtual size_t mgx::Attributes::size ( QString  _name)
inlinevirtual

Definition at line 1390 of file Attributes.hpp.

◆ write()

bool mgx::Attributes::write ( QIODevice &  file)
inline

Write the attributes to a file.

Parameters
fileThe file to write

Definition at line 1223 of file Attributes.hpp.


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