First pass of load files through an interface (to allow loading from memory, zip file etc). So instead of posix fopen/fread, using CommonFileIOInterface.
A fileIO plugin can override custom file IO operations. As a small test, load files from a zipfile in memory. Default fileIO implementation is in examples/Utils/b3BulletDefaultFileIO.h Affects URDF, SDF, MJCF, Wavefront OBJ, STL, DAE, images.
This commit is contained in:
19
examples/CommonInterfaces/CommonFileIOInterface.h
Normal file
19
examples/CommonInterfaces/CommonFileIOInterface.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef COMMON_FILE_IO_INTERFACE_H
|
||||
#define COMMON_FILE_IO_INTERFACE_H
|
||||
|
||||
struct CommonFileIOInterface
|
||||
{
|
||||
virtual ~CommonFileIOInterface()
|
||||
{
|
||||
}
|
||||
virtual int fileOpen(const char* fileName, const char* mode)=0;
|
||||
virtual int fileRead(int fileHandle, char* destBuffer, int numBytes)=0;
|
||||
virtual int fileWrite(int fileHandle,const char* sourceBuffer, int numBytes)=0;
|
||||
virtual void fileClose(int fileHandle)=0;
|
||||
virtual bool findResourcePath(const char* fileName, char* resourcePathOut, int resourcePathMaxNumBytes)=0;
|
||||
virtual char* readLine(int fileHandle, char* destBuffer, int numBytes)=0;
|
||||
virtual int getFileSize(int fileHandle)=0;
|
||||
|
||||
};
|
||||
|
||||
#endif //COMMON_FILE_IO_INTERFACE_H
|
||||
Reference in New Issue
Block a user