int CasteroidIGC::Export(void* data) const { if (data) { DataAsteroidIGC* dataAsteroid = (DataAsteroidIGC*)data; dataAsteroid->asteroidDef = m_asteroidDef; dataAsteroid->position = GetPosition(); { const Orientation& o = GetOrientation(); dataAsteroid->forward = o.GetForward(); dataAsteroid->up = o.GetUp(); } dataAsteroid->rotation = GetRotation(); assert (GetCluster()); dataAsteroid->clusterID = GetCluster()->GetObjectID(); dataAsteroid->signature = GetSignature(); dataAsteroid->fraction = m_fraction; const char* pszName = GetName(); if (*pszName == '\0') memcpy(dataAsteroid->name, GetName(), sizeof(dataAsteroid->name)); else UTL::putName(dataAsteroid->name, GetName()); } return sizeof(DataAsteroidIGC); }
long slNode::GetOutstandingAcks() { long l = StrToLong(GetDatabase()->ExecuteScalar( wxT("SELECT SUM(st_lag_num_events) AS sumlagevents\n") wxT(" FROM ") + GetCluster()->GetSchemaPrefix() + wxT("sl_status\n") wxT(" WHERE st_origin = ") + NumToStr(GetCluster()->GetLocalNodeID()) + wxT("\n") wxT(" GROUP BY st_last_event"))); return l; }
//--------------------------------------------------------------------------- bool Job::SetCondorID(const CondorID& cid) { bool ret = true; if(GetCluster() != -1) { debug_printf( DEBUG_NORMAL, "Reassigning the id of job %s from (%d.%d.%d) to " "(%d.%d.%d)\n", GetJobName(), GetCluster(), GetProc(), GetSubProc(), cid._cluster, cid._proc,cid._subproc ); ret = false; } _CondorID = cid; return ret; }
wxString slNode::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Create replication node ") + GetName() + wxT(".\n\n") wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("storenode(") + NumToStr(GetSlId()) + wxT(", ") + qtDbString(GetComment()); if (GetCluster()->ClusterMinimumVersion(1, 1) && !GetCluster()->ClusterMinimumVersion(2, 0)) sql += wxT(", ") + BoolToStr(GetSpool()); sql += wxT(");\n"); } return sql; }
int CprobeIGC::Export(void* data) const { if (data) { DataProbeExport* pdme = (DataProbeExport*)data; pdme->p0 = GetPosition(); pdme->time0 = m_time0; pdme->probeID = GetObjectID(); pdme->exportF = true; pdme->clusterID = GetCluster()->GetObjectID(); pdme->probetypeID = m_probeType->GetObjectID(); pdme->sideID = GetSide()->GetObjectID(); pdme->shipID = m_launcher ? m_launcher->GetObjectID() : NA; if (m_target) { pdme->otTarget = m_target->GetObjectType(); pdme->oidTarget = m_target->GetObjectID(); } else { pdme->otTarget = NA; pdme->oidTarget = NA; } pdme->createNow = m_bCreateNow; } return sizeof(DataProbeExport); }
void CprobeIGC::Terminate(void) { AddRef(); DataProbeTypeIGC* dataProbeType = (DataProbeTypeIGC*)(m_probeType->GetData()); if (dataProbeType->dtRipcord >= 0.0f) { GetMyMission()->GetIgcSite()->DestroyTeleportProbe(this); } if (m_projectileType) { m_projectileType->Release(); m_projectileType = NULL; } m_launcher = NULL; m_target = NULL; GetCluster()->GetClusterSite()->AddExplosion(GetPosition(), GetRadius(), c_etProbe); GetMyMission()->DeleteProbe(this); TmodelIGC<IprobeIGC>::Terminate(); if (m_probeType) { m_probeType->Release(); m_probeType = NULL; } Release(); }
wxString slSubscription::GetSql(ctlTree *browser) { if (sql.IsNull()) { if (GetReceiverId() != GetCluster()->GetLocalNodeID()) sql = wxT("-- Subscription must be maintained on receiver node.\n"); else sql = wxT("-- subscribe replication set\n\n") wxT(" SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("subscribeset(") + NumToStr(GetSet()->GetSlId()) + wxT(", ") + NumToStr(GetProviderId()) + wxT(", ") + NumToStr(GetReceiverId()) + wxT(", ") + BoolToStr(GetForward()) + wxT(");"); } return sql; }
void CprojectileIGC::Update(Time now) { if (GetMyLastUpdate() >= m_timeExpire) Terminate(); else { if (now >= m_timeExpire) { float p = m_projectileType->GetBlastPower(); if (p != 0.0f) { m_pExplosionData = GetCluster()->CreateExplosion(m_projectileType->GetDamageType(), p * GetSide()->GetGlobalAttributeSet().GetAttribute(c_gaDamageGuns), m_projectileType->GetBlastRadius(), c_etProjectile, m_timeExpire, GetPosition() + GetVelocity() * (m_timeExpire - GetMyLastUpdate()), m_launcher); } } TmodelIGC<IprojectileIGC>::Update(now); } }
int slSubscription::GetIconId() { if (GetReceiverId() == GetCluster()->GetLocalNodeID()) return subscriptionFactory.GetIconId(); else return subscriptionFactory.GetExportedIconId(); }
int CmineIGC::Export(void* data) const { int size = sizeof(DataMineExport); if (data) { DataMineExport* pdme = (DataMineExport*)data; pdme->p0 = GetPosition(); pdme->time0 = m_time0; pdme->mineID = GetObjectID(); pdme->exportF = true; pdme->clusterID = GetCluster()->GetObjectID(); pdme->minetypeID = m_mineType->GetObjectID(); pdme->launcherID = m_launcher ? m_launcher->GetObjectID() : NA; pdme->sideID = GetSide()->GetObjectID(); pdme->fraction = m_fraction; pdme->createNow = m_bCreateNow; } return size; }
bool slPath::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded) { return GetDatabase()->ExecuteVoid( wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("droppath(") + NumToStr(GetSlId()) + wxT(", ") + NumToStr(GetNode()->GetSlId()) + wxT(");\n")); }
ICluster* LDFDatabaseManager::GetLDFCluster() { if ( nullptr == m_pouLDFClsuter ) { GetCluster(LIN, &m_pouLDFClsuter); } return m_pouLDFClsuter; }
void slNodeCollection::ShowStatistics(frmMain *form, ctlListView *statistics) { wxLogInfo(wxT("Displaying statistics for nodes on Cluster %s"), GetCluster()->GetIdentifier().c_str()); // Add the statistics view columns statistics->ClearAll(); statistics->AddColumn(_("Node"), 50); statistics->AddColumn(_("Roundtrip"), 50); statistics->AddColumn(_("Acks outstanding"), 50); statistics->AddColumn(_("Outstanding time"), 50); statistics->AddColumn(_("Event No"), 50); statistics->AddColumn(_("Command"), 250); pgSet *stats = GetDatabase()->ExecuteSet( wxT("SELECT st_received, st_last_event, st_lag_num_events, st_last_event_ts, st_last_received, st_last_received_ts,\n") wxT(" st_last_received_ts - st_last_received_event_ts AS roundtrip,\n") wxT(" CASE WHEN st_lag_num_events > 0 THEN st_last_event_ts - st_last_received_ts END AS eventlag,") wxT(" ev_seqno, ev_type || ' ' || COALESCE(ev_data1, '') AS hanging\n") wxT(" FROM ") + GetCluster()->GetSchemaPrefix() + wxT("sl_status\n") wxT(" LEFT JOIN ") + GetCluster()->GetSchemaPrefix() + wxT("sl_event ON ev_origin=st_origin AND ev_seqno=\n") wxT(" (SELECT MIN(ev_seqno) FROM ") + GetCluster()->GetSchemaPrefix() + wxT("sl_event WHERE ev_seqno > st_last_received)\n") wxT(" WHERE st_origin = ") + NumToStr(GetCluster()->GetLocalNodeID())); if (stats) { long pos = 0; while (!stats->Eof()) { long lagEvents = stats->GetLong(wxT("st_lag_num_events")); statistics->InsertItem(pos, NumToStr(stats->GetLong(wxT("st_received"))), nodeFactory.GetIconId()); statistics->SetItem(pos, 1, stats->GetVal(wxT("roundtrip"))); statistics->SetItem(pos, 2, NumToStr(lagEvents)); statistics->SetItem(pos, 3, stats->GetVal(wxT("eventlag"))); if (lagEvents) { statistics->SetItem(pos, 4, stats->GetVal(wxT("ev_seqno"))); statistics->SetItem(pos, 5, stats->GetVal(wxT("hanging"))); } stats->MoveNext(); pos++; } delete stats; } }
int slNode::GetIconId() { if (!GetActive()) return nodeFactory.GetDisabledIconId(); else if (GetSlId() == GetCluster()->GetLocalNodeID()) return nodeFactory.GetLocalIconId(); else return nodeFactory.GetIconId(); }
bool slSubscription::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded) { return GetDatabase()->ExecuteVoid( wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("unsubscribeset(") + NumToStr(GetSet()->GetSlId()) + wxT(", ") + NumToStr(GetReceiverId()) + wxT(");")); }
int CwarpIGC::Export(void* data) const { if (data) { DataWarpIGC* dataWarp = (DataWarpIGC*)data; dataWarp->warpDef = m_warpDef; dataWarp->position = GetPosition(); dataWarp->forward = GetOrientation().GetForward(); dataWarp->rotation = GetRotation(); assert (GetCluster()); dataWarp->clusterID = GetCluster()->GetObjectID(); UTL::putName(dataWarp->name, GetName()); dataWarp->signature = GetSignature(); } return sizeof(DataWarpIGC); }
uint32 CmtFat::GetFreeCluster() { //Выполнять поиск свободного кластера пока не кончится диск while( curFreeCluster < clusterPerPart ) { //Проверить текущий кластер if( GetCluster( curFreeCluster ) == 0 ) return curFreeCluster; //Возврат если он свободен //Иначе переходим к следующему кластеру curFreeCluster++; } return 0; }
void CmtFat::FreeClusters( uint32 cluster ) { if( cluster == 0 || cluster == END_CLUSTER ) return; if( cluster < curFreeCluster ) curFreeCluster = cluster; while( cluster != END_CLUSTER ) { uint32 next = GetCluster( cluster ); SetCluster( cluster, 0 ); if( curFreeCluster > cluster ) curFreeCluster = cluster; cluster = next; } }
const std::string Clusterer::GetInfo() const { std::ostringstream os; oid_t cluster_itr; oid_t cluster_count; cluster_count = GetClusterCount(); for (cluster_itr = 0; cluster_itr < cluster_count; cluster_itr++) os << cluster_itr << " : " << GetFraction(cluster_itr) << " :: " << GetCluster(cluster_itr); return os.str(); }
int CbuoyIGC::Export(void* data) const { if (data) { DataBuoyIGC* dataBuoy = (DataBuoyIGC*)data; dataBuoy->position = GetPosition(); dataBuoy->clusterID = GetCluster()->GetObjectID(); dataBuoy->type = m_type; } return sizeof(DataBuoyIGC); }
wxString slSequence::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Register sequence ") + GetName() + wxT(" for replication.\n\n") wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("setaddsequence(") + NumToStr(GetSet()->GetSlId()) + wxT(", ") + NumToStr(GetSlId()) + wxT(", ") + qtDbString(GetName()) + wxT(", ") + qtDbString(GetComment()) + wxT(");\n"); } return sql; }
// Increase the buffer, simulating new data generation void Node::GenerateData(void) { if (IsActive()) { //if (pdu + pkt_rate[RL] <= PDU_BUFFER) // pdu += pkt_rate[RL]; //else // GetCluster()->IncreaseDrops(pkt_rate[RL]); if (pdu + (RL * GEN_RATE) <= PDU_BUFFER) pdu += RL * GEN_RATE; else GetCluster()->IncreaseDrops(RL * GEN_RATE); } }
wxString slPath::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Register path to node ") + GetName() + wxT(".\n\n") wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("storepath(") + NumToStr(GetSlId()) + wxT(", ") + NumToStr(GetNode()->GetSlId()) + wxT(", ") + qtDbString(GetConnInfo()) + wxT(", ") + NumToStr(GetConnRetry()) + wxT(");\n"); } return sql; }
wxString slListen::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Node will listen to ") + GetProviderName() + wxT(" for replication data from ") + GetOriginName() + wxT(".\n\n") wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("storelisten(") + NumToStr(GetSlId()) + wxT(", ") + NumToStr(GetProviderId()) + wxT(", ") + NumToStr(GetNode()->GetSlId()) + wxT(");\n"); } return sql; }
//--------------------------------------------------------------------------- bool Job::Release(int proc) { if( proc >= static_cast<int>( _onHold.size() ) ) { dprintf( D_FULLDEBUG, "Received release event for node %s, but job %d.%d " "is not on hold\n", GetJobName(), GetCluster(), GetProc() ); return false; // We never marked this as being on hold } if( _onHold[proc] ) { _onHold[proc] = 0; --_jobProcsOnHold; return true; } return false; }
void LDFDatabaseManager::ValidateFile() { const char* pchTempFileName = tmpnam(NULL); // Get temp name FILE* fp = fopen(pchTempFileName, "w"); // Create the file GetLDFCluster()->SaveToFile(std::string(pchTempFileName)); ICluster* pouLDFClsuter; GetCluster(LIN, &pouLDFClsuter); std::list<ParsingResults> ouWarnings; std::list<ParsingResults> ouErrors; pouLDFClsuter->LoadFromFile(std::string(pchTempFileName), ouErrors, ouWarnings); fclose(fp); remove(pchTempFileName); }
void Filler::GetCluster(Pos pos, std::unordered_set<int>& cluster_out) { if (IsOutside(pos) || visited_.find(pos.GetHash()) != visited_.end() || piece_index_.find(pos.GetHash()) == piece_index_.end()) { return; } visited_.insert(pos.GetHash()); cluster_out.insert(piece_index_[pos.GetHash()]); for (const auto& direction : directions_) { GetCluster({ pos.x + direction.first, pos.y + direction.second }, cluster_out); } }
//--------------------------------------------------------------------------- bool Job::Hold(int proc) { if( proc >= static_cast<int>( _onHold.size() ) ) { _onHold.resize( proc+1, 0 ); } if( !_onHold[proc] ) { _onHold[proc] = 1; ++_jobProcsOnHold; ++_timesHeld; return true; } else { dprintf( D_FULLDEBUG, "Received hold event for node %s, and job %d.%d " "is already on hold!\n", GetJobName(), GetCluster(), proc ); } return false; }
//============================================================================== //--------------------- FAT - общая -------------------------------------------- int32 CmtFat::IncreaseDir( uint32 startDir ) { //Распределить новый кластер uint32 cluster = GetFreeCluster(); if( cluster == 0 || cluster == END_CLUSTER ) return CMTE_FS_DISK_FULL; //Получить последний кластер uint32 last; while( startDir != 0 && startDir != END_CLUSTER ) { last = startDir; startDir = GetCluster( startDir ); } //Установить цепочку SetCluster( last, cluster ); SetCluster( cluster, END_CLUSTER ); //Подготовить кластер директория InitDirCluster( cluster ); return CMTE_OK; }
void CAttributeDlg::DoCheckComplexity() { CWaitCursor wait; m_view.SyntaxClearAll(); CString ecl; GetSource(ecl); StlLinked<Dali::IDali> server = Dali::AttachDali(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali")); std::_tstring complexity, complexitDisplay; Dali::CEclExceptionVector errorResults; server->CheckComplexity(GetCluster(), GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_QUEUE), ecl, m_attribute->GetModuleQualifiedLabel(), m_attribute->GetLabel(), complexity, errorResults); if (complexity.length() == 0) { complexitDisplay = ComplexityErrorMsg; SendMessage(CWM_SUBMITDONE, Dali::WUActionCheck, (LPARAM)&errorResults); } else complexitDisplay = _T("Complexity Count = \"") + complexity + _T("\""); MessageBox(complexitDisplay.c_str(), _T("Complexity Count"), MB_ICONINFORMATION); }