Esempio n. 1
0
CRdbTable& CRdbTable::SetThis(CTableDefine* pTabDef)
{
	if(m_nThis)
		Distruction();
	m_pTabDef = pTabDef;
	m_nThis = pTabDef->m_pBaseAttr->nStorageAddr;
	if(m_nThis)
	{
		Construction(pTabDef);
		uint64 nAddrTable[2];
		vquery(m_nThis, (char*)nAddrTable, 16);
		m_pTableSpace->SetThis(nAddrTable[0]);
		m_pRowIndex->SetThis(nAddrTable[1]);
		uint32 nIndexCount = m_nIndexCount;
		if(nIndexCount)
		{
			for(uint32 i=0; i<nIndexCount; ++i)
			{
				if(m_pIndexTable[i])
				{
					CIndexDefine * pIndex = m_pTabDef->m_pIndexDefineSet[i];
					m_pIndexTable[i]->SetThis(pIndex->m_pBaseAttr->nStorageAddr);
				}
			}
		}
	}
	return *this;
}
Esempio n. 2
0
Position::Position( pInstrument_cref pInstrument, pProvider_t pExecutionProvider, pProvider_t pDataProvider ) 
: m_pExecutionProvider( pExecutionProvider ), //m_pDataProvider( pDataProvider ), 
  m_dblMultiplier( 1 ),
  m_bExecutionAccountAssigned( true ), m_bDataAccountAssigned( true ),
  m_bWatchConstructedLocally( false )
{
  ConstructWatch( pInstrument, pDataProvider );
  Construction();
}
Esempio n. 3
0
bool CRdbTable::CreateObject(CTableDefine* pTabDef)
{
	if(m_nThis)
		Distruction();
	m_pTabDef = pTabDef;
	int32 bInMemory = (m_pTabDef->m_pBaseAttr->nStorage == RDB_MEMORY_TABLE);
	m_nThis = vmalloc(16, bInMemory);
	if(!m_nThis)
		return false;
	Construction(pTabDef);
	uint64 nAddrTable[2];
	if(!m_pTableSpace->CreateObject())
	{
		Distruction();
		vfree(m_nThis);
		m_nThis = 0;
		return false;
	}
	nAddrTable[0] = m_pTableSpace->GetThis();
	if(!m_pRowIndex->CreateObject())
	{
		m_pTableSpace->DestroyObject();
		Distruction();
		vfree(m_nThis);
		m_nThis = 0;
		return false;
	}
	nAddrTable[1] = m_pRowIndex->GetThis();
	uint32 nIndexCount = m_pTabDef->m_nIndexCount;
	for(uint32 i=0; i<nIndexCount; ++i)
	{
		if(m_pIndexTable[i])
		{
			CIndexDefine * pIndex = m_pTabDef->m_pIndexDefineSet[i];
			if(!m_pIndexTable[i]->CreateObject())
			{
				for(uint32 j=0; j<i; ++j)
				{
					m_pIndexTable[i]->DestroyObject();
					pIndex->SetStorageAddr(0);
				}
				m_pRowIndex->DestroyObject();
				m_pTableSpace->DestroyObject();
				Distruction();
				vfree(m_nThis);
				m_nThis = 0;
				return false;
			}
			pIndex->SetStorageAddr(m_pIndexTable[i]->GetThis());
		}
	}
	vcommit(m_nThis, (char*)nAddrTable, 16);
	pTabDef->SetStorageAddr(m_nThis);

	return true;
}
Esempio n. 4
0
Position::Position( pInstrument_cref pInstrument, pProvider_t pExecutionProvider, pProvider_t pDataProvider,
  const idAccount_t& idExecutionAccount, const idAccount_t& idDataAccount, 
  const idPortfolio_t& idPortfolio, const std::string& sName, const std::string& sAlgorithm ) 
: m_pExecutionProvider( pExecutionProvider ), //m_pDataProvider( pDataProvider ), 
  m_dblMultiplier( 1 ), //m_bConnectedToDataProvider( false ),
  m_bExecutionAccountAssigned( true ), m_bDataAccountAssigned( true ),
  m_row( idPortfolio, sName, pInstrument->GetInstrumentName(), idExecutionAccount, idDataAccount, sAlgorithm ),
  m_bWatchConstructedLocally( false )
{
  ConstructWatch( pInstrument, pDataProvider );
  Construction();
}
Esempio n. 5
0
void Position::Set( pInstrument_cref pInstrument, pProvider_t& pExecutionProvider, pProvider_t& pDataProvider ) {

  m_pExecutionProvider = pExecutionProvider;
  m_bExecutionAccountAssigned = true;  // TODO: check use of these flags
  
  ConstructWatch( pInstrument, pDataProvider );

  m_bDataAccountAssigned = true;  // TODO: check use of these flags

  Construction();

}
Esempio n. 6
0
Position::Position( pWatch_t pWatch, pProvider_t pExecutionProvider ) 
: m_dblMultiplier( 1 ), 
  m_pWatch( pWatch ),
  m_bWatchConstructedLocally( false ),
  m_pExecutionProvider( pExecutionProvider ),
  m_bExecutionAccountAssigned( false ), m_bDataAccountAssigned( false ) // TODO: will have to confirm operation of these flags
{
  assert( 0 != m_pWatch.use_count() );
  assert( nullptr != m_pWatch.get() );  // this is probably a better check than use_count
  assert( 0 != m_pWatch->GetInstrument().use_count() );
  assert( 0 != m_pWatch->GetProvider().use_count() );
  Construction();
}
Esempio n. 7
0
Position::Position( pWatch_t pWatch, pProvider_t pExecutionProvider,
  const idAccount_t& idExecutionAccount, const idAccount_t& idDataAccount, 
  const idPortfolio_t& idPortfolio, const std::string& sName, const std::string& sAlgorithm ) 
: m_pExecutionProvider( pExecutionProvider ), //m_pDataProvider( pDataProvider ), 
  m_dblMultiplier( 1 ), //m_bConnectedToDataProvider( false ),
  m_pWatch( pWatch ),
  m_bExecutionAccountAssigned( true ), m_bDataAccountAssigned( true ),
  m_row( idPortfolio, sName, pWatch->GetInstrument()->GetInstrumentName(), idExecutionAccount, idDataAccount, sAlgorithm ),
  m_bWatchConstructedLocally( false )
{
  assert( 0 != m_pWatch.use_count() );
  assert( nullptr != m_pWatch.get() );  // this is probably a better check than use_count
  assert( 0 != m_pWatch->GetInstrument().use_count() );
  assert( 0 != m_pWatch->GetProvider().use_count() );
  Construction();
}