Esempio n. 1
0
void InfoBox::GenerateStatString()
{
    auto statMgr( GetStatMgr().lock() );
    assert(statMgr);
    auto		iter( statMgr->GetStats().begin() );
    const auto	end ( statMgr->GetStats().end()   );

    while( iter != end )
    {
        Stat::pointer_t	stat ( iter->second );

        const int mod   = f_char->getMod( stat->id(), true /*with_ability*/ );
        const bool last = (++iter == end);

        if( stat->ability() || stat->internal() ) continue;

        AddAttribute( stat->name(), mod );

        if( last )
        {
            AddCR();
        }
        else
        {
            AddComma();
        }
    }
}
Esempio n. 2
0
void AMech_RPGCharacter::Tick(float DeltaTime) {
	Super::Tick(DeltaTime);
	if (!isDead) {
		GetCharacterMovement()->MaxWalkSpeed = speed * speedModifier;

		if (GetHealth() < GetMaxHealth()) {
			float regen = !inCombat ? GetMaxHealth() * 0.15 : healthRegen;
			health += regen * DeltaTime;

			GetFloatingStats()->UpdateHealthBar();

			if (GetCharacterStats() != nullptr) {
				GetCharacterStats()->UpdateHealthBar();
			}
		}

		if (stats->GetUserWidgetObject() != nullptr && stats->GetUserWidgetObject() != nullptr) {
			if (mIsChildOf(GetController(), AMech_RPGPlayerController::StaticClass()) && GetTopDownCamera() != nullptr) {
				UMiscLibrary::SetCameraRot(FRotator(-GetTopDownCamera()->GetComponentRotation().Pitch, UMiscLibrary::GetWidgetYaw(GetTopDownCamera()) + 90, 0));
				GetStats()->SetWorldRotation(UMiscLibrary::GetCameraRot());
			}
			else if (GetStats() != nullptr) {
				GetStats()->SetWorldRotation(UMiscLibrary::GetCameraRot());
			}
		}
	}

	CLAMP(health, GetMaxHealth(), 0);
}
Esempio n. 3
0
	int32_t Spell::GetDamageStatValue(GameObject *target, SpellEffectData &effect, SpellState &state)
	{
		auto character = target->FindComponent<CharacterComponent>();
		auto ownerCharacter = mOwner->FindComponent<CharacterComponent>();
		CharacterStats &targetStats = character->GetStats();
		CharacterStats &ownerStats = ownerCharacter->GetStats();


		int statValue = 0;
		switch (effect.damageSource)
		{
		case SpellDamageSourceCasterPower:
			statValue = ownerStats.GetStat(CharacterStatPower) * 0.01;
			break;

		case SpellDamageSourceTargetHealth:
			statValue = targetStats.GetStat(CharacterStatHealth);
			break;

		case SpellDamageSourceCurrentSpell:
			statValue = state.currentDamage;
			break;

		case SpellDamageSourceTriggeringSpell:
			statValue = state.triggeringSpellDamage;
			break;
		}

		return statValue;
	}
Esempio n. 4
0
void
TaskManager::UpdateCommonStatsPolar(const AircraftState &state)
{
  common_stats.current_mc = glide_polar.GetMC();
  common_stats.current_bugs = glide_polar.GetBugs();
  common_stats.current_ballast = glide_polar.GetBallast();

  common_stats.current_risk_mc = 
    glide_polar.GetRiskMC(state.working_band_fraction, 
                          task_behaviour.risk_gamma);

  GlidePolar risk_polar = glide_polar;
  risk_polar.SetMC(common_stats.current_risk_mc);

  common_stats.V_block = 
    glide_polar.SpeedToFly(state,
                               GetStats().current_leg.solution_remaining,
                               true);

  // note right now we only use risk mc for dolphin speeds

  common_stats.V_dolphin = 
    risk_polar.SpeedToFly(state,
                            GetStats().current_leg.solution_remaining,
                            false);
}
Esempio n. 5
0
void InfoBox::GenerateAbilityString()
{
    f_infoBuffer->insert_at_cursor( "Name: " );
    f_infoBuffer->insert_at_cursor( f_char->name() );
    f_infoBuffer->insert_at_cursor( " " );
    Glib::RefPtr<Gtk::TextChildAnchor> refAnchor = f_infoBuffer->create_child_anchor(f_infoBuffer->end());
    Gtk::Button* editBtn = Gtk::manage( new Gtk::Button("Edit") );
    editBtn->signal_clicked().connect( sigc::mem_fun( *this, &InfoBox::OnEditCharacter ) );
    //editBtn->set_sensitive( true );
    add_child_at_anchor( *editBtn, refAnchor );
    f_infoBuffer->insert_at_cursor( "\n" );
    editBtn->show_all();

    auto statMgr( GetStatMgr().lock() );
    assert(statMgr);

    auto       iter (statMgr->GetStats().begin());
    const auto end  (statMgr->GetStats().end()  );

    while( iter != end )
    {
        Stat::pointer_t stat ( iter->second );
        Value::pointer_t value ( f_char->getStat( stat->id() ) );

        const bool last = (++iter == end);

        if( !stat->ability() ) continue;
#if 0
        if( stat->enabled() )
        {
#endif
            AddAttribute( stat->name(), value->total() );
            AddModifier( Common::StatToMod( value->total() ) );
#if 0
        }
        else
        {
            AddAttribute( stat->name(), "--" );
        }
#endif

        if( last )
        {
            AddCR();
        }
        else
        {
            AddComma();
        }
    }
}
Esempio n. 6
0
CmdResult CommandWhowas::HandleInternal(const unsigned int id, const std::deque<classbase*> &parameters)
{
	switch (id)
	{
		case WHOWAS_ADD:
			AddToWhoWas((User*)parameters[0]);
		break;

		case WHOWAS_STATS:
			GetStats((Extensible*)parameters[0]);
		break;

		case WHOWAS_PRUNE:
			PruneWhoWas(ServerInstance->Time());
		break;

		case WHOWAS_MAINTAIN:
			MaintainWhoWas(ServerInstance->Time());
		break;

		default:
		break;
	}
	return CMD_SUCCESS;
}
int GetResult(sass_context_wrapper* ctx_w, Sass_Context* ctx, bool is_sync = false) {
  Nan::HandleScope scope;
  v8::Local<v8::Object> result;

  int status = sass_context_get_error_status(ctx);

  result = Nan::New(ctx_w->result);
  assert(result->IsObject());

  if (status == 0) {
    const char* css = sass_context_get_output_string(ctx);
    const char* map = sass_context_get_source_map_string(ctx);

    Nan::Set(result, Nan::New("css").ToLocalChecked(), Nan::CopyBuffer(css, static_cast<uint32_t>(strlen(css))).ToLocalChecked());

    GetStats(ctx_w, ctx);

    if (map) {
      Nan::Set(result, Nan::New("map").ToLocalChecked(), Nan::CopyBuffer(map, static_cast<uint32_t>(strlen(map))).ToLocalChecked());
    }
  }
  else if (is_sync) {
    Nan::Set(result, Nan::New("error").ToLocalChecked(), Nan::New<v8::String>(sass_context_get_error_json(ctx)).ToLocalChecked());
  }

  return status;
}
void EngineStatePlayerStats::DrawOverlays()
{
  EngineStateText::DrawOverlays();
  m_pOkButton->Draw();

  static float left = Engine::Instance()->GetConfigFloat("name_left");
  static float top = Engine::Instance()->GetConfigFloat("name_top");
  static float z = Engine::Instance()->GetConfigFloat("name_z");

  // Draw "ok" text over ok button  
  AmjuGL::PushMatrix();
  AmjuGL::Translate(left, top, z);
  AmjuGL::Translate(14.0f, -13.7f, -1.0f);
  AmjuGL::Scale(0.8f, 0.8f, 0.8f);
  m_pOkText->Draw();
  AmjuGL::PopMatrix();

  // Get playerinfo so we can compare current stat value with previous.
  PoolGameState::PlayerInfo* pInfo = 
    GetEngine()->GetGameState()->GetPlayerInfo(m_currentPlayer);
  Assert(pInfo);
  std::vector<float> oldStats = GetStats(m_currentPlayer);
  
  // Draw the stat guages
  int sz = m_nameGuages.size();
  for (int i = 0; i < sz; i++)
  {
    const std::string& name = m_nameGuages[i].first;
    RCPtr<Guage>& pGuage = m_nameGuages[i].second;

    float newval = pInfo->m_stats[i];

    Assert((int)oldStats.size() > i);

#ifdef _DEBUG
if ((int)oldStats.size() <= i)
{
std::cout << "Bad array size!!\n";
}
#endif

    float oldval = oldStats[i];
    float val = newval;
    // time to transition from old to new val
    static const float maxTime = GetEngine()->GetConfigFloat("stats_tr_time");
    if (m_time < maxTime)  // time to transition from old to new val
    {
      val = oldval + (newval - oldval) * m_time / maxTime;
    }

    pGuage->Set(val);

    pGuage->Draw();

    // Get text position from guage position.
    float x = m_textPositions[i].first;
    float y = m_textPositions[i].second;
    GetEngine()->GetTextWriter()->Print(x, y, name.c_str());
  }
}
Esempio n. 9
0
	bool Spell::StartCasting(std::function<void(Spell *)> onComplete, std::string &error)
	{
		auto character = mOwner->FindComponent<CharacterComponent>();
		if (!character->IsCastingSpell() && !mIsOnCooldown) {
			if (mCastTimeRemaining == 0) {
				character->SetCastingSpell(this);
				double castSpeed = character->GetStats().GetStat(CharacterStatCastSpeed) * 0.01;
				
				mCastTimeRemaining = mTotalCastTime = mData->GetCastTime() * castSpeed;
				
				mOnCompleteHandler = onComplete;
				mIsCasting = true;

				return true;
			}
			else {
				error = "This spell is already casting";
			}
		}
		else {
			if (mIsOnCooldown) {
				error = "This spell is on cooldown";
			}
			else if (character->IsCastingSpell()) {
				error = "Another spell is already casting";
			}
			
		}
		
		return false;
	}
void EngineStatePlayerStats::InitPlayer()
{
  PoolGameState::PlayerInfo* pInfo = 
    GetEngine()->GetGameState()->GetPlayerInfo(m_currentPlayer);
  Assert(pInfo);

  std::string charname = pInfo->m_name;
 
  m_pChar = new CharacterGameObject;
  Character* pChar = CharacterManager::Instance()->GetCharacter(charname);
  Assert(pChar);
  m_pChar->AddMesh(pChar);

  std::string playername = "player ";
  playername += ToString(m_currentPlayer + 1); // make it one-based
  playername += " -  "; 
  playername += charname;
  m_pComp = TextFactory::Instance()->Create(playername); 

  // For each stat in player info, set the guage.
  int sz = m_nameGuages.size();
  Assert((int)pInfo->m_stats.size() == sz);

  // Have any stats changed since last time ?
  // If so, play a wav
  // TODO play a happy or sad wav depending on movement - but this is hard,
  // because some stats could go up, and others down. Best if the wav is
  // neutral, just to indicate a change.
  bool hasChanged = false;
  // Compare old values with current values, where old values exist.
  
  std::vector<float> oldStats = GetStats(m_currentPlayer);
  for (int i = 0; i < sz; i++)
  {
    float newval = pInfo->m_stats[i];

    Assert((int)oldStats.size() >= i);
    if ((int)oldStats.size() == i)
    {
      oldStats.push_back(newval);
    }

    float oldval = oldStats[i];
    if (oldval != newval)
    {
      hasChanged = true;
      break;
    }
  }
  StoreStats(m_currentPlayer, oldStats);

  if (hasChanged)
  {
    std::string wav = GetEngine()->GetConfigValue("stat_change_wav");
    GetEngine()->PlayWav(wav);
  }
}
Esempio n. 11
0
int GetStats_basic_check1()
{
    ZS_stats_t            stats;
    ZS_status_t           ret;

    ret = GetStats(&stats);
    if(ZS_SUCCESS == ret)
        return 1;
    return 0;
}
Esempio n. 12
0
// Create the statistics line per region
string AmpliconRegionStatistics::ReportRegionStatistics( TargetRegion *region )
{
	StatsData *stats = GetStats(region);
	char sep = '\t';
	ostringstream ss;
	ss << sep << stats->overlaps << sep << stats->fwd_e2e << sep << stats->rev_e2e;
	ss << sep << (stats->fwdReads + stats->revReads);
	ss << sep << stats->fwdReads << sep << stats->revReads;
	return ss.str();
}
Esempio n. 13
0
int GetResult(Handle<Object> result, Sass_Context* ctx) {
  int status = sass_context_get_error_status(ctx);

  if (status == 0) {
    (*result)->Set(NanNew("css"), NanNew<String>(sass_context_get_output_string(ctx)));
    GetStats(result, ctx);
    GetSourceMap(result, ctx);
  }

  return status;
}
Esempio n. 14
0
void FAndroidPlatformMemory::Init()
{
	const FPlatformMemoryConstants& MemoryConstants = FPlatformMemory::GetConstants();
	FPlatformMemoryStats MemoryStats = GetStats();
	UE_LOG(LogInit, Log, TEXT("Memory total: Physical=%.2fMB (%dGB approx) Available=%.2fMB PageSize=%.1fKB"), 
		float(MemoryConstants.TotalPhysical/1024.0/1024.0),
		MemoryConstants.TotalPhysicalGB, 
		float(MemoryStats.AvailablePhysical/1024.0/1024.0),
		float(MemoryConstants.PageSize/1024.0)
		);
}
Esempio n. 15
0
int GetStats_basic_check2()
{
    ZS_status_t           ret;

    ret = GetStats(NULL);
    if(ZS_SUCCESS == ret){
        fprintf( stderr, "ZSGetStats use stats = NULL, success.\n");
        return 1;
    }
    else fprintf( stderr, "ZSGetStats use stats = NULL, failed.\n");
    return 0;
}
Esempio n. 16
0
void ArenaTeam::UpdateTeamRank(bool update_packet, bool save_to_db)
{
    uint32 rank = 1;
    for (ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr.GetArenaTeamMapBegin(); i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
    {
        if (GetType() == i->second->GetType() && GetStats().rating < i->second->GetRating())
                ++rank;
    }
    SetRank(rank);
    if (update_packet)
        NotifyStatsChanged();
    if (save_to_db)
        CharacterDatabase.PExecute("UPDATE arena_team_stats SET rank = '%u' WHERE arenateamid = '%u'", m_stats.rank, m_TeamId);
}
Esempio n. 17
0
int GetResult(sass_context_wrapper* ctx_w, Sass_Context* ctx) {
  NanScope();

  int status = sass_context_get_error_status(ctx);

  if (status == 0) {
    NanNew(ctx_w->result)->Set(NanNew("css"), NanNew<String>(sass_context_get_output_string(ctx)));

    GetStats(ctx_w, ctx);
    GetSourceMap(ctx_w, ctx);
  }

  return status;
}
Esempio n. 18
0
void CStatDialog::UpdatePlots()
{
	GetStats(m_User, m_Group);

	switch (m_GraphTab.GetCurSel())
	{
	default:
	case 0:
		m_ChartWnd.SetUserColTitle("Logins");
		STAT_ADD_PLOTS(LoginCount);
		break;
	case 1: /* Total connect time */
		m_ChartWnd.SetUserColTitle("Seconds");
		STAT_ADD_PLOTS(ConnectionDuration);
		break;
	case 2: /* Average connect time */
		m_ChartWnd.SetUserColTitle("Seconds");
		STAT_ADD_AVG_PLOTS(ConnectionDuration,ConnectionCount);
		break;
	case 3: 
		m_ChartWnd.SetUserColTitle("Failures");
		STAT_ADD_PLOTS(WrongPassCount);
		break;
	case 4:
		m_ChartWnd.SetUserColTitle("Count");
		STAT_ADD_PLOTS(DownloadCount);
		break;
	case 5:
		m_ChartWnd.SetUserColTitle("Size (kb)");
		STAT_ADD_PLOTS(DownloadKilobytes);
		break;
	case 6:
		m_ChartWnd.SetUserColTitle("Seconds");
		STAT_ADD_PLOTS(DownloadDuration);
		break;
	case 7:
		m_ChartWnd.SetUserColTitle("Count");
		STAT_ADD_PLOTS(UploadCount);
		break;
	case 8:
		m_ChartWnd.SetUserColTitle("Size (kb)");
		STAT_ADD_PLOTS(UploadKilobytes);
		break;
	case 9:
		m_ChartWnd.SetUserColTitle("Seconds");
		STAT_ADD_PLOTS(UploadDuration);
		break;
	}
}
Esempio n. 19
0
bool Player::CanBuy(Equip::Type t, bool verbose) const
{
	Equip::Slot slot = Equip::types[int(t)].slot;
	bool freespace = (m_equipment.FreeSpace(slot)!=0);
	bool freecapacity = (GetStats().free_capacity >= Equip::types[int(t)].mass);
	if (verbose) {
		if (!freespace) {
			Pi::Message(Lang::NO_FREE_SPACE_FOR_ITEM);
		}
		else if (!freecapacity) {
			Pi::Message(Lang::SHIP_IS_FULLY_LADEN);
		}
	}
	return (freespace && freecapacity);
}
Esempio n. 20
0
void CTransfersView::ResetStats(CDCCTransfer *pDCCTransfer)
{
  TransferStats_t *pTS = GetStats(pDCCTransfer);
  if (!pTS)
    return;

  pTS->LastPosition = pDCCTransfer->m_ResumeOffset;
  pTS->FirstSnapshot = TS_SNAPSHOTS_MAX - 1;
  // set the snapshot times.
  for (int i = 0; i < TS_SNAPSHOTS_MAX; i ++)
  {
    pTS->Snapshots[i] = 0;
    pTS->SnapshotTimes[i] = pDCCTransfer->m_ResumeTime;
  }
}
Esempio n. 21
0
static void PrintClientStats( gclient_t *cl, const playerStat_t *columns, int *bestStats )
{
	char		line[2 * DEFAULT_CONSOLE_WIDTH + 1]; // extra space for color codes
	char		*p = line;
	const char	*e = line + sizeof(line);
	int			stats[STAT_MAX];
	int			pad;
	int			i;

	GetStats(stats, cl);

	pad = MAX_NAME_LEN - Q_PrintStrlen(cl->pers.netname);
	p += Com_sprintf(p, e - p, "%s%s" S_COLOR_WHITE, cl->pers.netname, Spaces(pad));

	for (i = 0; columns[i] != STAT_MAX; i++) {
		playerStat_t stat = columns[i];
		char *value = va("%i", stats[stat]);
		int len = strlen(value);

		if (statCol[stat].disabled)
			continue;

		if (stats[stat] >= 1000 && len > statCol[stat].width) {
			value = va("%ik", stats[stat] / 1000);
			len = strlen(value);
		}
		if (len > statCol[stat].width) {
			value = "";
			len = 0;
		}

		pad = statCol[stat].width - len;
		if (stats[stat] == bestStats[stat]) {
			p += Com_sprintf(p, e - p, S_COLOR_GREEN " %s%s" S_COLOR_WHITE, value, Spaces(pad));
		} else {
			p += Com_sprintf(p, e - p, " %s%s", value, Spaces(pad));
		}
	}

	trap_SendServerCommand(-1, va("print \"%s\n\"", line));
}
Esempio n. 22
0
TCPCarrier::TCPCarrier(int32_t fd)
: IOHandler(fd, fd, IOHT_TCP_CARRIER) {
	IOHandlerManager::EnableReadData(this);
	_writeDataEnabled = false;
	_enableWriteDataCalled = false;
	memset(&_farAddress, 0, sizeof (sockaddr_in));
	_farIp = "";
	_farPort = 0;
	memset(&_nearAddress, 0, sizeof (sockaddr_in));
	_nearIp = "";
	_nearPort = 0;
	GetEndpointsInfo();
	_rx = 0;
	_tx = 0;
	_ioAmount = 0;
	_lastRecvError = 0;
	_lastSendError = 0;

	Variant stats;
	GetStats(stats);
}
Esempio n. 23
0
void CTransfersView::UpdateStats(CDCCTransfer *pDCCTransfer)
{
  TransferStats_t *pTS = GetStats(pDCCTransfer);
  if (!pTS)
    return;

  // Shuffle the Snapshots.  FIFO.
  for (int i = 1 ; i < TS_SNAPSHOTS_MAX ; i ++) // note, starting at 1, not 0
  {
    pTS->Snapshots[i-1] = pTS->Snapshots[i];
    pTS->SnapshotTimes[i-1] = pTS->SnapshotTimes[i];
  }

  pTS->Snapshots[TS_SNAPSHOTS_MAX-1] = pDCCTransfer->m_Position - pTS->LastPosition;
  pTS->LastPosition = pDCCTransfer->m_Position;
  time(&(pTS->SnapshotTimes[TS_SNAPSHOTS_MAX-1]));

  // point to the first snapshot
  if (pTS->FirstSnapshot > 0) 
    pTS->FirstSnapshot--;

}
Esempio n. 24
0
void RageDisplay::ProcessStatsOnFlip()
{
	g_iFramesRenderedSinceLastCheck++;
	g_iFramesRenderedSinceLastReset++;

	if( g_LastCheckTimer.PeekDeltaTime() >= 1.0f )	// update stats every 1 sec.
	{
		float fActualTime = g_LastCheckTimer.GetDeltaTime();
		g_iNumChecksSinceLastReset++;
		g_iFPS = lrintf( g_iFramesRenderedSinceLastCheck / fActualTime );
		g_iCFPS = g_iFramesRenderedSinceLastReset / g_iNumChecksSinceLastReset;
		g_iCFPS = lrintf( g_iCFPS / fActualTime );
		g_iVPF = g_iVertsRenderedSinceLastCheck / g_iFramesRenderedSinceLastCheck;
		g_iFramesRenderedSinceLastCheck = g_iVertsRenderedSinceLastCheck = 0;
		if( LOG_FPS )
		{
			RString sStats = GetStats();
			sStats.Replace( "\n", ", " );
			LOG->Trace( "%s", sStats.c_str() );
		}
	}
}
Esempio n. 25
0
static void G_LogStatsRow(int clientNum)
{
	char row[STRLEN("SR: Num")
		+ ARRAY_LEN(logColumns) * (STAT_COL_WIDTH + 1)
		+ 1 + STRLEN("Team")
		+ 1 + MAX_NETNAME + 1];
	int			stats[STAT_MAX];
	gclient_t	*client = level.clients + clientNum;
	int			i;

	GetStats(stats, client);

	Com_sprintf(row, sizeof(row), "SR: %3i", clientNum);
	for (i = 0; i < ARRAY_LEN(logColumns); i++) {
		Q_strcat(row, sizeof(row),
			va(" %" STR(STAT_COL_WIDTH) "i", stats[logColumns[i]]));
	}

	G_LogPrintf(LOG_GAME_STATS, "%s %-4s %s\n", row,
		teamNameUpperCase[client->sess.sessionTeam],
		client->pers.netname);
}
Esempio n. 26
0
	void Spell::HandleBuffEffect(GameObject *target, SpellEffectData &effect, SpellState &state)
	{
		auto character = target->FindComponent<CharacterComponent>();
		CharacterStats &targetStats = character->GetStats();

		
		int32_t statValue = effect.percentSourceMin;

		StatusEffectType type;
		if (effect.effectType == SpellEffectBuff) {
			type = StatusEffectBuff;
		}
		else {
			type = StatusEffectDebuff;
			statValue *= -1;
		}

		double buffValue = (double) statValue * 0.01;

		std::string name = mData->GetName() + "_" + effect.id.toString();

		if (!this->FindStatusEffect(character, name, effect)) {
			STAT_STATUS_EFFECT_DESC desc;
			desc.Target = target;
			desc.Type = type;
			desc.Duration = effect.buffDuration * 1000;
			desc.Name = name;
			desc.Stat = effect.buffSource;
			desc.AddValue = effect.flatAmountMin;
			desc.MultiplyValue = buffValue;
			desc.RootSpell = this;

			StatStatusEffect *status = new StatStatusEffect(desc);
			character->AddStatusEffect(status);
		}
	}
/**
 * Handles the statistics sub-command.
 *
 * @returns Suitable exit code.
 * @param   pArgs               The handler arguments.
 * @param   pDebugger           Pointer to the debugger interface.
 */
static RTEXITCODE handleDebugVM_Statistics(HandlerArg *pArgs, IMachineDebugger *pDebugger)
{
    /*
     * Parse arguments.
     */
    bool                        fWithDescriptions   = false;
    const char                 *pszPattern          = NULL; /* all */
    bool                        fReset              = false;

    RTGETOPTSTATE               GetState;
    RTGETOPTUNION               ValueUnion;
    static const RTGETOPTDEF    s_aOptions[] =
    {
        { "--descriptions", 'd', RTGETOPT_REQ_NOTHING },
        { "--pattern",      'p', RTGETOPT_REQ_STRING  },
        { "--reset",        'r', RTGETOPT_REQ_NOTHING  },
    };
    int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, 0 /*fFlags*/);
    AssertRCReturn(rc, RTEXITCODE_FAILURE);

    while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0)
    {
        switch (rc)
        {
            case 'd':
                fWithDescriptions = true;
                break;

            case 'p':
                if (pszPattern)
                    return errorSyntax("Multiple --pattern options are not permitted");
                pszPattern = ValueUnion.psz;
                break;

            case 'r':
                fReset = true;
                break;

            default:
                return errorGetOpt(rc, &ValueUnion);
        }
    }

    if (fReset && fWithDescriptions)
        return errorSyntax("The --reset and --descriptions options does not mix");

    /*
     * Execute the order.
     */
    com::Bstr bstrPattern(pszPattern);
    if (fReset)
        CHECK_ERROR2I_RET(pDebugger, ResetStats(bstrPattern.raw()), RTEXITCODE_FAILURE);
    else
    {
        com::Bstr bstrStats;
        CHECK_ERROR2I_RET(pDebugger, GetStats(bstrPattern.raw(), fWithDescriptions, bstrStats.asOutParam()),
                          RTEXITCODE_FAILURE);
        /* if (fFormatted)
         { big mess }
         else
         */
        RTPrintf("%ls\n", bstrStats.raw());
    }

    return RTEXITCODE_SUCCESS;
}
Esempio n. 28
0
void 
CNdasUnitDevice::GetStats(NDAS_UNITDEVICE_STAT& stat)
{
	InstanceAutoLock autolock(this);
	stat = GetStats();
}
Esempio n. 29
0
 /**
  * Convenience function, determines whether stats are valid
  *
  * @return True if stats valid
  */
 gcc_pure
 bool StatsValid() const {
     return GetStats().task_valid;
 }
Esempio n. 30
0
int main(int argc, char **argv)
{
	if(argc==1) PrintHelp();

	scaledCost = 0;
	
	time_t startTime;
	srand(time(&startTime));
	
	outputFilename = (char *)"output.txt";
	
	functionMapping = (char *)"UABCDEFGHIJKLMNOPQRSTVWXYZ";//"UEGMPTBFOARDC";
	
	sizeCutoff = 1; densityCutoff=0; pCutoff=1.000001;
	
	ReadParameters(argc, argv);
	
	printf("Graph filename:         %s\n",graphFilename);
	printf("Number of nodes:        %d\n\n",numVerts = ReadClusteringNumber(graphFilename));
	if(numVerts== -1){
		fprintf(stderr,"Graph input error.  File %s is nonexistent, unreadable, or not a valid graph file.  QUITTING.\n",graphFilename);
		printUsageError();
		return 0;		
	}
	
	
	printf("Clustering filename:    %s\n",clusteringFilename);
	printf("Number of clusters:     %d\n\n",numClust = ReadClusteringNumber(clusteringFilename));
	if(numClust == -1){
		fprintf(stderr,"Clustering input error.  File %s is nonexistent, unreadable, or not a valid clustering file.  QUITTING.\n",clusteringFilename);
		printUsageError();
		return 0;		
	}
	
	//printf("Number of complexes:  %d\n",numberOfComplexes = ReadClusteringNumber(complexFilename));
	
	
	printf("Protein name filename:  %s\n\n",nameFilename);
	
	
	
	NumFunctions = strlen(functionMapping);
	printf("%-3dfunctional groups:   %s\n\n",NumFunctions, functionMapping);
	
	printf("Prediction cutoffs:\n     Size    >= %d.\n     Density >= %-1.3f.\n     P-value <= %-.1e.\n\n",
		   sizeCutoff, densityCutoff, pCutoff);
	
	
	
	/* FIX COMPUTATION OF BEST P-VALUE.
	 * WRITE THE REST OF THE CHAPTER.*/
	
	
	//initialize the arrays.
	
	ComplexList = new SLList[numberOfComplexes];
	proteinName = new std::string[numVerts];
	Function = new char[numVerts];
	FunctionNum = new int[numVerts];
	FunctionSize = new int[NumFunctions];
	GetProteinNames(nameFilename);
	
	whichCluster = new int[numVerts];
	AlreadyCounted = new bool[numVerts];
	ComplexSize = new int[numberOfComplexes];
	numberMatched = new int[numberOfComplexes];
	
	numClust = CountClusters(clusteringFilename);
	ClusterSize = new int[numClust];
	ClusterDensity = new float[numClust];
	ComplexDensity = new float[numberOfComplexes];
	
	ClusterP = new double[numClust];
	ComplexP = new double[numberOfComplexes];
	ComplexPee = new double[numberOfComplexes];
	
	ClusterFunction = new int[numClust];
	ComplexFunction = new int[numberOfComplexes];
	
	ClusterMatched = new bool[numClust];
	ComplexMatched = new bool[numberOfComplexes];
	ClusterSMatched = new bool[numClust];
	ComplexSMatched = new bool[numberOfComplexes];
	
	MainInComplex = new int[numberOfComplexes];
	MainInCluster = new int[numClust];
	UnknownInComplex = new int[numberOfComplexes];
	UnknownInCluster = new int[numClust];
	
	
	ComplexList = new SLList[numberOfComplexes];
	
	MaxMatch = new int[numClust];
	MaxMatchPct = new float[numClust];
	MaxMatchWith = new int[numClust];
	MaxMatchPctWith = new int[numClust];
	for(int clust = 1; clust < numClust; clust++){
		MaxMatch[clust]=0;
		MaxMatchPct[clust]=0;
		MaxMatchWith[clust]=0;
		MaxMatchPctWith[clust]=0;
	}
	
	
	ReadClustering(clusteringFilename);
	graph.SetNumClust(numClust);
	
	//printf("%d clusters....\n",(int) graph.NUM_CLUST);
	
	graph.MakeGraph(graphFilename);
	graph.CheckAdjList();
	graph.FillAdjList();
	
	graph.InitClustering(whichCluster);
	//graph.SetInitialNumAndDom();
	
	//Matching criteria
	//ComplexCutoff=.7; ClusterCutoff=.7;
	//ComConCutoff=1.1; CluConCutoff=.9;
	
	//ReadComplexes(complexFilename);
	
	
	//	GenVertexPermutation(graph.Order);
	
	//GetComplexP();
	GetClusterP();
	
	//	Match();
	
	GetStats();
	
	
  	//WriteData(outputFilename);
	
	printf("\n");
	WriteVerbalData2(outputFilename);
	
	//printf("PARAMS: %d %f %f\n",	sizeCutoff,densityCutoff, pCutoff);
	
	
	//WriteComposition(outputFilename);
	
	/*
	 for(int clust=0; clust<numClust; clust++){
	 if(!ClusterMatched[clust]){
	 printf("Cluster %d unmatched. Tops are %d/%d with %d (size %d) and %f with %d (size %d).\n",
	 clust, MaxMatch[clust], (int) graph.ClusterSize[clust],
	 MaxMatchWith[clust], ComplexSize[MaxMatchWith[clust]],
	 MaxMatchPct[clust], MaxMatchPctWith[clust],
	 ComplexSize[MaxMatchPctWith[clust]]);
	 }
	 
	 }
	 */
	
	return 0;
}