file.hpp
Go to the documentation of this file.
00001 //
00002 // File.hpp
00003 //
00004 // File reader.
00005 //
00006 // Sick AG
00007 //
00008 // HISTORY
00009 //
00010 // 1.0.0        2013-02-12, VWi
00011 //                      Initial version.
00012 //
00013 
00014 
00015 
00016 #ifndef FILE_HPP
00017 #define FILE_HPP
00018 
00019 #include "../BasicDatatypes.hpp"
00020 #include "../tools/Mutex.hpp"
00021 #include "../tools/SickThread.hpp"
00022 #include <list>
00023 // Ausgabestream und Kompression
00024 #include <iostream>
00025 #include <fstream>
00026 
00027 
00028 //
00029 // 
00030 //
00031 class File
00032 {
00033 public:
00034         File();
00035         ~File();
00036         
00037         std::string getFilename();
00038         void close();
00039         bool open(std::string inputFileName, bool beVerbose = false);
00040         
00041         // Read callback (for being called when data is available)
00042         typedef void (*ReadFunction)(void* obj, UINT8* inputBuffer, UINT32& numBytes);  //  ReadFunction
00043         void setReadCallbackFunction(ReadFunction readFunction, void* obj);
00044         
00045         // Information if the connection is disconnected.
00046         typedef void (*DisconnectFunction)(void* obj);                                                          //  Called on disconnect
00047         void setDisconnectCallbackFunction(DisconnectFunction discFunction, void* obj);
00048 
00049 
00050 private:
00051         bool m_beVerbose;
00052         
00053         // Thread stuff
00054         void startReadThread();
00055         void readThreadFunction(bool& endThread, UINT16& waitTimeMs);
00056         SickThread<File, &File::readThreadFunction> m_readThread;
00057         INT32 readInputData();
00058 
00059 
00060         // File
00061         std::string m_inputFileName;
00062         std::ifstream m_inputFileStream;        // input file stream
00063         Mutex m_inputFileMutex;
00064         
00065         // Callbacks
00066         ReadFunction m_readFunction;            // Receive callback
00067         void* m_readFunctionObjPtr;                     // Object of the Receive callback
00068         DisconnectFunction m_disconnectFunction;
00069         void* m_disconnectFunctionObjPtr;       // Object of the Disconect callback
00070 };
00071 
00072 #endif // FILE_HPP


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Wed Jun 14 2017 04:04:50