/*
*	Local variable declarations for SUT servers processing threads.
*
*	©Copyright 2002-2006, Microsoft Corporation
*
*	Written by Sergey Vasilevskiy.
*/

#include "stdafx.h"

/*
*	CE SUT server locals.
*	There must be transaction classes as they cannot be shared among threads.
*/
typedef struct TCEServerLocals
{
    CSendToMarket		    m_SM;
	CDBConnection		    m_DBConnection;	// one DB connection for all classes
	// Database implementation classes (passed to txn harnesses).
    //
    CBrokerVolumeDB		    m_dbBV;
	CCustomerPositionDB	    m_dbCP;
	CDataMaintenanceDB	    m_dbDM;
	CMarketWatchDB		    m_dbMW;
	CSecurityDetailDB	    m_dbSD;
	CTradeLookupDB		    m_dbTL;
	CTradeOrderDB		    m_dbTO;
	CTradeStatusDB		    m_dbTS;
	CTradeUpdateDB		    m_dbTU;

	TPCE::CBrokerVolume		m_BV;
	CCheckpointDB		    m_CH;
	TPCE::CCustomerPosition	m_CP;
	TPCE::CDataMaintenance	m_DM;
	TPCE::CMarketWatch		m_MW;
	TPCE::CSecurityDetail	m_SD;
	TPCE::CTradeLookup		m_TL;
	TPCE::CTradeOrder		m_TO;
	TPCE::CTradeStatus		m_TS;
	TPCE::CTradeUpdate		m_TU;	
	

	//Constructor for this structure
	TCEServerLocals(char*				szDBServer, 
					char*				szDB, 
					PMEEIndexTable		pMEETable, 
					eClientDriverType	eClientType,
					char*				szMEEToUse)
		: m_SM(pMEETable, szMEEToUse)
		, m_DBConnection(szDBServer, szDB, eClientType)
		, m_dbBV(&m_DBConnection)
		, m_dbCP(&m_DBConnection)
		, m_dbDM(&m_DBConnection)
		, m_dbMW(&m_DBConnection)
		, m_dbSD(&m_DBConnection)
		, m_dbTL(&m_DBConnection)
		, m_dbTO(&m_DBConnection) 
		, m_dbTS(&m_DBConnection)
		, m_dbTU(&m_DBConnection)

        , m_BV(&m_dbBV)
		, m_CH(&m_DBConnection)
		, m_CP(&m_dbCP)
		, m_DM(&m_dbDM)
		, m_MW(&m_dbMW)
		, m_SD(&m_dbSD)
		, m_TL(&m_dbTL)
		, m_TO(&m_dbTO, &m_SM) 
		, m_TS(&m_dbTS)
		, m_TU(&m_dbTU)
	{
	};
} *PSUTServerLocals;

/*
*	MEE SUT server locals.
*/
typedef struct TMEEServerLocals
{
	CDBConnection		    m_DBConnection;

    // For Trade Result.
    //
    CTradeResultDB		    m_dbTR;
	TPCE::CTradeResult		m_TR;

    // For Market Feed.
    //
    TMEEIndexTable		    m_MEETable;
	CSendToMarket		    m_SendToMarket;
	CMarketFeedDB		    m_dbMF;
    TPCE::CMarketFeed		m_MF;

	TMEEServerLocals(   const char*         szDBServer, 
                        const char*         szDB, 
                        eClientDriverType   eClientType,
                        const char*			szMEEToUse
                    )
	: m_DBConnection(szDBServer, szDB, eClientType)
	, m_dbTR(&m_DBConnection)
    , m_TR(&m_dbTR)
    , m_MEETable()
	, m_SendToMarket(&m_MEETable, szMEEToUse)
	, m_dbMF(&m_DBConnection)
    , m_MF(&m_dbMF, &m_SendToMarket)
	{
	};

} *PMEEServerLocals;

