Fem2DPlyReaderDelegate.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2014, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_PHYSICS_FEM2DPLYREADERDELEGATE_H
17 #define SURGSIM_PHYSICS_FEM2DPLYREADERDELEGATE_H
18 
19 #include <memory>
20 
22 
23 namespace SurgSim
24 {
25 namespace Physics
26 {
27 class Fem2DRepresentation;
28 
31 {
32 public:
35  explicit Fem2DPlyReaderDelegate(std::shared_ptr<Fem2DRepresentation> fem);
36 
37 protected:
38  virtual std::string getElementName() const override;
39 
40  virtual bool registerDelegate(SurgSim::DataStructures::PlyReader* reader) override;
41  virtual bool fileIsAcceptable(const SurgSim::DataStructures::PlyReader& reader) override;
42 
43  virtual void endParseFile() override;
44  virtual void processFemElement(const std::string& elementName) override;
45 
50  void* beginThickness(const std::string& elementName, size_t thicknessCount);
51 
54  void endThickness(const std::string& elementName);
55 
56 private:
57  double m_thickness;
58 };
59 
60 } // namespace Physics
61 } // namespace SurgSim
62 
63 #endif // SURGSIM_PHYSICS_FEM2DPLYREADERDELEGATE_H
Definition: DriveElementFromInputBehavior.cpp:27
virtual bool fileIsAcceptable(const SurgSim::DataStructures::PlyReader &reader) override
Check whether the file in the reader can be used with this delegate, this gives the delegate a chance...
Definition: Fem2DPlyReaderDelegate.cpp:57
Common part of implementation of PlyReaderDelegate for FemRepresentations.
Definition: FemPlyReaderDelegate.h:39
double m_thickness
Definition: Fem2DPlyReaderDelegate.h:57
virtual void processFemElement(const std::string &elementName) override
Callback function to process one FemElement.
Definition: Fem2DPlyReaderDelegate.cpp:65
virtual void endParseFile() override
Callback for end of PlyReader::parseFile.
Definition: Fem2DPlyReaderDelegate.cpp:85
Wrapper for the C .ply file parser This class wraps the main functionality for the original C ...
Definition: PlyReader.h:85
Fem2DPlyReaderDelegate(std::shared_ptr< Fem2DRepresentation > fem)
Constructor.
Definition: Fem2DPlyReaderDelegate.cpp:30
void * beginThickness(const std::string &elementName, size_t thicknessCount)
Callback function, begin the processing of thickness.
Definition: Fem2DPlyReaderDelegate.cpp:75
void endThickness(const std::string &elementName)
Callback function, end the processing of thickness.
Definition: Fem2DPlyReaderDelegate.cpp:80
virtual std::string getElementName() const override
Definition: Fem2DPlyReaderDelegate.cpp:36
virtual bool registerDelegate(SurgSim::DataStructures::PlyReader *reader) override
Registers the delegate with the reader.
Definition: Fem2DPlyReaderDelegate.cpp:41
Implementation of PlyReaderDelegate for Fem2DRepresentation.
Definition: Fem2DPlyReaderDelegate.h:30