PLYwoot
Header-only C++17 library for parsing and writing PLY files
Loading...
Searching...
No Matches
plywoot::PlyElement Struct Reference

#include <types.hpp>

Public Member Functions

 PlyElement ()=default
 Default constructor.
 
 PlyElement (std::string name, std::size_t size)
 
 PlyElement (std::string name, std::size_t size, std::vector< PlyProperty > properties)
 
const std::string & name () const
 
std::size_t size () const
 
const std::vector< PlyProperty > & properties () const
 
std::optional< PlyPropertyproperty (const std::string &propertyName) const
 
template<typename... Args>
PlyPropertyaddProperty (Args &&...args)
 

Friends

bool operator== (const PlyElement &x, const PlyElement &y)
 
bool operator!= (const PlyElement &x, const PlyElement &y)
 

Detailed Description

Represents an element stored in a PLY file. An element is a named collection of ordered PLY properties.

Definition at line 149 of file types.hpp.

Constructor & Destructor Documentation

◆ PlyElement() [1/2]

plywoot::PlyElement::PlyElement ( std::string  name,
std::size_t  size 
)
inline

Constructor taking a name and size for this element.

Parameters
namename of the PLY element to construct
sizethe number of instances of this element in the PLY file

Definition at line 157 of file types.hpp.

◆ PlyElement() [2/2]

plywoot::PlyElement::PlyElement ( std::string  name,
std::size_t  size,
std::vector< PlyProperty properties 
)
inline

Constructor taking a name and size for this element, as well as a list of initial properties to associate with this element.

Parameters
namename of the PLY element to construct
sizethe number of instances of this element in the PLY file
propertiesdefinitions of the PLY properties embedded in this PLY element

Definition at line 165 of file types.hpp.

Member Function Documentation

◆ addProperty()

template<typename... Args>
PlyProperty & plywoot::PlyElement::addProperty ( Args &&...  args)
inline

Factory method that constructs a new PLY property definition associated with this PLY element in-place, forwarding the given arguments to the constructor of plywoot::PlyProperty.

Parameters
argsarguments to forward to the constructor of plywoot::Property
Returns
the newly constructed and added PLY property definition

Definition at line 208 of file types.hpp.

◆ name()

const std::string & plywoot::PlyElement::name ( ) const
inline

Returns the name of this element.

Returns
the name of this element

Definition at line 173 of file types.hpp.

◆ properties()

const std::vector< PlyProperty > & plywoot::PlyElement::properties ( ) const
inline

Returns the properties associated with this element.

Returns
the properties associated with this element

Definition at line 181 of file types.hpp.

◆ property()

std::optional< PlyProperty > plywoot::PlyElement::property ( const std::string &  propertyName) const
inline

Returns a pair where the first element is a copy of the property with the given name in case it exists. The second element is a Boolean that indicates whether the requested property was found. In case a requested property was not found for this element, a default constructed property is returned.

Parameters
propertyNamename of the property to find the definition for
Returns
a pair where the first element is a copy of the property with the given name in case it exists and the second element is a Boolean that indicates whether the requested property was found

Definition at line 193 of file types.hpp.

◆ size()

std::size_t plywoot::PlyElement::size ( ) const
inline

Returns the number of instances of this element in the PLY file

Returns
the number of instances of this element in the PLY file

Definition at line 177 of file types.hpp.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const PlyElement x,
const PlyElement y 
)
friend

Compares the two given PLY element definitions for inequality.

Parameters
xleft-hand side element definition to compare for inequality with y
yright-hand side element definition to compare for inequality with x
Returns
true in case x is not equal to y, false otherwise

Definition at line 232 of file types.hpp.

◆ operator==

bool operator== ( const PlyElement x,
const PlyElement y 
)
friend

Compares the two given PLY element definitions for equality.

Parameters
xleft-hand side element definition to compare for equality with y
yright-hand side element definition to compare for equality with x
Returns
true in case x is equal to y, false otherwise

Definition at line 221 of file types.hpp.


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