20#ifndef PLYWOOT_TYPES_HPP
21#define PLYWOOT_TYPES_HPP
36enum class PlyDataType { Char, UChar, Short, UShort, Int, UInt, Float, Double };
44inline std::ostream &operator<<(std::ostream &os,
PlyDataType type)
48 case PlyDataType::Char:
50 case PlyDataType::UChar:
52 case PlyDataType::Short:
54 case PlyDataType::UShort:
55 return os <<
"ushort";
56 case PlyDataType::Int:
58 case PlyDataType::UInt:
60 case PlyDataType::Float:
62 case PlyDataType::Double:
63 return os <<
"double";
103 const std::string &
name()
const {
return name_; }
125 return x.type_ == y.type_ && x.isList_ == y.isList_ && x.sizeType_ == y.sizeType_ && x.name_ == y.name_;
140 PlyDataType sizeType_{PlyDataType::Char};
173 const std::string &
name()
const {
return name_; }
177 std::size_t
size()
const {
return size_; }
181 const std::vector<PlyProperty> &
properties()
const {
return properties_; }
193 std::optional<PlyProperty>
property(
const std::string &propertyName)
const
195 const auto it = std::find_if(properties_.begin(), properties_.end(), [&](
const PlyProperty &p) {
196 return p.name() == propertyName;
198 return it != properties_.end() ? std::optional(*it) : std::nullopt;
207 template<
typename... Args>
210 properties_.emplace_back(std::forward<Args>(args)...);
211 return properties_.back();
223 return x.size_ == y.size_ && x.name_ == y.name_ && x.properties_ == y.properties_;
240 std::vector<PlyProperty> properties_;
std::optional< PlyProperty > property(const std::string &propertyName) const
const std::vector< PlyProperty > & properties() const
PlyElement(std::string name, std::size_t size)
PlyProperty & addProperty(Args &&...args)
friend bool operator==(const PlyElement &x, const PlyElement &y)
const std::string & name() const
PlyElement()=default
Default constructor.
friend bool operator!=(const PlyElement &x, const PlyElement &y)
PlyElement(std::string name, std::size_t size, std::vector< PlyProperty > properties)
PlyProperty()=default
Default constructor.
const std::string & name() const
PlyDataType sizeType() const
friend bool operator==(const PlyProperty &x, const PlyProperty &y)
PlyProperty(std::string name, PlyDataType type)
friend bool operator!=(const PlyProperty &x, const PlyProperty &y)
PlyProperty(std::string name, PlyDataType type, PlyDataType sizeType)
std::vector< PlyProperty >::const_iterator PlyPropertyConstIterator
PlyDataType
Enumeration of data types supported by the PLY format.