本文整理汇总了C++中Uint32函数的典型用法代码示例。如果您正苦于以下问题:C++ Uint32函数的具体用法?C++ Uint32怎么用?C++ Uint32使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Uint32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestTimeout
static void TestTimeout()
{
Monitor monitor;
HTTPConnector httpConnector(&monitor);
WSMANExportClient client(&httpConnector,&monitor);
const int TIMEOUT_MILLISECONDS =
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS * 2;
PEGASUS_TEST_ASSERT(client.getTimeout() ==
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
client.setTimeout(TIMEOUT_MILLISECONDS);
PEGASUS_TEST_ASSERT(client.getTimeout() == Uint32(TIMEOUT_MILLISECONDS));
client.setTimeout(PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
PEGASUS_TEST_ASSERT(client.getTimeout() ==
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
//
// Test setTimeout while connected
//
Uint32 port =
System::lookupPort(WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
client.connect("localhost", port);
PEGASUS_TEST_ASSERT(client.getTimeout() ==
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
client.setTimeout(TIMEOUT_MILLISECONDS);
PEGASUS_TEST_ASSERT(client.getTimeout() == Uint32(TIMEOUT_MILLISECONDS));
client.setTimeout(PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
PEGASUS_TEST_ASSERT(client.getTimeout() ==
PEGASUS_DEFAULT_CLIENT_TIMEOUT_MILLISECONDS);
}
示例2: Uint32
void Space::RefreshBackground()
{
const SystemPath &path = m_starSystem->GetPath();
Uint32 _init[5] = { path.systemIndex, Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), UNIVERSE_SEED };
Random rand(_init, 5);
m_background.reset(new Background::Container(Pi::renderer, rand));
}
示例3: GetSysPolitStarSystem
void GetSysPolitStarSystem(const StarSystem *s, const fixed human_infestedness, SysPolit &outSysPolit)
{
SystemPath path = s->GetPath();
const Uint32 _init[5] = { Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), path.systemIndex, POLIT_SEED };
Random rand(_init, 5);
const Sector* sec = Sector::cache.GetCached(path);
GovType a = GOV_INVALID;
/* from custom system definition */
if (sec->m_systems[path.systemIndex].customSys) {
Polit::GovType t = sec->m_systems[path.systemIndex].customSys->govType;
a = t;
}
if (a == GOV_INVALID) {
if (path == SystemPath(0,0,0,0)) {
a = Polit::GOV_EARTHDEMOC;
} else if (human_infestedness > 0) {
// attempt to get the government type from the faction
a = s->GetFaction()->PickGovType(rand);
// if that fails, either no faction or a faction with no gov types, then pick something at random
if (a == GOV_INVALID) {
a = static_cast<GovType>(rand.Int32(GOV_RAND_MIN, GOV_RAND_MAX));
}
} else {
a = GOV_NONE;
}
}
outSysPolit.govType = a;
outSysPolit.lawlessness = s_govDesc[a].baseLawlessness * rand.Fixed();
}
示例4: IsCommodityLegal
bool IsCommodityLegal(const StarSystem *s, const Equip::Type t)
{
SystemPath path = s->GetPath();
const Uint32 _init[5] = { Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), path.systemIndex, POLIT_SALT };
Random rand(_init, 5);
Polit::GovType a = s->GetSysPolit().govType;
if (a == GOV_NONE) return true;
if(s->GetFaction()->idx != Faction::BAD_FACTION_IDX ) {
Faction::EquipProbMap::const_iterator iter = s->GetFaction()->equip_legality.find(t);
if( iter != s->GetFaction()->equip_legality.end() ) {
const Uint32 per = (*iter).second;
return (rand.Int32(100) >= per);
}
}
else
{
// this is a non-faction system - do some hardcoded test
switch (t) {
case Equip::HAND_WEAPONS:
return rand.Int32(2) == 0;
case Equip::BATTLE_WEAPONS:
return rand.Int32(3) == 0;
case Equip::NERVE_GAS:
return rand.Int32(10) == 0;
case Equip::NARCOTICS:
return rand.Int32(2) == 0;
case Equip::SLAVES:
return rand.Int32(16) == 0;
default: return true;
}
}
return true;
}
示例5: GetSysPolitStarSystem
void GetSysPolitStarSystem(const StarSystem *s, const fixed human_infestedness, SysPolit &outSysPolit)
{
SystemPath path = s->GetPath();
const unsigned long _init[5] = { Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), path.systemIndex, POLIT_SEED };
MTRand rand(_init, 5);
Sector sec(path.sectorX, path.sectorY, path.sectorZ);
GovType a = GOV_INVALID;
/* from custom system definition */
if (sec.m_systems[path.systemIndex].customSys) {
Polit::GovType t = sec.m_systems[path.systemIndex].customSys->govType;
a = t;
}
if (a == GOV_INVALID) {
if (path == SystemPath(0,0,0,0)) {
a = Polit::GOV_EARTHDEMOC;
} else if (human_infestedness > 0) {
a = static_cast<GovType>(rand.Int32(GOV_RAND_MIN, GOV_RAND_MAX));
} else {
a = GOV_NONE;
}
}
outSysPolit.govType = a;
outSysPolit.lawlessness = s_govDesc[a].baseLawlessness * rand.Fixed();
}
示例6: m_starSystemCache
Space::Space(Game *game, RefCountedPtr<Galaxy> galaxy, const SystemPath &path, Space* oldSpace)
: m_starSystemCache(oldSpace ? oldSpace->m_starSystemCache : galaxy->NewStarSystemSlaveCache())
, m_game(game)
, m_frameIndexValid(false)
, m_bodyIndexValid(false)
, m_sbodyIndexValid(false)
, m_bodyNearFinder(this)
#ifndef NDEBUG
, m_processingFinalizationQueue(false)
#endif
{
m_starSystem = galaxy->GetStarSystem(path);
Uint32 _init[5] = { path.systemIndex, Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), UNIVERSE_SEED };
Random rand(_init, 5);
m_background.reset(new Background::Container(Pi::renderer, rand));
CityOnPlanet::SetCityModelPatterns(m_starSystem->GetPath());
// XXX set radius in constructor
m_rootFrame.reset(new Frame(0, Lang::SYSTEM));
m_rootFrame->SetRadius(FLT_MAX);
GenBody(m_game->GetTime(), m_starSystem->GetRootBody().Get(), m_rootFrame.get());
m_rootFrame->UpdateOrbitRails(m_game->GetTime(), m_game->GetTimeStep());
GenSectorCache(galaxy, &path);
//DebugDumpFrames();
}
示例7: _formPartialMessage
static MessageLoaderParms _formPartialMessage(Uint32 code, Uint32 line)
{
String dftMsg = _xmlMessages[Uint32(code) - 1];
const char* key = _xmlKeys[Uint32(code) - 1];
dftMsg.append(": on line $0");
return MessageLoaderParms(key, dftMsg.getCString(), line);
}
示例8: Uint32
RefCountedPtr<Sector> GalaxyGenerator::GenerateSector(RefCountedPtr<Galaxy> galaxy, const SystemPath &path, SectorCache *cache)
{
const Uint32 _init[4] = { Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), UNIVERSE_SEED };
Random rng(_init, 4);
SectorConfig config;
RefCountedPtr<Sector> sector(new Sector(galaxy, path, cache));
for (SectorGeneratorStage *secgen : m_sectorStage)
if (!secgen->Apply(rng, galaxy, sector, &config))
break;
return sector;
}
示例9: NdbThreadFuncUpdate
extern "C" void* NdbThreadFuncUpdate(void* pArg)
{
myRandom48Init((long int)NdbTick_CurrentMillisecond());
unsigned nSucc = 0;
unsigned nFail = 0;
Ndb* pNdb = NULL ;
pNdb = new Ndb("TEST_DB");
VerifyMethodInt(pNdb, init());
VerifyMethodInt(pNdb, waitUntilReady());
while(NdbMutex_Trylock(g_pNdbMutex)) {
Uint32 nWarehouse = myRandom48(g_nWarehouseCount);
NdbConnection* pNdbConnection = NULL ;
VerifyMethodPtr(pNdbConnection, pNdb, startTransaction());
CHK_TR(pNdbConnection) ; // epaulsa
NdbOperation* pNdbOperationW = NULL ;
VerifyMethodPtr(pNdbOperationW, pNdbConnection, getNdbOperation(c_szWarehouse));
VerifyMethodInt(pNdbOperationW, interpretedUpdateTuple());
VerifyMethodInt(pNdbOperationW, equal(c_szWarehouseNumber, nWarehouse));
VerifyMethodInt(pNdbOperationW, incValue(c_szWarehouseCount, Uint32(1)));
Uint32 nWarehouseSum = 0;
for(Uint32 nDistrict=0; nDistrict<g_nDistrictPerWarehouse; ++nDistrict) {
NdbOperation* pNdbOperationD = NULL ;
VerifyMethodPtr(pNdbOperationD, pNdbConnection, getNdbOperation(c_szDistrict));
VerifyMethodInt(pNdbOperationD, interpretedUpdateTuple());
VerifyMethodInt(pNdbOperationD, equal(c_szDistrictWarehouseNumber, nWarehouse));
VerifyMethodInt(pNdbOperationD, equal(c_szDistrictNumber, nDistrict));
VerifyMethodInt(pNdbOperationD, incValue(c_szDistrictCount, Uint32(1)));
Uint32 nDistrictSum = myRandom48(100);
nWarehouseSum += nDistrictSum;
VerifyMethodInt(pNdbOperationD, setValue(c_szDistrictSum, nDistrictSum));
}
VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum));
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
}
if(iExec==0) {
++nSucc;
} else {
++nFail;
}
VerifyMethodVoid(pNdb, closeTransaction(pNdbConnection));
}
ndbout << "update: " << nSucc << " succeeded, " << nFail << " failed " << endl;
NdbMutex_Unlock(g_pNdbMutex);
delete pNdb;
pNdb = NULL ;
return NULL;
}
示例10: command
/**
getTotalVirtualMemorySize method for SunOS implementation of OS Provider
Gets information from swapinfo -q command (techically not swap
space, it's paging). Same as the information returned for
TotalSwapSpace.
*/
Boolean OSTestClient::goodTotalVirtualMemorySize(
const Uint64 &totalvmem,
Boolean verbose)
{
if (verbose)
cout<<"Checking TotalVirtualMemorySize "<<Uint32(totalvmem)<<endl;
Uint64 totalVMem = _totalVM();
if (verbose)
cout<<" Should be " << Uint32(totalVMem) << endl;
return (totalvmem == totalVMem); // will return false if totalVMem=0
}
示例11: assert
RefCountedPtr<StarSystem> GalaxyGenerator::GenerateStarSystem(RefCountedPtr<Galaxy> galaxy, const SystemPath &path, StarSystemCache *cache)
{
RefCountedPtr<const Sector> sec = galaxy->GetSector(path);
assert(path.systemIndex >= 0 && path.systemIndex < sec->m_systems.size());
Uint32 seed = sec->m_systems[path.systemIndex].GetSeed();
std::string name = sec->m_systems[path.systemIndex].GetName();
Uint32 _init[6] = { path.systemIndex, Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), UNIVERSE_SEED, Uint32(seed) };
Random rng(_init, 6);
StarSystemConfig config;
RefCountedPtr<StarSystem::GeneratorAPI> system(new StarSystem::GeneratorAPI(path, galaxy, cache, rng));
for (StarSystemGeneratorStage *sysgen : m_starSystemStage)
if (!sysgen->Apply(rng, galaxy, system, &config))
break;
return system;
}
示例12: ticket
void GameLog::DrawHudMessages(Graphics::Renderer *r)
{
Graphics::Renderer::StateTicket ticket(r);
Graphics::RenderStateDesc rsd;
rsd.depthTest = false;
rsd.depthWrite = false;
Graphics::RenderState *prsd = r->CreateRenderState(rsd);
//I'd rather render this as one string, but then we can't
//have per-line fade - markup doesn't support alpha
r->SetOrthographicProjection(0, m_screenSize.x, m_screenSize.y, 0, -1, 1);
r->SetTransform(matrix4x4f::Identity());
r->SetRenderState(prsd);
const Color &c = Color::WHITE;
float y = 0;
for (auto it = m_messages.rbegin(); it != m_messages.rend(); ++it) {
float alpha = 1.f;
if (it->time > FADE_AFTER) {
alpha = 1.0f - (float(it->time - FADE_AFTER) / float(FADE_TIME));
}
const Color textColour(c.r, c.g, c.b, Clamp(Uint32(alpha*255), 0U, 255U));
m_font->RenderString(it->msg.c_str(), m_offset.x, m_offset.y + y, textColour);
y -= m_lineHeight;
}
}
示例13: srand
Perlin::Perlin() {
srand( Uint32( time( NULL ) ) );
p = new Sint32[256];
Gx = new GLfloat[256];
Gy = new GLfloat[256];
Gz = new GLfloat[256];
for ( Sint32 i=0; i < 256; ++i )
{
p[i] = i;
Gx[i] = ( GLfloat( rand() ) / ( RAND_MAX/2 ) ) - 1.0f;
Gy[i] = ( GLfloat( rand() ) / ( RAND_MAX/2 ) ) - 1.0f;
Gz[i] = ( GLfloat( rand() ) / ( RAND_MAX/2 ) ) - 1.0f;
}
Sint32 j=0;
Sint32 swp=0;
for ( Sint32 i=0; i < 256; i++ )
{
j = rand() & 255;
swp = p[i];
p[i] = p[j];
p[j] = swp;
}
}
示例14: SplitPath
void FileSourceZip::AddFile(const std::string &path, const FileStat &fileStat)
{
std::vector<std::string> fragments;
SplitPath(path, fragments);
assert(fragments.size() > 0);
Directory *dir = &m_root;
if (fragments.size() > 1) {
std::string fullPath;
for (unsigned int i = 0; i < fragments.size()-1; i++) {
fullPath += ((i > 0) ? "/" : "") + fragments[i];
std::map<std::string,FileStat>::const_iterator it = dir->files.find(fragments[i]);
if (it == dir->files.end())
dir->files.insert(std::make_pair(fragments[i], FileStat(Uint32(-1), 0, MakeFileInfo(fullPath, FileInfo::FT_DIR))));
dir = &(dir->subdirs[fragments[i]]);
}
}
const std::string &filename = fragments.back();
if (fileStat.info.IsDir())
dir->subdirs.insert(std::make_pair(filename, Directory()));
dir->files.insert(std::make_pair(filename, fileStat));
}
示例15: sizeof
inline
void
RecordPool<T, P>::init(Uint32 type_id, const Pool_context& pc)
{
T tmp;
const char * off_base = (char*)&tmp;
const char * off_next = (char*)&tmp.nextPool;
const char * off_magic = (char*)&tmp.m_magic;
Record_info ri;
ri.m_size = sizeof(T);
ri.m_offset_next_pool = Uint32(off_next - off_base);
ri.m_offset_magic = Uint32(off_magic - off_base);
ri.m_type_id = type_id;
m_pool.init(ri, pc);
}