void CDataTrade::VLogon(const CFxEventInfo& eventInfo, const string& protocolVersion) { m_accountType = FxAccountType_None; m_cache.Clear(); string id = NextId(cInternalASynchCall); m_sender->VSendGetAccountInfo(id); id = NextId(cInternalASynchCall); m_sender->VSendGetOrders(id); __super::VLogon(eventInfo, protocolVersion); }
struct Population* CreatePopulation(const char* _Name, int _Nutrition, int _Meat, int _Milk, struct Constraint** _Ages, double _MaleRatio, int _FMRatio, double _ReproduceMin, double _ReproduceMax, int _SpaceReq) { struct Population* _Population = (struct Population*) malloc(sizeof(struct Population)); _Population->Id = NextId(); _Population->Name = (char*) calloc(strlen(_Name) + 1, sizeof(char)); strcpy(_Population->Name, _Name); _Population->Nutrition = _Nutrition; _Population->Meat = _Meat; _Population->Milk = _Milk; _Population->Ages = _Ages; _Population->Outputs = NULL; _Population->MaleRatio = _MaleRatio; _Population->FMRatio = _FMRatio; _Population->SpaceReq = _SpaceReq; _Population->MaxNutrition = _Nutrition * 31; _Population->Skin.Skin = NULL; _Population->Skin.Pounds = 0.0; _Population->Hair.Hair = NULL; _Population->Hair.Pounds = 0.0; _Population->Hair.Shearable = 0; _Population->ReproduceRate.Min = _ReproduceMin * 100; _Population->ReproduceRate.Max = _ReproduceMax * 100; return _Population; }
int CDataFeed::GetQuotesHistoryVersion(const uint32 timeoutInMilliseconds) { Nullable<int> version; DWORD status = WaitForSingleObject(m_serverQuotesHistoryEvent, 0); version = m_cache.GetServerQuotesHistoryVersion(); string id; if (!version.HasValue()) { id = NextId(cExternalSynchCall); m_sender->VSendQuotesHistoryRequest(id); status = WaitForSingleObject(m_serverQuotesHistoryEvent, timeoutInMilliseconds); version = m_cache.GetServerQuotesHistoryVersion(); } if (version.HasValue()) { return version.Value(); } if (WAIT_OBJECT_0 == status) { throw runtime_error("Couldn't get server quotes storage version due to logout"); } else { throw CTimeoutException(id, 0); } }
DOCKPANEL * NewDockPanel(DOCKSERVER *dsp) { DOCKPANEL *dpp; // Allocate a DOCKPANEL and insert into the main PanelList if((dpp = AllocDockObj(0, 0, NextId(dsp), sizeof(DOCKPANEL))) == 0) return 0; InsertBefore(dpp, dsp->PanelListTail); // intialise the DOCKPANEL's WndList dpp->WndListHead = AllocDockObj(0, 0, -1, sizeof(DOCKWND)); dpp->WndListTail = AllocDockObj(0, 0, -2, sizeof(DOCKWND)); dpp->WndListHead->flink = dpp->WndListTail; dpp->WndListTail->blink = dpp->WndListHead; SetRect(&dpp->rcDockBorder, DEFAULT_BORDER, DEFAULT_BORDER, DEFAULT_BORDER, DEFAULT_BORDER); SetRect(&dpp->rcFloatBorder, 0, DEFAULT_BORDER, 0, 0); dpp->hwndMain = dsp->hwndMain; dpp->uCurrentTabId = 0; dpp->FloatSize.cx = 0; dpp->FloatSize.cy = 0; dpp->DockSize.cx = 0; dpp->DockSize.cy = 0; dpp->dwStyle = 0; dpp->xpos = 0; dpp->ypos = 0; dpp->pDockServer = dsp; return dpp; }
void CDataFeed::VNotify(const CFxEventInfo& eventInfo, const CNotification& notification) { if (NotificationType_ConfigUpdated == notification.Type) { string id = NextId(cInternalASynchCall); m_sender->VSendGetSupportedSymbols(id); if (CheckProtocolVersion(CProtocolVersion(1, 24))) { id = NextId(cInternalASynchCall); m_sender->VSendGetCurrencies(id); } } __super::VNotify(eventInfo, notification); }
static TRI_aql_scope_t* CreateScope (TRI_aql_context_t* const context, const TRI_aql_scope_e type) { TRI_aql_scope_t* scope; assert(context); scope = (TRI_aql_scope_t*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_aql_scope_t), false); if (scope == NULL) { return NULL; } scope->_id = NextId(context); scope->_type = NextType(context, type); scope->_ranges = NULL; scope->_selfContained = true; TRI_InitAssociativePointer(&scope->_variables, TRI_UNKNOWN_MEM_ZONE, &TRI_HashStringKeyAssociativePointer, &TRI_HashVariableAql, &TRI_EqualVariableAql, 0); return scope; }
const string CReceiver::NextIdIfEmpty(const string& prefix, const string& externalId) { if (!externalId.empty()) { return externalId; } return NextId(prefix); }
void CDataFeed::VLogon(const CFxEventInfo& eventInfo, const string& protocolVersion) { __super::VLogon(eventInfo, protocolVersion); ResetEvent(m_serverQuotesHistoryEvent); m_cache.Clear(); string id = NextId(cInternalASynchCall); m_sender->VSendGetSupportedSymbols(id); if (CheckProtocolVersion(CProtocolVersion(1, 24))) { id = NextId(cInternalASynchCall); m_sender->VSendGetCurrencies(id); } id = NextId(cInternalASynchCall); m_sender->VSendQuotesHistoryRequest(id); }
void CDataTrade::UpdateAccountInfo(FxAccountType accountType, const string& account) { if (FxAccountType_None != m_accountType) { return; } m_accountType = accountType; if (FxAccountType_Net == accountType) { string id = NextId(cInternalASynchCall); m_sender->VSendPositionReportRequest(id, account); } }
// ********************************************************** // BeginBatch // ********************************************************** STDMETHODIMP CUndoList::BeginBatch(VARIANT_BOOL* retVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); if (_batchId == EMPTY_BATCH_ID) { _batchId = NextId(); *retVal = VARIANT_TRUE; } else { ErrorMessage(tkALREADY_WITHIN_BATCH); *retVal = VARIANT_FALSE; } return S_OK; }
std::shared_ptr<GuiMap> Maps::AddEmptyMap() { u16 id = NextId(); if ( id < u16_max ) { auto it = openMaps.insert(std::pair<u16, std::shared_ptr<GuiMap>>(id, std::shared_ptr<GuiMap>(new GuiMap(clipboard)))); if ( it != openMaps.end() ) { it->second->setMapId(id); return it->second; } } return nullptr; }
// ********************************************************** // AddGroupOperation // ********************************************************** bool CUndoList::AddGroupOperation(tkUndoOperation operation, int layerHandle, vector<int>* indices, double xProjOrigin, double yProjOrigin, double angleDegrees) { if (!CheckState()) return false; if (!indices) return false; TrimList(); int id = NextId(); UndoListItem* item = new UndoListItem(id, layerHandle, indices, operation); item->ProjOffset.x = xProjOrigin; item->ProjOffset.y = yProjOrigin; item->RotationAngle = angleDegrees; _list.push_back(item); _position = _list.size() - 1; FireUndoListChanged(); return true; }
// ********************************************************** // Add // ********************************************************** STDMETHODIMP CUndoList::Add(tkUndoOperation operation, LONG LayerHandle, LONG ShapeIndex, VARIANT_BOOL *retVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); *retVal = VARIANT_FALSE; if (!CheckState()) return S_OK; if (operation == uoMoveShapes || operation == uoRotateShapes) { ErrorMessage(tkINVALID_PARAMETER_VALUE); return S_OK; } if (operation != uoAddShape) { if (!CheckShapeIndex(LayerHandle, ShapeIndex)) return S_OK; } TrimList(); int id = _batchId != EMPTY_BATCH_ID ? _batchId : NextId(); UndoListItem* item = new UndoListItem((int)id, LayerHandle, ShapeIndex, operation); item->WithinBatch = _batchId != EMPTY_BATCH_ID; bool copyAttributes = operation == uoRemoveShape || operation == uoEditShape; if (operation != uoAddShape) CopyShapeState(LayerHandle, ShapeIndex, copyAttributes, item); _list.push_back(item); *retVal = VARIANT_TRUE; _position = _list.size() - 1; if (!item->WithinBatch) { FireUndoListChanged(); } return S_OK; }
struct Population* CopyPopulation(const struct Population* _Population) { struct Population* _New = (struct Population*) malloc(sizeof(struct Population)); int i = 0; _New->Id = NextId(); _New->Name = (char*) calloc(strlen(_Population->Name) + 1, sizeof(char)); strcpy(_New->Name, _Population->Name); _New->Nutrition = _Population->Nutrition; _New->Meat = _Population->Meat; _New->Milk = _Population->Milk; _New->MaleRatio = _Population->MaleRatio; _New->Ages = CopyConstraintBnds(_Population->Ages); for(i = 0; _Population->Outputs[i] != NULL; ++i) _New->Outputs[i] = _Population->Outputs[i]; _New->Outputs[i] = _Population->Outputs[i]; _New->EatsSize = _Population->EatsSize; _New->Eats = calloc(_New->EatsSize, sizeof(struct FoodBase*)); for(i = 0; i < _New->EatsSize; ++i) _New->Eats[i] = _Population->Eats[i]; return _New; }
const string CReceiver::NextId() { return NextId(string()); }