Public Member Functions | Private Attributes
FIX::FileLogFactory Class Reference

Creates a file based implementation of Log. More...

#include <FileLog.h>

Inheritance diagram for FIX::FileLogFactory:
Inheritance graph
[legend]
Collaboration diagram for FIX::FileLogFactory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FileLogFactory (const SessionSettings &settings)
 FileLogFactory (const std::string &path)
 FileLogFactory (const std::string &path, const std::string &backupPath)
Logcreate ()
Logcreate (const SessionID &)
void destroy (Log *log)

Private Attributes

std::string m_path
std::string m_backupPath
SessionSettings m_settings
Logm_globalLog
int m_globalLogCount

Detailed Description

Creates a file based implementation of Log.

This stores all log events into flat files

Definition at line 40 of file FileLog.h.


Constructor & Destructor Documentation

FIX::FileLogFactory::FileLogFactory ( const SessionSettings settings) [inline]

Definition at line 43 of file FileLog.h.

: m_settings( settings ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::FileLogFactory ( const std::string &  path) [inline]

Definition at line 45 of file FileLog.h.

: m_path( path ), m_backupPath( path ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::FileLogFactory ( const std::string &  path,
const std::string &  backupPath 
) [inline]

Definition at line 47 of file FileLog.h.

: m_path( path ), m_backupPath( backupPath ), m_globalLog(0), m_globalLogCount(0) {};

Member Function Documentation

Implements FIX::LogFactory.

Definition at line 30 of file FileLog.cpp.

References FIX::FILE_LOG_BACKUP_PATH, FIX::FILE_LOG_PATH, FIX::SessionSettings::get(), FIX::Dictionary::getString(), FIX::Dictionary::has(), m_globalLog, m_globalLogCount, m_path, and m_settings.

{
  m_globalLogCount++;
  if( m_globalLogCount > 1 ) return m_globalLog;

  try
  {
    if ( m_path.size() ) return new FileLog( m_path );
    std::string path;
    std::string backupPath;

    Dictionary settings = m_settings.get();
    path = settings.getString( FILE_LOG_PATH );
    backupPath = path;
    if( settings.has( FILE_LOG_BACKUP_PATH ) )
      backupPath = settings.getString( FILE_LOG_BACKUP_PATH );

    return m_globalLog = new FileLog( path, backupPath );
  }
  catch( ConfigError& )
  {
  m_globalLogCount--;
  throw;  
  }
}
Log * FIX::FileLogFactory::create ( const SessionID s) [virtual]

Implements FIX::LogFactory.

Definition at line 56 of file FileLog.cpp.

References FIX::FILE_LOG_BACKUP_PATH, FIX::FILE_LOG_PATH, FIX::SessionSettings::get(), FIX::Dictionary::getString(), FIX::Dictionary::has(), m_backupPath, m_path, and m_settings.

{
  if ( m_path.size() && m_backupPath.size() )
    return new FileLog( m_path, m_backupPath, s );
  if ( m_path.size() ) 
    return new FileLog( m_path, s );

  std::string path;
  std::string backupPath;
  Dictionary settings = m_settings.get( s );
  path = settings.getString( FILE_LOG_PATH );
  backupPath = path;
  if( settings.has( FILE_LOG_BACKUP_PATH ) )
    backupPath = settings.getString( FILE_LOG_BACKUP_PATH );

  return new FileLog( path, backupPath, s );
}
void FIX::FileLogFactory::destroy ( Log log) [virtual]

Implements FIX::LogFactory.

Definition at line 74 of file FileLog.cpp.

References m_globalLog, and m_globalLogCount.

{
  if( pLog == m_globalLog )
  {
    m_globalLogCount--;
    if( m_globalLogCount == 0 )
    {
      delete pLog;
      m_globalLogCount = 0;
    }  
  }
  else
  {
    delete pLog;
  }
}

Member Data Documentation

std::string FIX::FileLogFactory::m_backupPath [private]

Definition at line 57 of file FileLog.h.

Referenced by create().

Definition at line 59 of file FileLog.h.

Referenced by create(), and destroy().

Definition at line 60 of file FileLog.h.

Referenced by create(), and destroy().

std::string FIX::FileLogFactory::m_path [private]

Definition at line 56 of file FileLog.h.

Referenced by create().

Definition at line 58 of file FileLog.h.

Referenced by create().


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

Generated on Mon Jun 23 2014 23:49:39 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001