本文整理汇总了C++中Stat类的典型用法代码示例。如果您正苦于以下问题:C++ Stat类的具体用法?C++ Stat怎么用?C++ Stat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Directory::Entry::Type ScanningWatch::type(const Stat& stbuf) {
#ifdef _WIN32
if (stbuf.ISDEV()) {
return Directory::Entry::TYPE_DEV;
} else if (stbuf.ISDIR()) {
return Directory::Entry::TYPE_DIR;
} else if (stbuf.ISREG()) {
return Directory::Entry::TYPE_REG;
}
#else
if (stbuf.ISBLK()) {
return Directory::Entry::TYPE_BLK;
} else if (stbuf.ISCHR()) {
return Directory::Entry::TYPE_CHR;
} else if (stbuf.ISDIR()) {
return Directory::Entry::TYPE_DIR;
} else if (stbuf.ISFIFO()) {
return Directory::Entry::TYPE_FIFO;
} else if (stbuf.ISLNK()) {
return Directory::Entry::TYPE_LNK;
} else if (stbuf.ISREG()) {
return Directory::Entry::TYPE_REG;
} else if (stbuf.ISSOCK()) {
return Directory::Entry::TYPE_SOCK;
}
#endif
else {
debug_break();
return Directory::Entry::TYPE_REG;
}
}
示例2: foreach
void AMerge::clear_src() {
cout << "Remove source files ..." << flush;
foreach( fs::path dir, _directories ) {
Stat status;
status.scan_directory( dir, SCAN_MODE_RECURSIVE | SCAN_MODE_FILES | SCAN_MODE_DIRS );
status.remove();
}
示例3: equals
bool ScanningWatch::equals(const Stat& left, const Stat& right) {
return type(left) == type(right)
&&
left.get_mtime() == right.get_mtime()
&&
left.get_size() == right.get_size();
}
示例4: calculateCreatureStatModifiers
void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr)
{
CreatureStats &creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
const MagicEffects &effects = creatureStats.getMagicEffects();
// attributes
for(int i = 0;i < ESM::Attribute::Length;++i)
{
Stat<int> stat = creatureStats.getAttribute(i);
stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).mMagnitude -
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).mMagnitude);
creatureStats.setAttribute(i, stat);
}
// dynamic stats
for(int i = 0;i < 3;++i)
{
DynamicStat<float> stat = creatureStats.getDynamic(i);
stat.setModifier(effects.get(EffectKey(80+i)).mMagnitude -
effects.get(EffectKey(18+i)).mMagnitude);
creatureStats.setDynamic(i, stat);
}
}
示例5: DOS_ERROR
void CSStats::readFromXML( const std::string& entityID, const pugi::xml_node& node ) {
CStats component;
for( pugi::xml_node statNode : node ) {
Stat stat;
pugi::xml_attribute idAtt = statNode.attribute( "id" );
if( !idAtt ) {
DOS_ERROR( true, "Unable to load entity Stat. ID is missing" );
continue;
}
stat.setID( idAtt.as_int() );
pugi::xml_attribute valueAtt = statNode.attribute( "value" );
if( !valueAtt ) {
DOS_ERROR( true, "Unable to load entity Stat. Value is missing" );
continue;
}
stat.setBase( valueAtt.as_float() );
component.stats.push_back( stat );
}
COMPONENT_MANAGER.addProperty( component, entityID );
}
示例6: print_stats
void PIOS::print_stats(run_arg *args)
{
char regionstr[32], chunkstr[32], mbstr[32];
cfs_duration_t highest, lowest, average;
__u64 agvsize;
Stat *st = args->st;
assert(st != NULL);
st->Record("%d\t%s\t%llu\t%d\t%llu\t%s\t%s\t",
args->runno,
args->verify ? "Read" : "Write",
args->startime,
args->threadcount,
args->regioncount,
in_MBs(regionstr, args->regionsize),
in_MBs(chunkstr, args->chunksize));
/* TODO: chunk noise */
assert(args->chunknoise == 0);
agvsize = args->regionsize * args->regioncount;
find_high_low_duration(args, &highest, &lowest, &average);
in_MBs(mbstr, agvsize * params.TimeUnit / args->iotime);
st->Record("%s/s\t\t%2.3fs\t%2.3fs\t%2.3fs\n",
mbstr,
((double)(lowest / 1000000)) / 1000.0,
((double)(highest / 1000000)) / 1000.0,
((double)(args->iotime / 1000000)) / 1000.0);
}
示例7: connectionValid
bool connectionValid(int mask, Stat S){
for (int i = 0; i < 5; i++) if (maskGet(mask, i)){
Stat::iterator it = SSfind(S, i);
if (it != S.end()) S.erase(it);
}
return S.empty();
}
示例8: Print_Me
void Print_Me(){
printf("Score_Stats: ");
Score.Print_Me();
printf("\n");
printf("Length_Stats: ");
FinalGen.Print_Me();
printf("\n");
}
示例9: connect_server
static void connect_server(int thread_id, int repead_id, string host, int port)
{
char peerid[21], ip[16];
snprintf(peerid, 20, "%10d%10d", thread_id, repead_id);
peerid[20] = '\0';
snprintf(ip, 15, "%d.%d.%d.%d", thread_id & 0x000000ff, repead_id & 0x000000ff, port & 0x000000ff, host[0] & 0x000000ff);
ip[15] = '\0';
Peer peer;
peer.__set_ip(ip);
peer.__set_idc("tc");
peer.__set_port(host[1] & 0x000000ff);
peer.__set_peerid(peerid);
Stat stat;
stat.__set_downloaded(thread_id * repead_id);
stat.__set_left(thread_id + repead_id);
stat.__set_uploaded(thread_id);
stat.__set_status(static_cast<Status::type>(thread_id * repead_id % 5));
AnnounceRequest request;
request.__set_infohash("abcdefghijklmnopqrst");
request.__set_is_seed(thread_id * repead_id % 2);
request.__set_num_want(50);
request.__set_peer(peer);
request.__set_stat(stat);
//printf("%s:%d peerid: %s, infohash: %s, is_seed: %d, status: %d\n", ip, peer.port, peer.peerid.c_str(), request.infohash.c_str(), request.is_seed, stat.status);
AnnounceResponse response;
shared_ptr<TSocket> socket(new TSocket(host.c_str(), port));
socket->setConnTimeout(3000);
socket->setSendTimeout(3000);
socket->setRecvTimeout(5000);
shared_ptr<TTransport> transport(new TFramedTransport(socket));
shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(transport));
AnnounceClient client(protocol);
try {
transport->open();
client.announce(response, request);
transport->close();
//printf("success\n");
} catch (TException &tx) {
printf("ERROR: %s\n", tx.what());
return;
}
#if 0
printf("/*************************************************************/\n");
printf("%s:%d peerid: %s, infohash: %s, is_seed: %d, status: %d\n", ip, peer.port, peerid, request.infohash.c_str(), request.is_seed, stat.status);
printf("ret: %d, failure_reason: %s, min_interval: %d, have_seed: %d, peers_num: %ld\n"
, response.ret, response.failure_reason.c_str(), response.min_interval, response.have_seed, response.peers.size());
for (std::vector<Peer>::iterator it = response.peers.begin(); it != response.peers.end(); ++it) {
printf("%s:%d\n", it->ip.c_str(), it->port);
}
printf("/*************************************************************\n");
#endif
}
示例10: applyHPRegen
void CSStats::applyHPRegen( CStats& component ) {
Stat* health = component.getStat( Stat::SID_Health );
if( health ) {
Stat* hpRegen = component.getStat( Stat::SID_HPRegen );
if( hpRegen ) {
health->change( hpRegen->max );
}
}
}
示例11: SScombine
void SScombine(Stat &S, int i, int j){
Stat::iterator iti = SSfind(S, i);
Stat::iterator itj = SSfind(S, j);
if (iti == itj) return;
set<int> s(*iti);
for (set<int>::iterator it = itj->begin(); it != itj->end(); it++){
s.insert(*it);
}
S.erase(iti);
S.erase(itj);
S.insert(s);
}
示例12: safe_print
void StatisticsBase::safeFlushInformation(int fd) const {
#ifdef CVC4_STATISTICS_ON
for (StatSet::iterator i = d_stats.begin(); i != d_stats.end(); ++i) {
Stat* s = *i;
if (d_prefix.size() != 0) {
safe_print(fd, d_prefix);
safe_print(fd, s_regDelim);
}
s->safeFlushStat(fd);
safe_print(fd, "\n");
}
#endif /* CVC4_STATISTICS_ON */
}
示例13: strFromStat
string strFromStat(Stat S){
string s;
for (Stat::iterator it = S.begin(); it != S.end(); it++){
string tmp = "{";
for (set<int>::iterator i = it->begin(); i != it->end(); i++){
tmp += strFromInt(*i) + ", ";
}
tmp[tmp.size() - 2] = '}';
tmp[tmp.size() - 1] = ' ';
s += tmp;
}
return s;
}
示例14: getStat0
Stat getStat0(int m){
Stat S;
set<int> cur;
for (int i = 0; i < 5; i++) if (maskGet(m, i)) {
if (i != 0 && !maskGet(m, i - 1) ){
if (!cur.empty()) S.insert(cur);
cur.clear();
}
cur.insert(i);
}
if (!cur.empty()) S.insert(cur);
return S;
}
示例15: query_data_by_others
/* 测量项目other在min和max之间的人找出来,统计他们的item的值 */
void Query::query_data_by_others(Stat &stat, QString item, QString other, float min, float max)
{
stat.reset();
for (int i = 0; i < npeople; i++) {
float other_data = get_data_by_item(&people[i], other);
if (other_data <= max && other_data >= min) {
float data = get_data_by_item(&people[i], item);
if (data != -1) {
stat.add_element(data);
}
}
}
}