ApparatusFramework::FileMgr Class Reference
[Device Services]

#include <DeviceServices/common/current/include/FileMgr.h>

List of all members.

Classes

struct  FileMgrEntry

Public Member Functions

void initialize ()
void startup ()
Fileopen (const char *fileName, const char *mode)
Filecreate (const char *fileName, const char *mode, const int32 version)
int32 remove (const char *fileName)
int32 mountFileSystem (FileSystem *pFileSys, const char *directoryName)
int32 unmountFileSystem (const char *directoryName)

Static Public Member Functions

static FileMgrCreate ()
static FileMgrDefault ()
static bool IsCreated ()

Detailed Description

FileMgr Provides a central point to open, create or remove files. The actual file operations are not done by this manager, they are passed on to the correct file system. No one should directly instantiate files. They may be fetched with the help of this manager. This guarantees that no conflicts happen and no file is used twice. The file manager is a singleton.

Definition at line 81 of file FileMgr.h.


Member Function Documentation

File* ApparatusFramework::FileMgr::create ( const char *  fileName,
const char *  mode,
const int32  version 
)

Creates a file by its name. The file name has to contain the path according to UNIX conventions (e.g. /eeprom/myfile.txt).

Parameters:
fileName The absolute path and filename (no relative paths)
mode Specifies read "r" or write "w" access, according to ANSI C conventions.
version The version of this file. Useful when the format of the stored information changes.
Returns:
File The created file, or null if the file already exist or could not be created.
static FileMgr* ApparatusFramework::FileMgr::Create (  )  [static]

singleton methods Creates an instance of the singleton if none exists yet. The object is created in static memory.

Returns:
A pointer to the created singleton instance.
static FileMgr* ApparatusFramework::FileMgr::Default (  )  [static]

References an instance that has been previously created.

Returns:
A pointer to the singleton instance.
void ApparatusFramework::FileMgr::initialize (  ) 

Factory startup pattern Initializes the FileMgr accordingly to the factory startup pattern.

static bool ApparatusFramework::FileMgr::IsCreated (  )  [static]

States whether an instance of this singleton has been created.

Returns:
True if an instance has been created, false otherwise.
int32 ApparatusFramework::FileMgr::mountFileSystem ( FileSystem pFileSys,
const char *  directoryName 
)

Mounting methods Mounts a file system at the specified directory. Files can be opened or created only after a file system is mounted.

Parameters:
pFileSys Pointer to the file system.
directoryName Path under which the file system should be mounted. The name has to follow UNIX conventions (e.g. /eeprom). If an empty string is specified, the file system is mounted as root.
Returns:
Status of the method. See FileMgrReturnCodes
File* ApparatusFramework::FileMgr::open ( const char *  fileName,
const char *  mode 
)

File access methods Opens a file by its name. The file name has to contain the path according to UNIX conventions (e.g. /eeprom/myfile.txt).

Parameters:
fileName The absolute path and filename (no relative paths)
mode Specifies read "r" or write "w" access, according to ANSI C conventions.
Returns:
File The requested file, or null if the file does not exist or is already in use.
int32 ApparatusFramework::FileMgr::remove ( const char *  fileName  ) 

Removes the specified file. The file name has to contain the path according to UNIX conventions (e.g. /eeprom/myfile.txt).

Parameters:
fileName The absolute path and filename (no relative paths)
Returns:
Status of the method. See FileMgrReturnCodes
void ApparatusFramework::FileMgr::startup (  ) 

Starts up the FileMgr accordingly to the factory startup pattern.

int32 ApparatusFramework::FileMgr::unmountFileSystem ( const char *  directoryName  ) 

Unmount the file system at the specified directory. This function is mainly provided for completeness.

Parameters:
directoryName Path under which the file system was mounted. The name has to follow UNIX conventions (e.g. /eeprom). If an empty string is specified, the root file system is unmounted.
Returns:
Status of the method. See FileMgrReturnCodes
© 2004-2010 bbv Software Services AG / Apparatus Services