F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Os::Posix::Directory::PosixDirectory Class Reference

Posix implementation of Os::Directory. More...

#include <Os/Posix/Directory.hpp>

Inheritance diagram for Os::Posix::Directory::PosixDirectory:
Os::DirectoryInterface

Public Member Functions

 PosixDirectory ()
 constructor More...
 
 ~PosixDirectory ()=default
 destructor More...
 
DirectoryHandlegetHandle () override
 return the underlying mutex handle (implementation specific) More...
 
Status open (const char *path, OpenMode mode) override
 Open or create a directory. More...
 
bool isOpen ()
 Check if Directory is open or not. More...
 
Status rewind () override
 Rewind directory stream. More...
 
Status read (char *fileNameBuffer, FwSizeType buffSize) override
 Get next filename from directory stream. More...
 
void close () override
 Close directory. More...
 
- Public Member Functions inherited from Os::DirectoryInterface
 DirectoryInterface ()=default
 default constructor More...
 
virtual ~DirectoryInterface ()=default
 default virtual destructor More...
 
 DirectoryInterface (const DirectoryInterface &other)=delete
 copy constructor is forbidden More...
 
DirectoryInterfaceoperator= (const DirectoryInterface &other)=delete
 assignment operator is forbidden More...
 

Additional Inherited Members

- Public Types inherited from Os::DirectoryInterface
enum  Status {
  OP_OK, DOESNT_EXIST, NO_PERMISSION, NOT_OPENED,
  NOT_DIR, NO_MORE_FILES, FILE_LIMIT, BAD_DESCRIPTOR,
  ALREADY_EXISTS, NOT_SUPPORTED, OTHER_ERROR
}
 
enum  OpenMode { READ, CREATE_IF_MISSING, CREATE_EXCLUSIVE, MAX_OPEN_MODE }
 
- Static Public Member Functions inherited from Os::DirectoryInterface
static DirectoryInterfacegetDelegate (DirectoryHandleStorage &aligned_new_memory)
 provide a pointer to a Directory delegate object More...
 

Detailed Description

Posix implementation of Os::Directory.

Posix implementation of DirectoryInterface for use as a delegate class handling error-only file operations.

Definition at line 21 of file Directory.hpp.

Constructor & Destructor Documentation

◆ PosixDirectory()

Os::Posix::Directory::PosixDirectory::PosixDirectory ( )

constructor

Definition at line 18 of file Directory.cpp.

◆ ~PosixDirectory()

Os::Posix::Directory::PosixDirectory::~PosixDirectory ( )
default

destructor

Member Function Documentation

◆ close()

void Os::Posix::Directory::PosixDirectory::close ( )
overridevirtual

Close directory.

Implements Os::DirectoryInterface.

Definition at line 91 of file Directory.cpp.

◆ getHandle()

DirectoryHandle * Os::Posix::Directory::PosixDirectory::getHandle ( )
overridevirtual

return the underlying mutex handle (implementation specific)

Returns
internal mutex handle representation

Implements Os::DirectoryInterface.

Definition at line 20 of file Directory.cpp.

◆ isOpen()

bool Os::Posix::Directory::PosixDirectory::isOpen ( )

Check if Directory is open or not.

Returns
true if Directory is open, false otherwise

◆ open()

PosixDirectory::Status Os::Posix::Directory::PosixDirectory::open ( const char *  path,
OpenMode  mode 
)
overridevirtual

Open or create a directory.

Using the path provided, this function will open or create a directory. Use OpenMode::READ to open an existing directory and error if the directory is not found Use OpenMode::CREATE_IF_MISSING to open a directory, creating the directory if it doesn't exist Use OpenMode::CREATE_EXCLUSIVE to open a directory, creating the directory and erroring if it already exists

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

Parameters
pathpath of directory to open
modeenum (READ, CREATE_IF_MISSING, CREATE_EXCLUSIVE). See notes above for more information
Returns
status of the operation

Implements Os::DirectoryInterface.

Definition at line 24 of file Directory.cpp.

◆ read()

PosixDirectory::Status Os::Posix::Directory::PosixDirectory::read ( char *  fileNameBuffer,
FwSizeType  buffSize 
)
overridevirtual

Get next filename from directory stream.

Writes at most buffSize characters of the file name to fileNameBuffer. This function skips the current directory (.) and parent directory (..) entries. Returns NO_MORE_FILES if there are no more files to read from the buffer.

It is invalid to pass nullptr as fileNameBuffer.

Parameters
fileNameBufferbuffer to store filename
buffSizesize of fileNameBuffer
Returns
status of the operation

Implements Os::DirectoryInterface.

Definition at line 59 of file Directory.cpp.

◆ rewind()

PosixDirectory::Status Os::Posix::Directory::PosixDirectory::rewind ( )
overridevirtual

Rewind directory stream.

Each read operation moves the seek position forward. This function resets the seek position to the beginning.

Returns
status of the operation

Implements Os::DirectoryInterface.

Definition at line 52 of file Directory.cpp.


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