F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Directory.hpp
Go to the documentation of this file.
1#ifndef _Directory_hpp_
2#define _Directory_hpp_
3
4#include <FpConfig.hpp>
5
6namespace Os {
7
8 // This class encapsulates a very simple directory interface that has the most often-used features
9
10 class Directory {
11 public:
12
13 typedef enum {
21 } Status;
22
23 Directory();
24 virtual ~Directory();
25 Status open(const char* dirName);
26 bool isOpen();
27 Status rewind();
28
29 Status read(char * fileNameBuffer, U32 bufSize);
30 Status read(char * fileNameBuffer, U32 bufSize, I64& inode);
31 void close();
32
34 const char* getLastErrorString();
35
36 private:
37
38 POINTER_CAST m_dir;
39 NATIVE_INT_TYPE m_lastError;
40
41 };
42
43}
44
45#endif
PlatformPointerCastType POINTER_CAST
Definition BasicTypes.h:53
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
C++-compatible configuration header for fprime configuration.
@ OP_OK
Operation was successful.
Definition Directory.hpp:14
@ OTHER_ERROR
A catch-all for other errors. Have to look in implementation-specific code.
Definition Directory.hpp:20
@ NO_PERMISSION
No permission to read directory.
Definition Directory.hpp:16
@ NO_MORE_FILES
Directory stream has no more files.
Definition Directory.hpp:19
@ NOT_DIR
Path is not a directory.
Definition Directory.hpp:18
@ DOESNT_EXIST
Directory doesn't exist.
Definition Directory.hpp:15
@ NOT_OPENED
Directory hasn't been opened yet.
Definition Directory.hpp:17
bool isOpen()
check if file descriptor is open or not.
void close()
close directory
Status rewind()
rewind directory stream to the beginning
Definition Directory.cpp:52
Status read(char *fileNameBuffer, U32 bufSize)
get next filename from directory
Definition Directory.cpp:68
const char * getLastErrorString()
get a string of the last error (typically from strerror)
Status open(const char *dirName)
open directory. Directory must already exist
Definition Directory.cpp:23
NATIVE_INT_TYPE getLastError()
read back last error code (typically errno)
Directory()
Constructor.
Definition Directory.cpp:16
virtual ~Directory()
Destructor. Will close directory if still open.
Definition Directory.cpp:19
Definition File.cpp:6