F´ Flight Software - C/C++ Documentation  NASA-v2.0.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
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 (void)
 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 (void)
 close directory More...
 
NATIVE_INT_TYPE getLastError (void)
 read back last error code (typically errno) More...
 
const char * getLastErrorString (void)
 get a string of the last error (typically from strerror) More...
 

Detailed Description

Definition at line 11 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 14 of file Directory.hpp.

Constructor & Destructor Documentation

◆ Directory()

Os::Directory::Directory ( )

Constructor.

Definition at line 17 of file Directory.cpp.

◆ ~Directory()

Os::Directory::~Directory ( )
virtual

Destructor. Will close directory if still open.

Definition at line 20 of file Directory.cpp.

Member Function Documentation

◆ close()

void Os::Directory::close ( void  )

close directory

Definition at line 120 of file Directory.cpp.

◆ getLastError()

NATIVE_INT_TYPE Os::Directory::getLastError ( void  )

read back last error code (typically errno)

Definition at line 128 of file Directory.cpp.

◆ getLastErrorString()

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

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

Definition at line 132 of file Directory.cpp.

◆ isOpen()

bool Os::Directory::isOpen ( void  )

check if file descriptor is open or not.

Definition at line 116 of file Directory.cpp.

◆ open()

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

open directory. Directory must already exist

Definition at line 24 of file Directory.cpp.

◆ read() [1/2]

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

get next filename from directory

Definition at line 69 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 76 of file Directory.cpp.

◆ rewind()

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

rewind directory stream to the beginning

Definition at line 53 of file Directory.cpp.


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