F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Os::Stub::File::StubFile Class Reference

stub implementation of Os::File More...

#include <Os/Stub/File.hpp>

Inheritance diagram for Os::Stub::File::StubFile:
Os::FileInterface

Public Member Functions

 StubFile ()=default
 constructor More...
 
 ~StubFile () override=default
 destructor More...
 
Os::FileInterface::Status open (const char *path, Mode mode, OverwriteType overwrite) override
 open file with supplied path and mode More...
 
void close () override
 close the file, if not opened then do nothing More...
 
Status size (FwSignedSizeType &size_result) override
 get size of currently open file More...
 
Status position (FwSignedSizeType &position_result) override
 get file pointer position of the currently open file More...
 
Status preallocate (FwSignedSizeType offset, FwSignedSizeType length) override
 pre-allocate file storage More...
 
Status seek (FwSignedSizeType offset, SeekType seekType) override
 seek the file pointer to the given offset More...
 
Status flush () override
 flush file contents to storage More...
 
Status read (U8 *buffer, FwSignedSizeType &size, WaitType wait) override
 read data from this file into supplied buffer bounded by size More...
 
Status write (const U8 *buffer, FwSignedSizeType &size, WaitType wait) override
 read data from this file into supplied buffer bounded by size More...
 
FileHandlegetHandle () override
 returns the raw file handle More...
 
- Public Member Functions inherited from Os::FileInterface
virtual ~FileInterface ()=default
 

Additional Inherited Members

- Public Types inherited from Os::FileInterface
enum  Mode {
  OPEN_NO_MODE , OPEN_READ , OPEN_CREATE , OPEN_WRITE ,
  OPEN_SYNC_WRITE , OPEN_APPEND , MAX_OPEN_MODE
}
 
enum  Status {
  OP_OK , DOESNT_EXIST , NO_SPACE , NO_PERMISSION ,
  BAD_SIZE , NOT_OPENED , FILE_EXISTS , NOT_SUPPORTED ,
  INVALID_MODE , INVALID_ARGUMENT , OTHER_ERROR , MAX_STATUS
}
 
enum  OverwriteType { NO_OVERWRITE , OVERWRITE , MAX_OVERWRITE_TYPE }
 
enum  SeekType { RELATIVE , ABSOLUTE , MAX_SEEK_TYPE }
 
enum  WaitType { NO_WAIT , WAIT , MAX_WAIT_TYPE }
 
- Static Public Member Functions inherited from Os::FileInterface
static FileInterfacegetDelegate (FileHandleStorage &aligned_placement_new_memory, const FileInterface *to_copy=nullptr)
 provide a pointer to a file delegate object More...
 

Detailed Description

stub implementation of Os::File

Stub implementation of FileInterface for use as a delegate class handling error-only file operations.

Definition at line 19 of file File.hpp.

Constructor & Destructor Documentation

◆ StubFile()

Os::Stub::File::StubFile::StubFile ( )
default

constructor

◆ ~StubFile()

Os::Stub::File::StubFile::~StubFile ( )
overridedefault

destructor

Member Function Documentation

◆ close()

void Os::Stub::File::StubFile::close ( )
overridevirtual

close the file, if not opened then do nothing

This implementation does nothing.

Implements Os::FileInterface.

Definition at line 16 of file File.cpp.

◆ flush()

StubFile::Status Os::Stub::File::StubFile::flush ( )
overridevirtual

flush file contents to storage

This implementation does nothing but return NOT_IMPLEMENTED.

Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 38 of file File.cpp.

◆ getHandle()

FileHandle * Os::Stub::File::StubFile::getHandle ( )
overridevirtual

returns the raw file handle

Gets the raw file handle from the implementation. Note: users must include the implementation specific header to make any real use of this handle. Otherwise it//!must* be passed as an opaque type.

Returns
raw file handle

Implements Os::FileInterface.

Definition at line 53 of file File.cpp.

◆ open()

StubFile::Status Os::Stub::File::StubFile::open ( const char *  path,
StubFile::Mode  open_mode,
OverwriteType  overwrite 
)
overridevirtual

open file with supplied path and mode

This implementation does nothing but return NOT_IMPLEMENTED.

It is invalid to send nullptr as the path. It is invalid to supply mode as a non-enumerated value. It is invalid to supply overwrite as a non-enumerated value.

Parameters
pathc-string of path to open
modefile operation mode
overwriteoverwrite existing file on create
Returns
: NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 11 of file File.cpp.

◆ position()

StubFile::Status Os::Stub::File::StubFile::position ( FwSignedSizeType position_result)
overridevirtual

get file pointer position of the currently open file

This implementation does nothing but return NOT_IMPLEMENTED.

Parameters
positionoutput parameter for size.
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 23 of file File.cpp.

◆ preallocate()

StubFile::Status Os::Stub::File::StubFile::preallocate ( FwSignedSizeType  offset,
FwSignedSizeType  length 
)
overridevirtual

pre-allocate file storage

This implementation does nothing but return NOT_IMPLEMENTED.

It is invalid to pass a negative offset. It is invalid to pass a negative length.

Parameters
offsetoffset into file
lengthlength after offset to preallocate
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 28 of file File.cpp.

◆ read()

StubFile::Status Os::Stub::File::StubFile::read ( U8 buffer,
FwSignedSizeType size,
StubFile::WaitType  wait 
)
overridevirtual

read data from this file into supplied buffer bounded by size

This implementation does nothing but return NOT_IMPLEMENTED.

It is invalid to pass nullptr to this function call. It is invalid to pass a negative size. It is invalid to supply wait as a non-enumerated value.

Parameters
buffermemory location to store data read from file
sizesize of data to read
waitWAIT to wait for data, NO_WAIT to return what is currently available
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 43 of file File.cpp.

◆ seek()

StubFile::Status Os::Stub::File::StubFile::seek ( FwSignedSizeType  offset,
SeekType  seekType 
)
overridevirtual

seek the file pointer to the given offset

This implementation does nothing but return NOT_IMPLEMENTED.

Parameters
offsetoffset to seek to
seekTypeABSOLUTE for seeking from beginning of file, CURRENT to use current position.
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 33 of file File.cpp.

◆ size()

StubFile::Status Os::Stub::File::StubFile::size ( FwSignedSizeType size_result)
overridevirtual

get size of currently open file

This implementation does nothing but return NOT_IMPLEMENTED.

Parameters
sizeoutput parameter for size.
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 18 of file File.cpp.

◆ write()

StubFile::Status Os::Stub::File::StubFile::write ( const U8 buffer,
FwSignedSizeType size,
StubFile::WaitType  wait 
)
overridevirtual

read data from this file into supplied buffer bounded by size

This implementation does nothing but return NOT_IMPLEMENTED.

It is invalid to pass nullptr to this function call. It is invalid to pass a negative size. It is invalid to supply wait as a non-enumerated value.

Parameters
buffermemory location to store data read from file
sizesize of data to read
waitWAIT to wait for data to write to disk, NO_WAIT to return what is currently available
Returns
NOT_IMPLEMENTED

Implements Os::FileInterface.

Definition at line 48 of file File.cpp.


The documentation for this class was generated from the following files: