F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
13namespace 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);
31
32 void registerWriteInterceptor(WriteInterceptor funcPtr, void* ptr);
34
35 void registerOpenInterceptor(OpenInterceptor funcPtr, void* ptr);
37
38 void registerSeekInterceptor(SeekInterceptor funcPtr, void* ptr);
40
41 void setLastError(NATIVE_INT_TYPE error);
42
43}
44
45
46#endif /* STUBS_FILESTUBS_HPP_ */
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
Definition File.cpp:6
void registerReadInterceptor(ReadInterceptor funcPtr, void *ptr)
Definition FileStub.cpp:31
bool(* OpenInterceptor)(Os::File::Status &status, const char *fileName, Os::File::Mode mode, void *ptr)
Definition FileStubs.hpp:24
void clearWriteInterceptor()
Definition FileStub.cpp:45
void clearSeekInterceptor()
Definition FileStub.cpp:63
void registerSeekInterceptor(SeekInterceptor funcPtr, void *ptr)
Definition FileStub.cpp:58
void setLastError(NATIVE_INT_TYPE error)
Definition FileStub.cpp:67
void registerWriteInterceptor(WriteInterceptor funcPtr, void *ptr)
Definition FileStub.cpp:40
bool(* WriteInterceptor)(Os::File::Status &status, const void *buffer, NATIVE_INT_TYPE &size, bool waitForDone, void *ptr)
Definition FileStubs.hpp:26
void registerOpenInterceptor(OpenInterceptor funcPtr, void *ptr)
Definition FileStub.cpp:49
bool(* SeekInterceptor)(Os::File::Status &status, NATIVE_INT_TYPE offset, bool absolute, void *ptr)
Definition FileStubs.hpp:27
void clearReadInterceptor()
Definition FileStub.cpp:36
void clearOpenInterceptor()
Definition FileStub.cpp:54
bool(* ReadInterceptor)(Os::File::Status &status, void *buffer, NATIVE_INT_TYPE &size, bool waitForFull, void *ptr)
Definition FileStubs.hpp:25