16 #ifndef SURGSIM_DATASTRUCTURES_PLYREADER_H 17 #define SURGSIM_DATASTRUCTURES_PLYREADER_H 22 #include <unordered_map> 27 namespace DataStructures
30 class PlyReaderDelegate;
115 explicit PlyReader(
const std::string& filename);
133 std::function<
void* (
const std::string&,
size_t)> startElementCallback,
134 std::function<
void (
const std::string&)> processElementCallback,
135 std::function<
void (
const std::string&)> endElementCallback);
151 int dataType,
int dataOffset);
168 const std::string& propertyName,
169 int dataType,
int dataOffset,
170 int countType,
int countOffset);
175 bool hasElement(
const std::string& elementName)
const;
181 bool hasProperty(
const std::string& elementName,
const std::string& propertyName)
const;
187 bool isScalar(
const std::string& elementName,
const std::string& propertyName)
const;
203 bool setDelegate(std::shared_ptr<PlyReaderDelegate> delegate);
221 bool requestProperty(
const std::string& elementName,
222 const std::string& propertyName,
223 int dataType,
int dataOffset,
224 int countType,
int countOffset);
227 std::string m_filename;
232 std::string propertyName;
236 int countOffset = -1;
243 StartElementCallbackType startElementCallback;
244 StandardCallbackType processElementCallback;
245 StandardCallbackType endElementCallback;
246 std::vector<PropertyInfo> requestedProperties;
249 std::unordered_map<std::string, ElementInfo> m_requestedElements;
254 std::unique_ptr<Data> m_data;
258 std::shared_ptr<PlyReaderDelegate> m_delegate;
261 std::function<void(void)> m_startParseFileCallback;
264 std::function<void(void)> m_endParseFileCallback;
270 #endif // SURGSIM_DATASTRUCTURES_PLYREADER_H void parseFile()
Parse the file.
Definition: PlyReader.cpp:214
Definition: PlyReaderTests.cpp:46
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
bool hasProperty(const std::string &elementName, const std::string &propertyName) const
Query if 'elementName' has the given property.
Definition: PlyReader.cpp:353
virtual ~PlyReader()
Destructor.
Definition: PlyReader.cpp:77
bool hasElement(const std::string &elementName) const
Query if this elementName is in the .ply file.
Definition: PlyReader.cpp:346
bool requestScalarProperty(const std::string &elementName, const std::string &propertyName, int dataType, int dataOffset)
Request a scalar property for parsing.
Definition: PlyReader.cpp:121
void setStartParseFileCallback(std::function< void(void)> startParseFileCallback)
Register callback to be called at the begining of parseFile.
Definition: PlyReader.cpp:135
std::function< void(const std::string &)> StandardCallbackType
The callback that is used for the processing and the end of processing, the parameter passed is the n...
Definition: PlyReader.h:111
Definition: PlyReader.cpp:34
Wrapper for the C .ply file parser This class wraps the main functionality for the original C ...
Definition: PlyReader.h:85
Type
Values that represent the data type/size of requested data.
Definition: PlyReader.h:89
PlyReader(const std::string &filename)
Constructor.
Definition: PlyReader.cpp:63
bool setDelegate(std::shared_ptr< PlyReaderDelegate > delegate)
Sets a delegate for parsing.
Definition: PlyReader.cpp:199
bool requestListProperty(const std::string &elementName, const std::string &propertyName, int dataType, int dataOffset, int countType, int countOffset)
Request a list property for parsing.
Definition: PlyReader.cpp:127
bool isScalar(const std::string &elementName, const std::string &propertyName) const
Query if the property of the give element is scalar.
Definition: PlyReader.cpp:367
bool requestElement(const std::string &elementName, std::function< void *(const std::string &, size_t)> startElementCallback, std::function< void(const std::string &)> processElementCallback, std::function< void(const std::string &)> endElementCallback)
Request element to be processed during parsing.
Definition: PlyReader.cpp:97
std::function< void *(const std::string &, size_t)> StartElementCallbackType
The callback that is being used to indicate the start of an element, the parameters that are passed i...
Definition: PlyReader.h:107
bool isValid() const
Query if this object is valid.
Definition: PlyReader.cpp:92
void setEndParseFileCallback(std::function< void(void)> endParseFileCallback)
Register callback to be called at the end of parseFile.
Definition: PlyReader.cpp:140
bool parseWithDelegate(std::shared_ptr< PlyReaderDelegate > delegate)
Sets a delegate for parsing and then parse the file.
Definition: PlyReader.cpp:336