本文整理汇总了C++中UpdateStats函数的典型用法代码示例。如果您正苦于以下问题:C++ UpdateStats函数的具体用法?C++ UpdateStats怎么用?C++ UpdateStats使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateStats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hashbuild
/*
* hashbuild() -- build a new hash index.
*
* We use a global variable to record the fact that we're creating
* a new index. This is used to avoid high-concurrency locking,
* since the index won't be visible until this transaction commits
* and since building is guaranteed to be single-threaded.
*/
Datum
hashbuild(PG_FUNCTION_ARGS)
{
Relation heap = (Relation) PG_GETARG_POINTER(0);
Relation index = (Relation) PG_GETARG_POINTER(1);
IndexInfo *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
double reltuples;
HashBuildState buildstate;
/*
* We expect to be called exactly once for any index relation. If
* that's not the case, big trouble's what we have.
*/
if (RelationGetNumberOfBlocks(index) != 0)
elog(ERROR, "index \"%s\" already contains data",
RelationGetRelationName(index));
/* initialize the hash index metadata page */
_hash_metapinit(index);
/* build the index */
buildstate.indtuples = 0;
/* do the heap scan */
reltuples = IndexBuildHeapScan(heap, index, indexInfo,
hashbuildCallback, (void *) &buildstate);
/*
* Since we just counted the tuples in the heap, we update its stats
* in pg_class to guarantee that the planner takes advantage of the
* index we just created. But, only update statistics during normal
* index definitions, not for indices on system catalogs created
* during bootstrap processing. We must close the relations before
* updating statistics to guarantee that the relcache entries are
* flushed when we increment the command counter in UpdateStats(). But
* we do not release any locks on the relations; those will be held
* until end of transaction.
*/
if (IsNormalProcessingMode())
{
Oid hrelid = RelationGetRelid(heap);
Oid irelid = RelationGetRelid(index);
heap_close(heap, NoLock);
index_close(index);
UpdateStats(hrelid, reltuples);
UpdateStats(irelid, buildstate.indtuples);
}
PG_RETURN_VOID();
}
示例2: GetAsyncKeyState
void StatBooster::ProcessKeyStrokes(HANDLE processHandle, HWND windowHandle, int memoryAddress, bool &stopped, bool &active, bool &activeStatusChanged, CharStats *charStats, CharStats *storedCharStats, Stats *stats, POINT &store_btn_coord, POINT &recall_btn_coord, POINT &reroll_btn_coord)
{
int escKeyState = GetAsyncKeyState(VK_ESCAPE);
int f1KeyState = GetKeyState(VK_F1);
int f2KeyState = GetAsyncKeyState(VK_F2);
int f5KeyState = GetAsyncKeyState(VK_F5);
int f6KeyState = GetAsyncKeyState(VK_F6);
int f7KeyState = GetAsyncKeyState(VK_F7);
int f8KeyState = GetAsyncKeyState(VK_F8);
if (escKeyState != 0)
{
stopped = true;
}
if (f1KeyState == 0 || f1KeyState == 1)
{
if (active != (f1KeyState == 1))
{
active = (f1KeyState == 1);
activeStatusChanged = true;
}
}
if (f2KeyState != 0 && !charStats->isBg1TomesUsed())
{
charStats->setBg1TomesUsed(true);
system("cls");
UpdateStats(processHandle, memoryAddress, charStats, stats, true);
AddBG1TomeStats(processHandle, memoryAddress, charStats->getStrength(), charStats->getDexterity(), charStats->getConstitution(), charStats->getIntelligence(), charStats->getWisdom(), charStats->getCharisma());
UpdateStats(processHandle, memoryAddress, charStats, stats, false);
PrintStats(charStats, storedCharStats, stats);
}
if (f5KeyState != 0)
{
UpdateMouseCoord(windowHandle, store_btn_coord);
}
if (f6KeyState != 0)
{
UpdateMouseCoord(windowHandle, recall_btn_coord);
}
if (f7KeyState != 0)
{
UpdateMouseCoord(windowHandle, reroll_btn_coord);
}
if (f8KeyState != 0)
{
storedCharStats->reset();
system("cls");
PrintStats(charStats, storedCharStats, stats);
}
}
示例3: InitUnitTypes
/**
** Init unit types.
*/
void InitUnitTypes(int reset_player_stats)
{
for (size_t i = 0; i < UnitTypes.size(); ++i) {
CUnitType &type = *UnitTypes[i];
Assert(type.Slot == (int)i);
if (type.Animations == NULL) {
DebugPrint(_("unit-type '%s' without animations, ignored.\n") _C_ type.Ident.c_str());
continue;
}
// Add idents to hash.
UnitTypeMap[type.Ident] = UnitTypes[i];
// Determine still frame
type.StillFrame = GetStillFrame(type);
// Lookup BuildingTypes
for (std::vector<CBuildRestriction *>::iterator b = type.BuildingRules.begin();
b < type.BuildingRules.end(); ++b) {
(*b)->Init();
}
// Lookup AiBuildingTypes
for (std::vector<CBuildRestriction *>::iterator b = type.AiBuildingRules.begin();
b < type.AiBuildingRules.end(); ++b) {
(*b)->Init();
}
}
// LUDO : called after game is loaded -> don't reset stats !
UpdateStats(reset_player_stats); // Calculate the stats
}
示例4: UpdateCardList
void
DeckLibraryTab::Update ()
{
UpdateCardList();
UpdateTotalCardCount();
UpdateStats();
}
示例5: ASSERT
void LayerPanel::UpdateSelection(void)
{
TileLayer *activeLayer = NULL;
uint32 a = _engine->GetDrawPanel()->GetActiveLayerId();
for(uint32 i = 0; i < LAYER_MAX; i++)
{
TileLayer *layer = _engine->GetLayerMgr()->GetLayer(i);
uint8 alpha = layer->visible ? 255 : 150;
if(i == a)
{
activeLayer = layer;
btnLayers[i]->setBaseColor(gcn::Color(180,255,180,alpha));
}
else
{
btnLayers[i]->setBaseColor(gcn::Color(128,128,144,alpha));
}
btnLayers[i]->setCaption(layer->name);
}
ASSERT(activeLayer);
char buf[30];
sprintf(buf, a < 10 ? "Layer 0%u:" : "Layer %u:", a);
lDesc->setCaption(buf);
tfName->setText(activeLayer->name);
cbVisible->setSelected(activeLayer->visible);
UpdateStats(activeLayer);
}
示例6: CalculateProbeValue
void ValuesTable::UpdateProbesValues(int index, bool &stats_updated, bool &view_updated) {
for (int i = index - m_draw->m_draws_controller->GetFilter() ; i <= m_draw->m_draws_controller->GetFilter() + index; ++i) {
if (i < 0 || i >= (int)m_values.size())
continue;
ValueInfo& n = m_values.at(i);
if (i == index) {
if (n.n_count != 2 * m_draw->m_draws_controller->GetFilter()) {
n.state = ValueInfo::NEIGHBOUR_WAIT;
continue;
}
} else {
++n.n_count;
if (n.state != ValueInfo::NEIGHBOUR_WAIT || n.n_count < 2 * m_draw->m_draws_controller->GetFilter())
continue;
}
n.state = ValueInfo::PRESENT;
CalculateProbeValue(i);
if (i >= m_view.Start() && i <= m_view.End()) {
m_draw->m_observers->NotifyNewData(m_draw, i - m_view.Start());
view_updated = true;
}
if (i >= m_stats.Start() && i <= m_stats.End()) {
UpdateStats(i);
stats_updated = true;
}
}
}
示例7: Stats
/*------------------------------------------------------------------------------
-- FUNCTION: Stats
--
-- DATE: Nov 18, 2010
--
-- REVISIONS: (Date and Description)
--
-- DESIGNER: Marcel Vangrootheest
--
-- PROGRAMMER: Marcel Vangrootheest
--
-- INTERFACE: BOOL CALLBACK Stats (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-- hDlg - handle to the Dialog
-- message - the message received
-- wParam - contents vary based on the message
-- lParam - contents vary based on the message
--
-- RETURNS: BOOL - returns true if the message was handled.
--
-- NOTES: This is the Dialog process for the Statistics Box.
--
--
------------------------------------------------------------------------------*/
BOOL CALLBACK Stats (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
PWNDDATA pwd = (PWNDDATA) GetWindowLongPtr(GetParent(hDlg), 0);
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_CLEAR_STATS:
NUM_FILES = 0;
SENT_ACK = 0;
REC_ACK = 0;
SENT_EOT = 0;
REC_EOT = 0;
SENT_RVI = 0;
REC_RVI = 0;
DOWN_FRAMES = 0;
UP_FRAMES = 0;
DOWN_FRAMES_ACKD = 0;
UP_FRAMES_ACKD = 0;
UpdateStats(GetParent(hDlg));
return TRUE;
}
return FALSE;
case WM_CLOSE:
ShowWindow(hDlg, SW_HIDE);
return TRUE;
}
return FALSE;
}
示例8: UpdateStats
bool Pet::UpdateAllStats()
{
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
UpdateStats(Stats(i));
for (uint32 i = 0; i <= sChrPowerTypesStore.GetNumRows(); i++)
{
ChrPowerTypesEntry const* cEntry = sChrPowerTypesStore.LookupEntry(i);
if (!cEntry)
continue;
if (getClass() != cEntry->classId)
continue;
if (cEntry->power == 10)
continue;
SetMaxPower(Powers(cEntry->power), uint32(GetCreatePowers(Powers(cEntry->power))));
}
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
UpdateResistances(i);
return true;
}
示例9: GetLmrObjParams
void Ship::Init()
{
// XXX the animation namespace must match that in LuaConstants
// note: this must be set before generating the collision mesh
// (which happens in SetModel()) and before rendering
GetLmrObjParams().animationNamespace = "ShipAnimation";
GetLmrObjParams().equipment = &m_equipment;
const ShipType &stype = GetShipType();
// Dirty hack: Always use gear-down mesh for collision detection
// necessary because some ships have non-docking meshes too large for docking
float temp = GetLmrObjParams().animValues[ANIM_WHEEL_STATE];
GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = 1.0f;
SetModel(stype.lmrModelName.c_str());
GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = temp;
SetMassDistributionFromModel();
UpdateStats();
m_stats.hull_mass_left = float(stype.hullMass);
m_stats.shield_mass_left = 0;
m_hyperspace.now = false; // TODO: move this on next savegame change, maybe
m_hyperspaceCloud = 0;
m_landingGearAnimation = 0;
SceneGraph::Model *nmodel = dynamic_cast<SceneGraph::Model*>(GetModel());
if (nmodel) {
m_landingGearAnimation = nmodel->FindAnimation("gear_down");
}
}
示例10: udpioSend
int udpioSend(UDPIO *up, UINT32 ip, int port, char *buf, int buflen)
{
int sent;
LOGIO *lp;
struct sockaddr_in addr;
static int alen = sizeof(struct sockaddr_in);
static char *fid = "udpioSend";
if (up == NULL || buf == NULL) {
errno = EINVAL;
lp = (up == NULL) ? NULL : up->lp;
logioMsg(lp, LOG_ERR, "%s: NULL input not allowed", fid);
return -1;
}
memset((void *) &addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(ip);
addr.sin_port = htons((short) port);
sent = SENDTO(up->sd, buf, buflen, 0, &addr, alen);
UpdateStats(&up->stats.xmit, sent, utilTimeStamp());
return sent;
}
示例11: SetPosition
void AGameObject::PostInitializeComponents()
{
//LOG( "%s [%s]->AGameObject::PostInitializeComponents()", *GetName(), *Name );
Super::PostInitializeComponents();
if( RootComponent )
{
// Initialize position, but put object on the ground
SetPosition( GetActorLocation() );
// Attach contact function to all bounding components.
if( hitBox ) {
hitBox->OnComponentBeginOverlap.AddDynamic( this, &AGameObject::OnHitContactBegin );
hitBox->OnComponentEndOverlap.AddDynamic( this, &AGameObject::OnHitContactEnd );
}
else error( "NO HITBOX" );
if( repulsionBounds ) {
repulsionBounds->OnComponentBeginOverlap.AddDynamic( this, &AGameObject::OnRepulsionContactBegin );
repulsionBounds->OnComponentEndOverlap.AddDynamic( this, &AGameObject::OnRepulsionContactEnd );
}
else error( "NO REPULSIONBOUNDS" );
}
else
{
error( FS( "RootComponent wasn't set in PostInitializeComponents()" ) );
}
UpdateStats( 0.f );
Hp = Stats.HpMax;
Speed = 0.f;
Recovering = 1;
//InitIcons();
}
示例12: Render
/*****************************************************************************
* Render: display previously rendered output
*****************************************************************************
* This function sends the currently rendered image to Crop image, waits
* until it is displayed and switches the two rendering buffers, preparing next
* frame.
*****************************************************************************/
static void Render( vout_thread_t *p_vout, picture_t *p_pic )
{
picture_t *p_outpic = NULL;
int i_plane;
if( p_vout->p_sys->b_changed )
{
return;
}
while( ( p_outpic =
vout_CreatePicture( p_vout->p_sys->p_vout, 0, 0, 0 )
) == NULL )
{
if( !vlc_object_alive (p_vout) || p_vout->b_error )
{
vout_DestroyPicture( p_vout->p_sys->p_vout, p_outpic );
return;
}
msleep( VOUT_OUTMEM_SLEEP );
}
p_outpic->date = p_pic->date;
vout_LinkPicture( p_vout->p_sys->p_vout, p_outpic );
for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
uint8_t *p_in, *p_out, *p_out_end;
int i_in_pitch = p_pic->p[i_plane].i_pitch;
const int i_out_pitch = p_outpic->p[i_plane].i_pitch;
const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch;
p_in = p_pic->p[i_plane].p_pixels
/* Skip the right amount of lines */
+ i_in_pitch * ( p_pic->p[i_plane].i_visible_lines *
p_vout->p_sys->i_y / p_vout->output.i_height )
/* Skip the right amount of columns */
+ i_in_pitch * p_vout->p_sys->i_x / p_vout->output.i_width;
p_out = p_outpic->p[i_plane].p_pixels;
p_out_end = p_out + i_out_pitch * p_outpic->p[i_plane].i_visible_lines;
while( p_out < p_out_end )
{
vlc_memcpy( p_out, p_in, i_copy_pitch );
p_in += i_in_pitch;
p_out += i_out_pitch;
}
}
vout_UnlinkPicture( p_vout->p_sys->p_vout, p_outpic );
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
/* The source image may still be in the cache ... parse it! */
vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->b_autocrop )
UpdateStats( p_vout, p_pic );
vlc_mutex_unlock( &p_vout->p_sys->lock );
}
示例13: new
CmpStatement::ReturnStatus
CmpStatement::process (const CmpMessageUpdateHist& statement)
{
// A pointer to user SQL query is stored in CmpStatement; if an exception is
// thrown the user query is copied from here. It is reset upon return from
// the UpdateStats() method.
char *userStr= new (heap()) char[2000];
#pragma nowarn(1506) // warning elimination
Int32 len=strlen(statement.data());
#pragma warn(1506) // warning elimination
if (len > 1999)
len=1999;
strncpy(userStr, statement.data(), len);
userStr[len]='\0';
sqlTextStr_ = userStr;
if (UpdateStats(statement.data()))
{
sqlTextStr_=NULL;
return CmpStatement_ERROR;
}
sqlTextStr_=NULL;
return CmpStatement_SUCCESS;
}
示例14: UpdateStatStruct
/*------------------------------------------------------------------------------
-- FUNCTION: UpdateStatStruct
--
-- DATE: Dec 02, 2010
--
-- REVISIONS:
--
-- DESIGNER: Dean Morin
--
-- PROGRAMMER: Dean Morin
--
-- INTERFACE: UpdateStatStruct(HWND hWnd, WPARAM stat, LPARAM attribute)
-- hWnd - the handle to the window
-- stat - the stat category to update
-- attribute - info on how to alter the stat
--
-- RETURNS: VOID.
--
-- NOTES:
-- Updates the stats structure.
------------------------------------------------------------------------------*/
VOID UpdateStatStruct(HWND hWnd, WPARAM stat, LPARAM attribute) {
PWNDDATA pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0);
switch (stat) {
case STAT_STATE:
DL_STATE = attribute;
SendMessage(pwd->hDlgDebug, WM_USER, 0, 0);
break;
case ACK:
if (attribute == SENT) {
SENT_ACK++;
} else {
REC_ACK++;
}
break;
case EOT:
if (attribute == SENT) {
SENT_EOT++;
} else {
REC_EOT++;
}
break;
case RVI:
if (attribute == SENT) {
SENT_RVI++;
} else {
REC_RVI++;
}
break;
case STAT_FRAME:
if (attribute == SENT) {
UP_FRAMES++;
} else {
DOWN_FRAMES++;
}
break;
case STAT_FRAMEACKD:
if (attribute == SENT) {
pwd->FTPQueueSize--;
UP_FRAMES_ACKD++;
} else {
pwd->PTFQueueSize++;
DOWN_FRAMES_ACKD++;
}
break;
case STAT_FILE:
NUM_FILES++;
break;
}
UpdateStats(hWnd);
}
示例15: RecalcStats
static void RecalcStats(struct QuantizedValue *q)
{
if (q)
{
UpdateStats(q);
RecalcStats(q->Children[0]);
RecalcStats(q->Children[1]);
}
}