MacroSpaceFile Class Reference

#include <LocalMacroSpaceManager.hpp>

Public Member Functions

 MacroSpaceFile (const char *name)
 
 ~MacroSpaceFile ()
 
void close ()
 
size_t openForLoading ()
 
void nextMacro (char *name, ManagedRxstring &image, size_t &order)
 
void nextMacro (NameTable names, char *name, ManagedRxstring &image, size_t &order)
 
void setFilePosition (size_t p)
 
void create (size_t count)
 
void writeMacroDescriptor (const char *name, size_t size, size_t order)
 
void read (void *data, size_t length)
 
void read (ManagedRxstring &data, size_t length)
 
void write (const void *data, size_t length)
 
void write (const char *str)
 
void write (size_t i)
 
void write (RXSTRING &data)
 

Protected Attributes

bool creating
 
const char * fileName
 
SysFilefileInst
 
size_t descriptorBase
 
size_t imageBase
 

Detailed Description

Definition at line 122 of file LocalMacroSpaceManager.hpp.

Constructor & Destructor Documentation

◆ MacroSpaceFile()

MacroSpaceFile::MacroSpaceFile ( const char *  name)
inline

Definition at line 125 of file LocalMacroSpaceManager.hpp.

◆ ~MacroSpaceFile()

MacroSpaceFile::~MacroSpaceFile ( )

Destructor to force the macro space file to close.

Definition at line 51 of file LocalMacroSpaceManager.cpp.

References SysFile::close(), creating, fileInst, and fileName.

Member Function Documentation

◆ close()

void MacroSpaceFile::close ( )

Explicitly close the macro space file.

Definition at line 71 of file LocalMacroSpaceManager.cpp.

References SysFile::close(), and fileInst.

Referenced by LocalMacroSpaceManager::loadMacroSpace(), and LocalMacroSpaceManager::saveMacroSpace().

◆ create()

void MacroSpaceFile::create ( size_t  count)

Create a macro space file with an initial header table for the indicated number of macros.

Parameters
countThe number of macros to store in the file.

Definition at line 195 of file LocalMacroSpaceManager.cpp.

References creating, FILE_CREATION_ERROR, fileInst, fileName, SysFile::open(), RX_O_CREAT, RX_O_TRUNC, RX_O_WRONLY, RX_S_IREAD, RX_S_IWRITE, RX_SH_DENYRW, and write().

Referenced by LocalMacroSpaceManager::saveMacroSpace().

◆ nextMacro() [1/2]

void MacroSpaceFile::nextMacro ( char *  name,
ManagedRxstring image,
size_t &  order 
)

Retrieve the next macro from the macrospace file.

Parameters
nameThe returned macro name.
imageThe macro image information.
orderThe macro ordering information.

Definition at line 124 of file LocalMacroSpaceManager.cpp.

References descriptorBase, imageBase, MacroSpaceDescriptor::imageSize, MacroSpaceDescriptor::name, MacroSpaceDescriptor::position, read(), and setFilePosition().

Referenced by LocalMacroSpaceManager::loadMacroSpace().

◆ nextMacro() [2/2]

void MacroSpaceFile::nextMacro ( NameTable  names,
char *  name,
ManagedRxstring image,
size_t &  order 
)

Step to the next macro, reading the information if it is in the target list.

Parameters
namesThe table of names.
nameThe returned name, if read.
imageThe macro image (if read).
orderThe macro order information.

Definition at line 148 of file LocalMacroSpaceManager.cpp.

References descriptorBase, imageBase, MacroSpaceDescriptor::imageSize, NameTable::inTable(), MacroSpaceDescriptor::name, MacroSpaceDescriptor::position, read(), and setFilePosition().

◆ openForLoading()

◆ read() [1/2]

void MacroSpaceFile::read ( ManagedRxstring data,
size_t  length 
)

Read a buffer of data into a managed RXSTRING structure.

Parameters
dataThe target RXSTRING
lengthThe length to read.

Definition at line 267 of file LocalMacroSpaceManager.cpp.

References ManagedRxstring::ensureCapacity(), read(), Rxstring::strlength, and Rxstring::strptr.

◆ read() [2/2]

void MacroSpaceFile::read ( void *  data,
size_t  length 
)

Read a buffer of data from the macrospace file.

Parameters
dataThe target data buffer.
lengthThe size to read.

Definition at line 250 of file LocalMacroSpaceManager.cpp.

References FILE_READ_ERROR, fileInst, and SysFile::read().

Referenced by nextMacro(), openForLoading(), and read().

◆ setFilePosition()

void MacroSpaceFile::setFilePosition ( size_t  p)

Explicitly set the file postion.

Parameters
pThe new file position.

Definition at line 179 of file LocalMacroSpaceManager.cpp.

References FILE_READ_ERROR, fileInst, and SysFile::seek().

Referenced by nextMacro().

◆ write() [1/4]

void MacroSpaceFile::write ( const char *  str)
inline

Definition at line 139 of file LocalMacroSpaceManager.hpp.

References write().

◆ write() [2/4]

void MacroSpaceFile::write ( const void *  data,
size_t  length 
)

Write a buffer of data to the macro file.

Parameters
dataThe data buffer pointer.
lengthThe length to write.

Definition at line 233 of file LocalMacroSpaceManager.cpp.

References FILE_WRITE_ERROR, fileInst, and SysFile::write().

Referenced by create(), LocalMacroSpaceManager::saveMacroSpace(), write(), and writeMacroDescriptor().

◆ write() [3/4]

void MacroSpaceFile::write ( RXSTRING data)
inline

Definition at line 149 of file LocalMacroSpaceManager.hpp.

References _RXSTRING::strlength, _RXSTRING::strptr, and write().

◆ write() [4/4]

void MacroSpaceFile::write ( size_t  i)
inline

Definition at line 144 of file LocalMacroSpaceManager.hpp.

References write().

◆ writeMacroDescriptor()

void MacroSpaceFile::writeMacroDescriptor ( const char *  name,
size_t  size,
size_t  order 
)

Write a macro descriptor out to the file.

Parameters
nameThe name of the macro to write.
sizeThe size of the macro being written.
orderThe macro order information.

Definition at line 219 of file LocalMacroSpaceManager.cpp.

References write().

Referenced by LocalMacroSpaceManager::saveMacroSpace().

Member Data Documentation

◆ creating

bool MacroSpaceFile::creating
protected

Definition at line 155 of file LocalMacroSpaceManager.hpp.

Referenced by create(), openForLoading(), and ~MacroSpaceFile().

◆ descriptorBase

size_t MacroSpaceFile::descriptorBase
protected

Definition at line 158 of file LocalMacroSpaceManager.hpp.

Referenced by nextMacro(), and openForLoading().

◆ fileInst

SysFile* MacroSpaceFile::fileInst
protected

◆ fileName

const char* MacroSpaceFile::fileName
protected

Definition at line 156 of file LocalMacroSpaceManager.hpp.

Referenced by create(), openForLoading(), and ~MacroSpaceFile().

◆ imageBase

size_t MacroSpaceFile::imageBase
protected

Definition at line 159 of file LocalMacroSpaceManager.hpp.

Referenced by nextMacro(), and openForLoading().


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