@@ -57,34 +57,6 @@ OBJMeshIO::CanWriteFile(const char * fileName)
5757 return true ;
5858}
5959
60- std::ifstream
61- OBJMeshIO::OpenFile () const
62- {
63- if (this ->m_FileName .empty ())
64- {
65- itkExceptionStringMacro (" No input FileName" );
66- }
67-
68- if (!itksys::SystemTools::FileExists (m_FileName.c_str ()))
69- {
70- itkExceptionMacro (" File " << this ->m_FileName << " does not exist" );
71- }
72-
73- // Read file as ascii
74- // Due to the windows couldn't work well for tellg() and seekg() for ASCII
75- // mode, hence we
76- // open the file with std::ios::binary
77- std::ifstream inputFile (m_FileName, std::ios::binary);
78-
79- // Test whether the file was opened
80- if (!inputFile.is_open ())
81- {
82- itkExceptionMacro (" Unable to open file " << this ->m_FileName );
83- }
84-
85- return inputFile;
86- }
87-
8860
8961bool
9062OBJMeshIO::SplitLine (const std::string & line, std::string & type, std::string & content)
11890OBJMeshIO::ReadMeshInformation ()
11991{
12092 // Define input file stream and attach it to input file
121- std::ifstream inputFile = OpenFile ();
93+ std::ifstream inputFile = MeshIOBase::OpenInputFile ();
12294
12395 // Read and analyze the first line in the file
12496 SizeValueType numberOfCellPoints = 0 ;
188160OBJMeshIO::ReadPoints (void * buffer)
189161{
190162 // Define input file stream and attach it to input file
191- std::ifstream inputFile = OpenFile ();
163+ std::ifstream inputFile = MeshIOBase::OpenInputFile ();
192164
193165 // Number of data array
194166 auto * data = static_cast <float *>(buffer);
219191OBJMeshIO::ReadCells (void * buffer)
220192{
221193 // Define input file stream and attach it to input file
222- std::ifstream inputFile = OpenFile ();
194+ std::ifstream inputFile = MeshIOBase::OpenInputFile ();
223195
224196 // Read and analyze the first line in the file
225197 const auto data = make_unique_for_overwrite<long []>(this ->m_CellBufferSize - this ->m_NumberOfCells );
273245OBJMeshIO::ReadPointData (void * buffer)
274246{
275247 // Define input file stream and attach it to input file
276- std::ifstream inputFile = OpenFile ();
248+ std::ifstream inputFile = MeshIOBase::OpenInputFile ();
277249
278250 // Number of data array
279251 auto * data = static_cast <float *>(buffer);
0 commit comments