F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
FileStubs.hpp
Go to the documentation of this file.
1 /*
2  * FileStubs.hpp
3  *
4  * Created on: Sep 28, 2015
5  * Author: tcanham
6  */
7 
8 #ifndef STUBS_FILESTUBS_HPP_
9 #define STUBS_FILESTUBS_HPP_
10 
11 #include <Os/File.hpp>
12 
13 namespace Os {
14 
15  // Interceptors are used to intercept calls to the Os::File methods.
16  // During a test, a callback can be registered with a pointer value
17  // that is returned with the subsequent call. The pointer can be used
18  // to store an instance of a test class to get back to the instance
19  // that is doing the testing. If the interceptor returns true,
20  // the regular call will be continued. This allows a particular
21  // read in a sequence of reads to be modified while allowing previous
22  // ones to complete normally.
23 
24  typedef bool (*OpenInterceptor)(Os::File::Status &status, const char* fileName, Os::File::Mode mode, void* ptr);
25  typedef bool (*ReadInterceptor)(Os::File::Status &status, void * buffer, NATIVE_INT_TYPE &size, bool waitForFull, void* ptr);
26  typedef bool (*WriteInterceptor)(Os::File::Status &status, const void * buffer, NATIVE_INT_TYPE &size, bool waitForDone, void* ptr);
27  typedef bool (*SeekInterceptor)(Os::File::Status &status, NATIVE_INT_TYPE offset, bool absolute, void* ptr);
28 
29  void registerReadInterceptor(ReadInterceptor funcPtr, void* ptr);
30  void clearReadInterceptor(void);
31 
32  void registerWriteInterceptor(WriteInterceptor funcPtr, void* ptr);
33  void clearWriteInterceptor(void);
34 
35  void registerOpenInterceptor(OpenInterceptor funcPtr, void* ptr);
36  void clearOpenInterceptor(void);
37 
38  void registerSeekInterceptor(SeekInterceptor funcPtr, void* ptr);
39  void clearSeekInterceptor(void);
40 
41  void setLastError(NATIVE_INT_TYPE error);
42 
43 }
44 
45 
46 #endif /* STUBS_FILESTUBS_HPP_ */
Os
Definition: File.cpp:7
Os::registerOpenInterceptor
void registerOpenInterceptor(OpenInterceptor funcPtr, void *ptr)
Definition: FileStub.cpp:50
Os::setLastError
void setLastError(NATIVE_INT_TYPE error)
Definition: FileStub.cpp:68
Os::clearReadInterceptor
void clearReadInterceptor(void)
Definition: FileStub.cpp:37
Os::clearOpenInterceptor
void clearOpenInterceptor(void)
Definition: FileStub.cpp:55
Os::ReadInterceptor
bool(* ReadInterceptor)(Os::File::Status &status, void *buffer, NATIVE_INT_TYPE &size, bool waitForFull, void *ptr)
Definition: FileStubs.hpp:25
Os::OpenInterceptor
bool(* OpenInterceptor)(Os::File::Status &status, const char *fileName, Os::File::Mode mode, void *ptr)
Definition: FileStubs.hpp:24
Os::registerSeekInterceptor
void registerSeekInterceptor(SeekInterceptor funcPtr, void *ptr)
Definition: FileStub.cpp:59
Os::SeekInterceptor
bool(* SeekInterceptor)(Os::File::Status &status, NATIVE_INT_TYPE offset, bool absolute, void *ptr)
Definition: FileStubs.hpp:27
Os::registerReadInterceptor
void registerReadInterceptor(ReadInterceptor funcPtr, void *ptr)
Definition: FileStub.cpp:32
Os::registerWriteInterceptor
void registerWriteInterceptor(WriteInterceptor funcPtr, void *ptr)
Definition: FileStub.cpp:41
File.hpp
Os::clearSeekInterceptor
void clearSeekInterceptor(void)
Definition: FileStub.cpp:64
Os::clearWriteInterceptor
void clearWriteInterceptor(void)
Definition: FileStub.cpp:46
Os::File::Status
Status
Definition: File.hpp:24
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
Os::WriteInterceptor
bool(* WriteInterceptor)(Os::File::Status &status, const void *buffer, NATIVE_INT_TYPE &size, bool waitForDone, void *ptr)
Definition: FileStubs.hpp:26
Os::File::Mode
Mode
Definition: File.hpp:14