MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / readFromStream

Function readFromStream

source/MRIOExtras/MRStep.cpp:788–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787
788Expected<void> readFromStream( STEPControl_Reader& reader, std::istream& in )
789{
790 MR_TIMER;
791
792#if STEP_READSTREAM_SUPPORTED
793 if ( reader.ReadStream( "STEP file", in ) != IFSelect_RetDone )
794 return unexpected( "Failed to read STEP model" );
795 return {};
796#else
797 std::unique_lock lock( cOpenCascadeTempFileMutex );
798
799 const auto tempFilePath = getStepTemporaryDirectory() / "tempFile.step";
800 std::error_code ec;
801 MR_FINALLY {
802 std::filesystem::remove( tempFilePath, ec );
803 };
804
805 {
806 std::ofstream ofs( tempFilePath, std::ios::binary );
807 if ( !ofs )
808 return unexpected( std::string( "Cannot open buffer file" ) );
809
810 ofs << in.rdbuf();
811 }
812
813 return readFromFile( reader, tempFilePath );
814#endif
815}
816
817#if !STEP_READER_FIXED
818Expected<void> repairStepFile( STEPControl_Reader& reader )

Callers 3

repairStepFileFunction · 0.70
fromStepFunction · 0.70
fromSceneStepFileFunction · 0.70

Calls 3

readFromFileFunction · 0.85
unexpectedFunction · 0.50

Tested by

no test coverage detected