MXASupportFile Class Reference

This class serves as a container to hold the necessary information to read either the meta data about a support file from the HDF5 file or read the file from the filesystem. More...

Inherits ISupportFile.

Inheritance diagram for MXASupportFile:

Inheritance graph
[legend]
Collaboration diagram for MXASupportFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MXA_SHARED_POINTERS (MXASupportFile)
 MXA_TYPE_MACRO (MXASupportFile)
virtual ~MXASupportFile ()
virtual void setFileSystemPath (const std::string &filesystemPath)
 Sets the path to the file on the local filesystem.
virtual std::string getFileSystemPath ()
 Returns the path to the file on the local filesystem.
virtual void setFileType (const std::string &fileType)
 Sets the File type as a hint for viewers on how to render the file if possible. The default is "Binary". You may also use "Text".
virtual std::string getFileType ()
 Returns the file type.
virtual uint8 * getFilePointer (uint64 offset=0)
 Returns a pointer to the specified offset in the cached file. Note that if the file has NOT been read then this will return a NULL pointer.
virtual uint64 getFileSize ()
 Returns the size of the file which could be Zero if the file has NOT been read or can not be read.
virtual bool isFileCached ()
 Has the file been read into memory.
virtual int32 readFromFileSystem ()
 Read from the filesystem and cache the file into memory. Careful when doing this with large files.
virtual void flushCachedFile ()
 If the file is residing in memory, free the memory by unloading the file from memory.
virtual void setIndex (int index)
 Sets the internal value used by the MXA API to store the file in teh HDF5 file.
virtual int getIndex ()
 Returns the internal index used by the MXA API to store the file in the HDF5 file.
virtual int32 readFromMXAFile ()
 Reads file contents from the HDF5 file into memory. From this point you can write the file out to the local filesystem if needed.

Static Public Member Functions

static ISupportFile::Pointer NewFromFileSystem (const std::string &filesystempath, const std::string &filetype, bool cacheFile=false)
 Creates a new MXASupportFile object based on the path to a file on the local filesystem.
static ISupportFile::Pointer New ()
 Creates a new MXASupportFile object based on the meta data from the HDF5 file Creates a new MXASupportFile object with default values.

Protected Member Functions

 MXASupportFile ()
 MXASupportFile (int32 datafile, int index)

Private Member Functions

 MXASupportFile (const MXASupportFile &)
void operator= (const MXASupportFile &)

Private Attributes

std::string _filesystemPath
std::string _fileType
IMXAArray::Pointer _fileContents
int _index
int32 _fileId
int _source

Detailed Description

This class serves as a container to hold the necessary information to read either the meta data about a support file from the HDF5 file or read the file from the filesystem.

Author:
Mike Jackson for BlueQuartz Software
Date:
Sep 23, 2008
Version:
Revision
1.2


Constructor & Destructor Documentation

MXASupportFile::~MXASupportFile (  )  [virtual]

MXASupportFile::MXASupportFile (  )  [protected]

MXASupportFile::MXASupportFile ( int32  datafile,
int  index 
) [protected]

MXASupportFile::MXASupportFile ( const MXASupportFile  )  [private]


Member Function Documentation

MXASupportFile::MXA_SHARED_POINTERS ( MXASupportFile   ) 

MXASupportFile::MXA_TYPE_MACRO ( MXASupportFile   ) 

ISupportFile::Pointer MXASupportFile::NewFromFileSystem ( const std::string &  filesystempath,
const std::string &  filetype,
bool  cacheFile = false 
) [static]

Creates a new MXASupportFile object based on the path to a file on the local filesystem.

Parameters:
filesystempath The path to the file on the local filesystem
filetype Either "Text" or "Binary"
cacheFile False by default which means the actual reading of the file is put off until it is explicitly asked for. If you set this argument to "true" then the file is read immediately.
Returns:
A boost shared_ptr wrapping an instance of MXASupportFile. If something goes wrong during the initialization then it is possible to get a NULL pointer returned.

ISupportFile::Pointer MXASupportFile::New (  )  [static]

Creates a new MXASupportFile object based on the meta data from the HDF5 file Creates a new MXASupportFile object with default values.

void MXASupportFile::setFileSystemPath ( const std::string &  filesystemPath  )  [virtual]

Sets the path to the file on the local filesystem.

Parameters:
filesystemPath The path to the file on the local filesystem

Implements ISupportFile.

std::string MXASupportFile::getFileSystemPath (  )  [virtual]

Returns the path to the file on the local filesystem.

Implements ISupportFile.

void MXASupportFile::setFileType ( const std::string &  fileType  )  [virtual]

Sets the File type as a hint for viewers on how to render the file if possible. The default is "Binary". You may also use "Text".

Parameters:
fileType "Binary" or "Text"

Implements ISupportFile.

std::string MXASupportFile::getFileType (  )  [virtual]

Returns the file type.

Implements ISupportFile.

uint8 * MXASupportFile::getFilePointer ( uint64  offset = 0  )  [virtual]

Returns a pointer to the specified offset in the cached file. Note that if the file has NOT been read then this will return a NULL pointer.

Parameters:
offset The offset into the cached file to read.
Returns:
Pointer to the data at the specified offset.

Implements ISupportFile.

uint64 MXASupportFile::getFileSize (  )  [virtual]

Returns the size of the file which could be Zero if the file has NOT been read or can not be read.

Returns:
Size of the file.

Implements ISupportFile.

bool MXASupportFile::isFileCached (  )  [virtual]

Has the file been read into memory.

Returns:

Implements ISupportFile.

int32 MXASupportFile::readFromFileSystem (  )  [virtual]

Read from the filesystem and cache the file into memory. Careful when doing this with large files.

Returns:
Error code. Negative value indicates error.

Implements ISupportFile.

void MXASupportFile::flushCachedFile (  )  [virtual]

If the file is residing in memory, free the memory by unloading the file from memory.

Implements ISupportFile.

void MXASupportFile::setIndex ( int  index  )  [virtual]

Sets the internal value used by the MXA API to store the file in teh HDF5 file.

Parameters:
index The index to use.

Implements ISupportFile.

int MXASupportFile::getIndex (  )  [virtual]

Returns the internal index used by the MXA API to store the file in the HDF5 file.

Implements ISupportFile.

int32 MXASupportFile::readFromMXAFile (  )  [virtual]

Reads file contents from the HDF5 file into memory. From this point you can write the file out to the local filesystem if needed.

Returns:
Error code. Negative is an error.

Implements ISupportFile.

void MXASupportFile::operator= ( const MXASupportFile  )  [private]


Member Data Documentation

std::string MXASupportFile::_filesystemPath [private]

std::string MXASupportFile::_fileType [private]

IMXAArray::Pointer MXASupportFile::_fileContents [private]

int MXASupportFile::_index [private]

int32 MXASupportFile::_fileId [private]

int MXASupportFile::_source [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:15 2009 for MXADataModel by  doxygen 1.5.2