FIX::FileStore Class Reference

File based implementation of MessageStore. More...

`#include <FileStore.h>`

Inheritance diagram for FIX::FileStore:
[legend]
Collaboration diagram for FIX::FileStore:
[legend]

## Public Member Functions

| FileStore (std::string, const SessionID &s)
virtual | ~FileStore ()
bool | set (int, const std::string &) throw ( IOException )
void | get (int, int, std::vector< std::string > &) const throw ( IOException )
int | getNextSenderMsgSeqNum () const throw ( IOException )
int | getNextTargetMsgSeqNum () const throw ( IOException )
void | setNextSenderMsgSeqNum (int value) throw ( IOException )
void | setNextTargetMsgSeqNum (int value) throw ( IOException )
void | incrNextSenderMsgSeqNum () throw ( IOException )
void | incrNextTargetMsgSeqNum () throw ( IOException )
UtcTimeStamp | getCreationTime () const throw ( IOException )
void | reset () throw ( IOException )
void | refresh () throw ( IOException )
Public Member Functions inherited from FIX::MessageStore
virtual | ~MessageStore ()

## Private Types

typedef std::pair< int, int > | OffsetSize
typedef std::map< int, OffsetSize > | NumToOffset

## Private Member Functions

void | open (bool deleteFile)
void | populateCache ()
bool | readFromFile (int offset, int size, std::string &msg)
void | setSeqNum ()
void | setSession ()
bool | get (int, std::string &) const throw ( IOException )

## Private Attributes

MemoryStore | m_cache
NumToOffset | m_offsets
std::string | m_msgFileName
std::string | m_headerFileName
std::string | m_seqNumsFileName
std::string | m_sessionFileName
FILE * | m_msgFile
FILE * | m_headerFile
FILE * | m_seqNumsFile
FILE * | m_sessionFile

## Detailed Description

File based implementation of MessageStore.

Four files are created by this implementation. One for storing outgoing messages, one for indexing message locations, one for storing sequence numbers, and one for storing the session creation time.

The formats of the files are:
[path]+[BeginString]-[SenderCompID]-[TargetCompID].body
[path]+[BeginString]-[SenderCompID]-[TargetCompID].header
[path]+[BeginString]-[SenderCompID]-[TargetCompID].seqnums
[path]+[BeginString]-[SenderCompID]-[TargetCompID].session

The messages file is a pure stream of FIX messages.
The sequence number file is in the format of
[SenderMsgSeqNum] : [TargetMsgSeqNum]
The session file is a UTC timestamp in the format of
YYYYMMDD-HH:MM:SS

Definition at line 81 of file FileStore.h.

## Member Typedef Documentation

## NumToOffset

typedef std::map< int, OffsetSize > FIX::FileStore::NumToOffset

private

Definition at line 104 of file FileStore.h.

## OffsetSize

typedef std::pair< int, int > FIX::FileStore::OffsetSize

private

Definition at line 103 of file FileStore.h.

## Constructor & Destructor Documentation

## FileStore()

FIX::FileStore::FileStore | ( | std::string | path,
|  | const SessionID & | s
| ) |  |

Definition at line 34 of file FileStore.cpp.

References FIX::file_appendpath(), FIX::file_mkdir(), FIX::SessionID::getBeginString(), FIX::SessionID::getSenderCompID(), FIX::SessionID::getSessionQualifier(), FIX::SessionID::getTargetCompID(), m_headerFileName, m_msgFileName, m_seqNumsFileName, m_sessionFileName, and open().

Referenced by FIX::FileStoreFactory::create().

: m_msgFile( 0 ), m_headerFile( 0 ), m_seqNumsFile( 0 ), m_sessionFile( 0 )
{
file_mkdir( path.c_str() );
if ( path.empty() ) path = ".";
const std::string& begin =
s.getBeginString().getString();
const std::string& sender =
s.getSenderCompID().getString();
const std::string& target =
s.getTargetCompID().getString();
const std::string& qualifier =
s.getSessionQualifier();
std::string sessionid = begin + "-" + sender + "-" + target;
if( qualifier.size() )
sessionid += "-" + qualifier;
std::string prefix
= file_appendpath(path, sessionid + ".");
m_msgFileName = prefix + "body";
m_headerFileName = prefix + "header";
m_seqNumsFileName = prefix + "seqnums";
m_sessionFileName = prefix + "session";
try
{
open( false );
}
catch ( IOException & e )
{
throw ConfigError( e.what() );
}
}
FIX::FileStore::m_sessionFileName
std::string m_sessionFileName
Definition: FileStore.h:120
FIX::FileStore::m_msgFileName
std::string m_msgFileName
Definition: FileStore.h:117
FIX::FileStore::m_msgFile
FILE * m_msgFile
Definition: FileStore.h:122
FIX::file_appendpath
std::string file_appendpath(const std::string &path, const std::string &file)
Definition: Utility.cpp:529
FIX::FileStore::open
void open(bool deleteFile)
Definition: FileStore.cpp:79
FIX::FileStore::m_headerFileName
std::string m_headerFileName
Definition: FileStore.h:118
FIX::file_mkdir
void file_mkdir(const char *path)
Definition: Utility.cpp:467
FIX::FileStore::m_sessionFile
FILE * m_sessionFile
Definition: FileStore.h:125
FIX::FileStore::m_headerFile
FILE * m_headerFile
Definition: FileStore.h:123
FIX::FileStore::m_seqNumsFile
FILE * m_seqNumsFile
Definition: FileStore.h:124
FIX::FileStore::m_seqNumsFileName
std::string m_seqNumsFileName
Definition: FileStore.h:119

## ~FileStore()

FIX::FileStore::~FileStore | ( |  | ) |

virtual

Definition at line 71 of file FileStore.cpp.

References m_headerFile, m_msgFile, m_seqNumsFile, and m_sessionFile.

{
if( m_msgFile ) fclose( m_msgFile );
if( m_headerFile ) fclose( m_headerFile );
if( m_seqNumsFile ) fclose( m_seqNumsFile );
if( m_sessionFile ) fclose( m_sessionFile );
}
FIX::FileStore::m_msgFile
FILE * m_msgFile
Definition: FileStore.h:122
FIX::FileStore::m_sessionFile
FILE * m_sessionFile
Definition: FileStore.h:125
FIX::FileStore::m_headerFile
FILE * m_headerFile
Definition: FileStore.h:123
FIX::FileStore::m_seqNumsFile
FILE * m_seqNumsFile
Definition: FileStore.h:124

## Member Function Documentation

## get() [1/2]

void FIX::FileStore::get | ( | int | begin,
|  | int | end,
|  | std::vector< std::string > & | result
| ) |  | const
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 210 of file FileStore.cpp.

{
result.clear();
std::string msg;
for ( int i = begin; i <= end; ++i )
{
if ( get( i, msg ) )
result.push_back( msg );
}
}

## get() [2/2]

bool FIX::FileStore::get | ( | int | msgSeqNum,
|  | std::string & | msg
| ) |  | const
throw | ( | IOException
| ) |  |

private

Definition at line 311 of file FileStore.cpp.

References m_msgFile, m_msgFileName, and m_offsets.

{
NumToOffset::const_iterator find = m_offsets.find( msgSeqNum );
if ( find == m_offsets.end() ) return false;
const OffsetSize& offset = find->second;
if ( fseek( m_msgFile, offset.first, SEEK_SET ) )
throw IOException( "Unable to seek in file " + m_msgFileName );
char* buffer = new char[ offset.second + 1 ];
size_t result = fread( buffer, sizeof( char ), offset.second, m_msgFile );
if ( ferror( m_msgFile ) || result != (size_t)offset.second )
{
delete [] buffer;
throw IOException( "Unable to read from file " + m_msgFileName );
}
buffer[ offset.second ] = 0;
msg = buffer;
delete [] buffer;
return true;
}
FIX::FileStore::m_msgFileName
std::string m_msgFileName
Definition: FileStore.h:117
FIX::FileStore::m_msgFile
FILE * m_msgFile
Definition: FileStore.h:122
FIX::FileStore::m_offsets
NumToOffset m_offsets
Definition: FileStore.h:115
FIX::FileStore::OffsetSize
std::pair< int, int > OffsetSize
Definition: FileStore.h:103

## getCreationTime()

UtcTimeStamp FIX::FileStore::getCreationTime | ( |  | ) | const
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 257 of file FileStore.cpp.

References FIX::MemoryStore::getCreationTime(), and m_cache.

{
return m_cache.getCreationTime();
}
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::MemoryStore::getCreationTime
UtcTimeStamp getCreationTime() const
Definition: MessageStore.h:119

## getNextSenderMsgSeqNum()

int FIX::FileStore::getNextSenderMsgSeqNum | ( |  | ) | const
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 223 of file FileStore.cpp.

References FIX::MemoryStore::getNextSenderMsgSeqNum(), and m_cache.

Referenced by open(), and setSeqNum().

{
return m_cache.getNextSenderMsgSeqNum();
}
FIX::MemoryStore::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: MessageStore.h:104
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114

## getNextTargetMsgSeqNum()

int FIX::FileStore::getNextTargetMsgSeqNum | ( |  | ) | const
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 228 of file FileStore.cpp.

References FIX::MemoryStore::getNextTargetMsgSeqNum(), and m_cache.

Referenced by open(), and setSeqNum().

{
return m_cache.getNextTargetMsgSeqNum();
}
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::MemoryStore::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: MessageStore.h:106

## incrNextSenderMsgSeqNum()

void FIX::FileStore::incrNextSenderMsgSeqNum | ( |  | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 245 of file FileStore.cpp.

References FIX::MemoryStore::incrNextSenderMsgSeqNum(), m_cache, and setSeqNum().

{
m_cache.incrNextSenderMsgSeqNum();
setSeqNum();
}
FIX::MemoryStore::incrNextSenderMsgSeqNum
void incrNextSenderMsgSeqNum()
Definition: MessageStore.h:112
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::setSeqNum
void setSeqNum()
Definition: FileStore.cpp:289

## incrNextTargetMsgSeqNum()

void FIX::FileStore::incrNextTargetMsgSeqNum | ( |  | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 251 of file FileStore.cpp.

References FIX::MemoryStore::incrNextTargetMsgSeqNum(), m_cache, and setSeqNum().

{
m_cache.incrNextTargetMsgSeqNum();
setSeqNum();
}
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::MemoryStore::incrNextTargetMsgSeqNum
void incrNextTargetMsgSeqNum()
Definition: MessageStore.h:114
FIX::FileStore::setSeqNum
void setSeqNum()
Definition: FileStore.cpp:289

## open()

void FIX::FileStore::open | ( | bool | deleteFile | ) |

private

Definition at line 79 of file FileStore.cpp.

References FIX::file_fopen(), FIX::file_unlink(), getNextSenderMsgSeqNum(), getNextTargetMsgSeqNum(), m_headerFile, m_headerFileName, m_msgFile, m_msgFileName, m_seqNumsFile, m_seqNumsFileName, m_sessionFile, m_sessionFileName, populateCache(), setNextSenderMsgSeqNum(), setNextTargetMsgSeqNum(), and setSession().

Referenced by FileStore(), refresh(), and reset().

{
if ( m_msgFile ) fclose( m_msgFile );
if ( m_headerFile ) fclose( m_headerFile );
if ( m_seqNumsFile ) fclose( m_seqNumsFile );
if ( m_sessionFile ) fclose( m_sessionFile );
m_msgFile = 0;
m_headerFile = 0;
m_seqNumsFile = 0;
m_sessionFile = 0;
if ( deleteFile )
{
file_unlink( m_msgFileName.c_str() );
file_unlink( m_headerFileName.c_str() );
file_unlink( m_seqNumsFileName.c_str() );
file_unlink( m_sessionFileName.c_str() );
}
populateCache();
m_msgFile = file_fopen( m_msgFileName.c_str(), "r+" );
if ( !m_msgFile ) m_msgFile = file_fopen( m_msgFileName.c_str(), "w+" );
if ( !m_msgFile ) throw ConfigError( "Could not open body file: " + m_msgFileName );
m_headerFile = file_fopen( m_headerFileName.c_str(), "r+" );
if ( !m_headerFile ) m_headerFile = file_fopen( m_headerFileName.c_str(), "w+" );
if ( !m_headerFile ) throw ConfigError( "Could not open header file: " + m_headerFileName );
m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "r+" );
if ( !m_seqNumsFile ) m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "w+" );
if ( !m_seqNumsFile ) throw ConfigError( "Could not open seqnums file: " + m_seqNumsFileName );
bool setCreationTime = false;
m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r" );
if ( !m_sessionFile ) setCreationTime = true;
else fclose( m_sessionFile );
m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r+" );
if ( !m_sessionFile ) m_sessionFile = file_fopen( m_sessionFileName.c_str(), "w+" );
if ( !m_sessionFile ) throw ConfigError( "Could not open session file" );
if ( setCreationTime ) setSession();
setNextSenderMsgSeqNum( getNextSenderMsgSeqNum() );
setNextTargetMsgSeqNum( getNextTargetMsgSeqNum() );
}
FIX::FileStore::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: FileStore.cpp:223
FIX::FileStore::m_sessionFileName
std::string m_sessionFileName
Definition: FileStore.h:120
FIX::FileStore::m_msgFileName
std::string m_msgFileName
Definition: FileStore.h:117
FIX::FileStore::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int value)
Definition: FileStore.cpp:239
FIX::FileStore::m_msgFile
FILE * m_msgFile
Definition: FileStore.h:122
FIX::FileStore::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: FileStore.cpp:228
FIX::FileStore::populateCache
void populateCache()
Definition: FileStore.cpp:126
FIX::FileStore::m_headerFileName
std::string m_headerFileName
Definition: FileStore.h:118
FIX::FileStore::setSession
void setSession()
Definition: FileStore.cpp:300
FIX::file_unlink
void file_unlink(const char *path)
Definition: Utility.cpp:515
FIX::FileStore::m_sessionFile
FILE * m_sessionFile
Definition: FileStore.h:125
FIX::FileStore::setNextSenderMsgSeqNum
void setNextSenderMsgSeqNum(int value)
Definition: FileStore.cpp:233
FIX::FileStore::m_headerFile
FILE * m_headerFile
Definition: FileStore.h:123
FIX::file_fopen
FILE * file_fopen(const char *path, const char *mode)
Definition: Utility.cpp:487
FIX::FileStore::m_seqNumsFile
FILE * m_seqNumsFile
Definition: FileStore.h:124
FIX::FileStore::m_seqNumsFileName
std::string m_seqNumsFileName
Definition: FileStore.h:119

## populateCache()

void FIX::FileStore::populateCache | ( |  | ) |

private

Definition at line 126 of file FileStore.cpp.

References FIX::UtcTimeStampConvertor::convert(), FIX::file_fopen(), FILE_FSCANF, m_cache, m_headerFileName, m_offsets, m_seqNumsFileName, m_sessionFileName, FIX::MemoryStore::setCreationTime(), FIX::MemoryStore::setNextSenderMsgSeqNum(), and FIX::MemoryStore::setNextTargetMsgSeqNum().

Referenced by open().

{
FILE* headerFile = file_fopen( m_headerFileName.c_str(), "r+" );
if ( headerFile )
{
int num;
long offset;
size_t size;
while ( FILE_FSCANF( headerFile, "%d,%ld,%lu ", &num, &offset, &size ) == 3 )
m_offsets[ num ] = std::make_pair( offset, size );
fclose( headerFile );
}
FILE* seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "r+" );
if ( seqNumsFile )
{
int sender, target;
if ( FILE_FSCANF( seqNumsFile, "%d : %d", &sender, &target ) == 2 )
{
m_cache.setNextSenderMsgSeqNum( sender );
m_cache.setNextTargetMsgSeqNum( target );
}
fclose( seqNumsFile );
}
FILE* sessionFile = file_fopen( m_sessionFileName.c_str(), "r+" );
if ( sessionFile )
{
char time[ 22 ];
#ifdef HAVE_FSCANF_S
int result = FILE_FSCANF( sessionFile, "%s", time, 22 );
#else
int result = FILE_FSCANF( sessionFile, "%s", time );
#endif
if( result == 1 )
{
m_cache.setCreationTime( UtcTimeStampConvertor::convert( time, true ) );
}
fclose( sessionFile );
}
}
FIX::FileStore::m_sessionFileName
std::string m_sessionFileName
Definition: FileStore.h:120
FIX::UtcTimeStampConvertor::convert
static std::string convert(const UtcTimeStamp &value, bool showMilliseconds=false)
Definition: FieldConvertors.h:566
FILE_FSCANF
#define FILE_FSCANF
Definition: Utility.h:189
FIX::MemoryStore::setNextSenderMsgSeqNum
void setNextSenderMsgSeqNum(int value)
Definition: MessageStore.h:108
FIX::MemoryStore::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int value)
Definition: MessageStore.h:110
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::m_headerFileName
std::string m_headerFileName
Definition: FileStore.h:118
FIX::file_fopen
FILE * file_fopen(const char *path, const char *mode)
Definition: Utility.cpp:487
FIX::FileStore::m_offsets
NumToOffset m_offsets
Definition: FileStore.h:115
FIX::MemoryStore::setCreationTime
void setCreationTime(const UtcTimeStamp &creationTime)
Definition: MessageStore.h:117
FIX::FileStore::m_seqNumsFileName
std::string m_seqNumsFileName
Definition: FileStore.h:119

## readFromFile()

bool FIX::FileStore::readFromFile | ( | int | offset,
|  | int | size,
|  | std::string & | msg
| ) |  |

private

## refresh()

void FIX::FileStore::refresh | ( |  | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 276 of file FileStore.cpp.

References m_cache, open(), and FIX::MemoryStore::reset().

{
try
{
m_cache.reset();
open( false );
}
catch( std::exception& e )
{
throw IOException( e.what() );
}
}
FIX::FileStore::open
void open(bool deleteFile)
Definition: FileStore.cpp:79
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::MemoryStore::reset
void reset()
Definition: MessageStore.h:122

## reset()

void FIX::FileStore::reset | ( |  | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 262 of file FileStore.cpp.

References m_cache, open(), FIX::MemoryStore::reset(), and setSession().

{
try
{
m_cache.reset();
open( true );
setSession();
}
catch( std::exception& e )
{
throw IOException( e.what() );
}
}
FIX::FileStore::open
void open(bool deleteFile)
Definition: FileStore.cpp:79
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::setSession
void setSession()
Definition: FileStore.cpp:300
FIX::MemoryStore::reset
void reset()
Definition: MessageStore.h:122

## set()

bool FIX::FileStore::set | ( | int | msgSeqNum,
|  | const std::string & | msg
| ) |  |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 184 of file FileStore.cpp.

References m_headerFile, m_headerFileName, m_msgFile, m_msgFileName, and m_offsets.

{
if ( fseek( m_msgFile, 0, SEEK_END ) )
throw IOException( "Cannot seek to end of " + m_msgFileName );
if ( fseek( m_headerFile, 0, SEEK_END ) )
throw IOException( "Cannot seek to end of " + m_headerFileName );
long offset = ftell( m_msgFile );
if ( offset < 0 )
throw IOException( "Unable to get file pointer position from " + m_msgFileName );
size_t size = msg.size();
if ( fprintf( m_headerFile, "%d,%ld,%lu ", msgSeqNum, offset, size ) < 0 )
throw IOException( "Unable to write to file " + m_headerFileName );
m_offsets[ msgSeqNum ] = std::make_pair( offset, size );
fwrite( msg.c_str(), sizeof( char ), msg.size(), m_msgFile );
if ( ferror( m_msgFile ) )
throw IOException( "Unable to write to file " + m_msgFileName );
if ( fflush( m_msgFile ) == EOF )
throw IOException( "Unable to flush file " + m_msgFileName );
if ( fflush( m_headerFile ) == EOF )
throw IOException( "Unable to flush file " + m_headerFileName );
return true;
}
FIX::FileStore::m_msgFileName
std::string m_msgFileName
Definition: FileStore.h:117
FIX::FileStore::m_msgFile
FILE * m_msgFile
Definition: FileStore.h:122
FIX::FileStore::m_headerFileName
std::string m_headerFileName
Definition: FileStore.h:118
FIX::FileStore::m_headerFile
FILE * m_headerFile
Definition: FileStore.h:123
FIX::FileStore::m_offsets
NumToOffset m_offsets
Definition: FileStore.h:115

## setNextSenderMsgSeqNum()

void FIX::FileStore::setNextSenderMsgSeqNum | ( | int | value | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 233 of file FileStore.cpp.

References m_cache, FIX::MemoryStore::setNextSenderMsgSeqNum(), and setSeqNum().

Referenced by open().

{
m_cache.setNextSenderMsgSeqNum( value );
setSeqNum();
}
FIX::MemoryStore::setNextSenderMsgSeqNum
void setNextSenderMsgSeqNum(int value)
Definition: MessageStore.h:108
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::setSeqNum
void setSeqNum()
Definition: FileStore.cpp:289

## setNextTargetMsgSeqNum()

void FIX::FileStore::setNextTargetMsgSeqNum | ( | int | value | ) |
throw | ( | IOException
| ) |  |

virtual

Implements FIX::MessageStore.

Definition at line 239 of file FileStore.cpp.

References m_cache, FIX::MemoryStore::setNextTargetMsgSeqNum(), and setSeqNum().

Referenced by open().

{
m_cache.setNextTargetMsgSeqNum( value );
setSeqNum();
}
FIX::MemoryStore::setNextTargetMsgSeqNum
void setNextTargetMsgSeqNum(int value)
Definition: MessageStore.h:110
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::setSeqNum
void setSeqNum()
Definition: FileStore.cpp:289

## setSeqNum()

void FIX::FileStore::setSeqNum | ( |  | ) |

private

Definition at line 289 of file FileStore.cpp.

References getNextSenderMsgSeqNum(), getNextTargetMsgSeqNum(), m_seqNumsFile, and m_seqNumsFileName.

Referenced by incrNextSenderMsgSeqNum(), incrNextTargetMsgSeqNum(), setNextSenderMsgSeqNum(), and setNextTargetMsgSeqNum().

{
rewind( m_seqNumsFile );
fprintf( m_seqNumsFile, "%10.10d : %10.10d",
getNextSenderMsgSeqNum(), getNextTargetMsgSeqNum() );
if ( ferror( m_seqNumsFile ) )
throw IOException( "Unable to write to file " + m_seqNumsFileName );
if ( fflush( m_seqNumsFile ) )
throw IOException( "Unable to flush file " + m_seqNumsFileName );
}
FIX::FileStore::getNextSenderMsgSeqNum
int getNextSenderMsgSeqNum() const
Definition: FileStore.cpp:223
FIX::FileStore::getNextTargetMsgSeqNum
int getNextTargetMsgSeqNum() const
Definition: FileStore.cpp:228
FIX::FileStore::m_seqNumsFile
FILE * m_seqNumsFile
Definition: FileStore.h:124
FIX::FileStore::m_seqNumsFileName
std::string m_seqNumsFileName
Definition: FileStore.h:119

## setSession()

void FIX::FileStore::setSession | ( |  | ) |

private

Definition at line 300 of file FileStore.cpp.

References FIX::UtcTimeStampConvertor::convert(), FIX::MemoryStore::getCreationTime(), m_cache, m_sessionFile, and m_sessionFileName.

Referenced by open(), and reset().

{
rewind( m_sessionFile );
fprintf( m_sessionFile, "%s",
UtcTimeStampConvertor::convert( m_cache.getCreationTime() ).c_str() );
if ( ferror( m_sessionFile ) )
throw IOException( "Unable to write to file " + m_sessionFileName );
if ( fflush( m_sessionFile ) )
throw IOException( "Unable to flush file " + m_sessionFileName );
}
FIX::FileStore::m_sessionFileName
std::string m_sessionFileName
Definition: FileStore.h:120
FIX::UtcTimeStampConvertor::convert
static std::string convert(const UtcTimeStamp &value, bool showMilliseconds=false)
Definition: FieldConvertors.h:566
FIX::FileStore::m_cache
MemoryStore m_cache
Definition: FileStore.h:114
FIX::FileStore::m_sessionFile
FILE * m_sessionFile
Definition: FileStore.h:125
FIX::MemoryStore::getCreationTime
UtcTimeStamp getCreationTime() const
Definition: MessageStore.h:119

## Member Data Documentation

## m_cache

MemoryStore FIX::FileStore::m_cache

private

Definition at line 114 of file FileStore.h.

Referenced by getCreationTime(), getNextSenderMsgSeqNum(), getNextTargetMsgSeqNum(), incrNextSenderMsgSeqNum(), incrNextTargetMsgSeqNum(), populateCache(), refresh(), reset(), setNextSenderMsgSeqNum(), setNextTargetMsgSeqNum(), and setSession().

## m_headerFile

FILE* FIX::FileStore::m_headerFile

private

Definition at line 123 of file FileStore.h.

Referenced by open(), set(), and ~FileStore().

## m_headerFileName

std::string FIX::FileStore::m_headerFileName

private

Definition at line 118 of file FileStore.h.

Referenced by FileStore(), open(), populateCache(), and set().

## m_msgFile

FILE* FIX::FileStore::m_msgFile

private

Definition at line 122 of file FileStore.h.

Referenced by get(), open(), set(), and ~FileStore().

## m_msgFileName

std::string FIX::FileStore::m_msgFileName

private

Definition at line 117 of file FileStore.h.

Referenced by FileStore(), get(), open(), and set().

## m_offsets

NumToOffset FIX::FileStore::m_offsets

private

Definition at line 115 of file FileStore.h.

Referenced by get(), populateCache(), and set().

## m_seqNumsFile

FILE* FIX::FileStore::m_seqNumsFile

private

Definition at line 124 of file FileStore.h.

Referenced by open(), setSeqNum(), and ~FileStore().

## m_seqNumsFileName

std::string FIX::FileStore::m_seqNumsFileName

private

Definition at line 119 of file FileStore.h.

Referenced by FileStore(), open(), populateCache(), and setSeqNum().

## m_sessionFile

FILE* FIX::FileStore::m_sessionFile

private

Definition at line 125 of file FileStore.h.

Referenced by open(), setSession(), and ~FileStore().

## m_sessionFileName

std::string FIX::FileStore::m_sessionFileName

private

Definition at line 120 of file FileStore.h.

Referenced by FileStore(), open(), populateCache(), and setSession().

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

- FileStore.h
- FileStore.cpp