Log.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2001-2014
3 **
4 ** This file is part of the QuickFIX FIX Engine
5 **
6 ** This file may be distributed under the terms of the quickfixengine.org
7 ** license as defined by quickfixengine.org and appearing in the file
8 ** LICENSE included in the packaging of this file.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 ** See http://www.quickfixengine.org/LICENSE for licensing information.
14 **
15 ** Contact ask@quickfixengine.org if any conditions of this licensing are
16 ** not clear to you.
17 **
18 ****************************************************************************/
19 
20 #ifdef _MSC_VER
21 #include "stdafx.h"
22 #else
23 #include "config.h"
24 #endif
25 
26 #include "Log.h"
27 
28 namespace FIX
29 {
30 Mutex ScreenLog::s_mutex;
31 
33 {
34  bool incoming, outgoing, event;
35  init( m_settings.get(), incoming, outgoing, event );
36  return new ScreenLog( incoming, outgoing, event );
37 }
38 
39 Log* ScreenLogFactory::create( const SessionID& sessionID )
40 {
41  Dictionary settings;
42  if( m_settings.has(sessionID) )
43  settings = m_settings.get( sessionID );
44 
45  bool incoming, outgoing, event;
46  init( settings, incoming, outgoing, event );
47  return new ScreenLog( sessionID, incoming, outgoing, event );
48 }
49 
50 void ScreenLogFactory::init( const Dictionary& settings, bool& incoming, bool& outgoing, bool& event )
51 {
52  if( m_useSettings )
53  {
54  incoming = true;
55  outgoing = true;
56  event = true;
57 
58  if( settings.has(SCREEN_LOG_SHOW_INCOMING) )
59  incoming = settings.getBool(SCREEN_LOG_SHOW_INCOMING);
60  if( settings.has(SCREEN_LOG_SHOW_OUTGOING) )
61  outgoing = settings.getBool(SCREEN_LOG_SHOW_OUTGOING);
62  if( settings.has(SCREEN_LOG_SHOW_EVENTS) )
63  event = settings.getBool(SCREEN_LOG_SHOW_EVENTS);
64  }
65  else
66  {
67  incoming = m_incoming;
68  outgoing = m_outgoing;
69  event = m_event;
70  }
71 }
72 
73 void ScreenLogFactory::destroy( Log* pLog )
74 {
75  delete pLog;
76 }
77 } //namespace FIX
FIX::SessionSettings::has
const bool has(const SessionID &) const
Check if session setings are present.
Definition: SessionSettings.cpp:139
FIX::ScreenLogFactory::m_event
bool m_event
Definition: Log.h:90
FIX::ScreenLogFactory::m_settings
SessionSettings m_settings
Definition: Log.h:92
FIX::ScreenLogFactory::m_outgoing
bool m_outgoing
Definition: Log.h:89
FIX::ScreenLogFactory::destroy
void destroy(Log *log)
Definition: Log.cpp:90
FIX::SCREEN_LOG_SHOW_OUTGOING
const char SCREEN_LOG_SHOW_OUTGOING[]
Definition: SessionSettings.h:116
FIX::ScreenLogFactory::m_useSettings
bool m_useSettings
Definition: Log.h:91
FIX::Dictionary::has
bool has(const std::string &) const
Check if the dictionary contains a value for key.
Definition: Dictionary.cpp:166
FIX::ScreenLogFactory::create
Log * create()
Definition: Log.cpp:49
FIX::Dictionary::getBool
bool getBool(const std::string &) const
Get a value as a bool.
Definition: Dictionary.cpp:88
FIX
Definition: Acceptor.cpp:34
FIX::ScreenLogFactory::m_incoming
bool m_incoming
Definition: Log.h:88
FIX::SCREEN_LOG_SHOW_INCOMING
const char SCREEN_LOG_SHOW_INCOMING[]
Definition: SessionSettings.h:115
FIX::ScreenLog::s_mutex
static Mutex s_mutex
Definition: Log.h:186
FIX::SCREEN_LOG_SHOW_EVENTS
const char SCREEN_LOG_SHOW_EVENTS[]
Definition: SessionSettings.h:117
FIX::SessionSettings::get
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
Definition: SessionSettings.cpp:144
FIX::ScreenLogFactory::init
void init(const Dictionary &settings, bool &incoming, bool &outgoing, bool &event)
Definition: Log.cpp:67
FIX::Dictionary
For storage and retrieval of key/value pairs.
Definition: Dictionary.h:53
Log.h

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001