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

#include <Os/Directory.hpp>

Public Types

enum  Status {
  OP_OK , DOESNT_EXIST , NO_PERMISSION , NOT_OPENED ,
  NOT_DIR , NO_MORE_FILES , OTHER_ERROR
}
 

Public Member Functions

 Directory ()
 Constructor. More...
 
virtual ~Directory ()
 Destructor. Will close directory if still open. More...
 
Status open (const char *dirName)
 open directory. Directory must already exist More...
 
bool isOpen ()
 check if file descriptor is open or not. More...
 
Status rewind ()
 rewind directory stream to the beginning More...
 
Status read (char *fileNameBuffer, U32 bufSize)
 get next filename from directory More...
 
Status read (char *fileNameBuffer, U32 bufSize, I64 &inode)
 get next filename and inode from directory More...
 
void close ()
 close directory More...
 
NATIVE_INT_TYPE getLastError ()
 read back last error code (typically errno) More...
 
const char * getLastErrorString ()
 get a string of the last error (typically from strerror) More...
 

Detailed Description

Definition at line 10 of file Directory.hpp.

Member Enumeration Documentation

◆ Status

Enumerator
OP_OK 

Operation was successful.

DOESNT_EXIST 

Directory doesn't exist.

NO_PERMISSION 

No permission to read directory.

NOT_OPENED 

Directory hasn't been opened yet.

NOT_DIR 

Path is not a directory.

NO_MORE_FILES 

Directory stream has no more files.

OTHER_ERROR 

A catch-all for other errors. Have to look in implementation-specific code.

Definition at line 13 of file Directory.hpp.

Constructor & Destructor Documentation

◆ Directory()

Os::Directory::Directory ( )

Constructor.

Definition at line 16 of file Directory.cpp.

◆ ~Directory()

Os::Directory::~Directory ( )
virtual

Destructor. Will close directory if still open.

Definition at line 19 of file Directory.cpp.

Member Function Documentation

◆ close()

void Os::Directory::close ( )

close directory

Definition at line 119 of file Directory.cpp.

◆ getLastError()

NATIVE_INT_TYPE Os::Directory::getLastError ( )

read back last error code (typically errno)

Definition at line 127 of file Directory.cpp.

◆ getLastErrorString()

const char * Os::Directory::getLastErrorString ( )

get a string of the last error (typically from strerror)

Definition at line 131 of file Directory.cpp.

◆ isOpen()

bool Os::Directory::isOpen ( )

check if file descriptor is open or not.

Definition at line 115 of file Directory.cpp.

◆ open()

Directory::Status Os::Directory::open ( const char *  dirName)

open directory. Directory must already exist

Definition at line 23 of file Directory.cpp.

◆ read() [1/2]

Directory::Status Os::Directory::read ( char *  fileNameBuffer,
U32  bufSize 
)

get next filename from directory

Definition at line 68 of file Directory.cpp.

◆ read() [2/2]

Directory::Status Os::Directory::read ( char *  fileNameBuffer,
U32  bufSize,
I64 &  inode 
)

get next filename and inode from directory

Definition at line 75 of file Directory.cpp.

◆ rewind()

Directory::Status Os::Directory::rewind ( )

rewind directory stream to the beginning

Definition at line 52 of file Directory.cpp.


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