Fem1DPlyReaderDelegate.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_FEM1DPLYREADERDELEGATE_H
17 #define SURGSIM_PHYSICS_FEM1DPLYREADERDELEGATE_H
18 
19 #include <memory>
20 #include <string>
21 
23 
24 namespace SurgSim
25 {
26 namespace Physics
27 {
28 class Fem1DRepresentation;
29 
32 {
33 public:
36  explicit Fem1DPlyReaderDelegate(std::shared_ptr<Fem1DRepresentation> fem);
37 
38 protected:
39  virtual std::string getElementName() const override;
40 
41  virtual bool registerDelegate(SurgSim::DataStructures::PlyReader* reader) override;
42  virtual bool fileIsAcceptable(const SurgSim::DataStructures::PlyReader& reader) override;
43 
44  virtual void endParseFile() override;
45  virtual void processFemElement(const std::string& elementName) override;
46 
51  void* beginRadius(const std::string& elementName, size_t radiusCount);
52 
55  void endRadius(const std::string& elementName);
56 
57 private:
58  double m_radius;
59 };
60 
61 } // namespace Physics
62 } // namespace SurgSim
63 
64 #endif // SURGSIM_PHYSICS_FEM1DPLYREADERDELEGATE_H
Definition: DriveElementFromInputBehavior.cpp:27
virtual void processFemElement(const std::string &elementName) override
Callback function to process one FemElement.
Definition: Fem1DPlyReaderDelegate.cpp:65
Common part of implementation of PlyReaderDelegate for FemRepresentations.
Definition: FemPlyReaderDelegate.h:39
virtual void endParseFile() override
Callback for end of PlyReader::parseFile.
Definition: Fem1DPlyReaderDelegate.cpp:85
Wrapper for the C .ply file parser This class wraps the main functionality for the original C ...
Definition: PlyReader.h:85
Fem1DPlyReaderDelegate(std::shared_ptr< Fem1DRepresentation > fem)
Constructor.
Definition: Fem1DPlyReaderDelegate.cpp:30
virtual bool registerDelegate(SurgSim::DataStructures::PlyReader *reader) override
Registers the delegate with the reader.
Definition: Fem1DPlyReaderDelegate.cpp:41
Implementation of PlyReaderDelegate for Fem1DRepresentation.
Definition: Fem1DPlyReaderDelegate.h:31
void endRadius(const std::string &elementName)
Callback function, end the processing of radius.
Definition: Fem1DPlyReaderDelegate.cpp:80
double m_radius
Definition: Fem1DPlyReaderDelegate.h:58
virtual std::string getElementName() const override
Definition: Fem1DPlyReaderDelegate.cpp:36
void * beginRadius(const std::string &elementName, size_t radiusCount)
Callback function, begin the processing of radius.
Definition: Fem1DPlyReaderDelegate.cpp:75
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: Fem1DPlyReaderDelegate.cpp:57