本文整理汇总了C++中Stat::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Stat::begin方法的具体用法?C++ Stat::begin怎么用?C++ Stat::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stat
的用法示例。
在下文中一共展示了Stat::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cleanup
void cleanup() {
Stat stat;
stat.scan_directory( fs::path(".test"), SCAN_MODE_RECURSIVE | SCAN_MODE_FILES | SCAN_MODE_DIRS );
stat.sort();
std::reverse( stat.begin(), stat.end() );
stat.remove();
fs::remove( fs::path(".test") );
}
示例2: 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;
}
示例3: main
/* ===== MAIN ===== */
int main(int argc, char * argv[]) {
stat.begin();
std::atexit(exiting);
signal(SIGSEGV, handler); // install our handler of errors
static const unsigned DEFAULTDEPTH = 10;
int depthlim = DEFAULTDEPTH; // maxdepth
char* tc_folder = NULL; // folder containing test cases
bool isProject = false; // project test cases into local ones or not
enum {
BFS, DFS, RANDOM, HIT_OR_JUMP, INTERACTIVE
} traversal = BFS;
if (argc < 3) {
fprintf(stderr,
"\n Usage: %s [options]\n",
argv[0]);
fprintf(stderr, " where [options] may be\n");
fprintf(stderr, " . exploration options [-bfs|-dfs|-ran|-hoj|-ite] : exploration policy:\n");
fprintf(stderr, " -bfs : breadth first\n");
fprintf(stderr, " -dfs : depth first\n");
fprintf(stderr, " -ran : random\n");
fprintf(stderr, " -hoj : hit-or-jump\n");
fprintf(stderr, " -ite : interactive in command line\n");
fprintf(stderr, " [-d integer] : maximal exploration depth\n");
fprintf(stderr, " . test case options\n");
fprintf(stderr, " [-o filename]: path to a folder using to contain test cases generated (default is the current folder)\n");
fprintf(stderr, " [-sp] : split test cases to local ones\n");
fprintf(stderr, "\n");
return 1;
}
printf("_________________________________________________________________\n");
printf("INPUT:\n");
for (int i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
if (!strcmp(argv[i], "-bfs")){
traversal = BFS;
printf(" - Exploration policy: BFS\n");
}else if (!strcmp(argv[i], "-dfs")){
traversal = DFS;
printf(" - Exploration policy: BFS\n");
}else if (!strcmp(argv[i], "-hoj")){
traversal = HIT_OR_JUMP;
printf(" - Exploration policy: Hit-or-Jump\n");
}else if (!strcmp(argv[i], "-ran")){
traversal = RANDOM;
printf(" - Exploration policy: Random\n");
}else if (!strcmp(argv[i], "-o")){
tc_folder = (i == argc - 1) ? NULL : argv[i + 1];
printf(" - Test cases output folder: %s\n", tc_folder);
}else if (!strcmp(argv[i], "-d")) {
if (i < argc) {
depthlim = atoi(argv[i + 1]);
printf(" - Maximal exploration depth: %d\n", depthlim);
}
}
else if (!strcmp(argv[i], "-sp")){
isProject = true;
printf(" - Project global test cases on local ones\n");
}
}
}
printf("_________________________________________________________________\n");
printf("PROCESSING ... \n");
IfEngine* engine = new IfIterator();
tsp::Explorator *expl = NULL;
if (traversal == BFS || traversal == DFS) {
expl = new tsp::Exhaustive(engine, traversal == BFS);
}
else if (traversal == HIT_OR_JUMP) {
expl = new tsp::HitOrJump(engine);
}
else if (traversal == RANDOM){
expl = new tsp::RandomExplorator(engine);
}
if (expl){
stat.expl = expl;
expl->isProjectTestCases = isProject;
if (tc_folder)
expl->testCasesFolder = string(tc_folder);
expl->numberOfTestCasesGenerated = 0;
expl->visitAll(depthlim);
}
//processing time
return 0;
}
示例4: SSfind
Stat::iterator SSfind(Stat &S, int i){
for (Stat::iterator it = S.begin(); it != S.end(); it++){
if (it->count(i)) return it;
}
return S.end();
}