这篇教程C++ touch函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中touch函数的典型用法代码示例。如果您正苦于以下问题:C++ touch函数的具体用法?C++ touch怎么用?C++ touch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了touch函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: find boost::optional<value_type> find( const key_type& key) { map_iterator it( items_.find( key)); if( it != items_.end()) { touch( it); return it->second; } return boost::optional<value_type>(); }
开发者ID:JohanAberg,项目名称:Ramen,代码行数:12,
示例2: set void set(int key, int value) { auto it = cache.find(key); if (it != cache.end()) touch(it); else { if (cache.size() == _capacity) { cache.erase(used.back()); used.pop_back(); } used.push_front(key); } cache[key] = {value, used.begin()}; }
开发者ID:Neoustc,项目名称:Interview,代码行数:12,
示例3: insert void insert( const key_type& k, const value_type& v) { map_iterator it( items_.find( key)); if( it != items_.end()) touch( it); else { map_iterator result( items_.insert( map_type::value_type( key, v))); use_list_.push_front( result); } }
开发者ID:JohanAberg,项目名称:Ramen,代码行数:12,
示例4: mainint main(int argc, char *argv[]){ struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = sigterm; sigaction(SIGTERM, &action, NULL); sigaction(SIGINT, &action, NULL); int verbose = 0; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-v") == 0) { verbose = 1; } } size_t total = 0; unsigned long attempted = 0; unsigned long loaded = 0; char line[linebuf]; while (!end && fgets(line, linebuf, stdin)) { /* /n -> 0 */ line[strlen(line) - 1] = 0; size_t size; if (preload(line, &size) == 0) { if (verbose) { fprintf(stderr, "Preloaded '%s'/n", line); } total += size; loaded++; } attempted++; /* * In case the active IO scheduler doesn't already make us yield * to other processes */ usleep(1000); } touch(); fprintf(stderr, "Done, preloaded %lu/%lu files (%lluMB)/n", loaded, attempted, (long long unsigned int) (total >> 20)); while (!end) { sleep(-1); } fprintf(stderr, "Unloading/n"); unload(); fprintf(stderr, "Unloaded/n"); return 0;}
开发者ID:battlesnake,项目名称:preloader,代码行数:53,
示例5: experiment1static void experiment1(char *path) { touch(path); int fd = open(path, O_RDONLY); if (rename(path, "hoge") < 0) { perror(path); printf("ex1: failed to rename/n"); } else { close(fd); printf("ex1: succeed/n"); }}
开发者ID:xorphitus,项目名称:linux-programming-practice,代码行数:12,
示例6: check_touchablevoid perceptron::train(const common::sfv_t& sfv, const std::string& label) { check_touchable(label); labels_.get_model()->increment(label); std::string predicted_label = classify(sfv); if (label == predicted_label) { return; } update_weight(sfv, 1.0, label, predicted_label); touch(label);}
开发者ID:jubatus,项目名称:jubatus_core,代码行数:12,
示例7: experiment2static void experiment2(char *path) { touch(path); int fd = open(path, O_RDONLY); if (unlink(path) < 0) { perror(path); printf("ex2: failed to unlink/n"); } else { close(fd); printf("ex2: succeed/n"); }}
开发者ID:xorphitus,项目名称:linux-programming-practice,代码行数:12,
示例8: setPosvoid camera::setPos(cameraPos position, bool t){ toPos.x = position.x; toPos.y = position.y; toPos.z = position.z; if (framesLeft <= 0) { currentPos.x = position.x; currentPos.y = position.y; currentPos.z = position.z; } changed = true; if (t) touch();}
开发者ID:ZachMSU,项目名称:mobile,代码行数:12,
示例9: walk_social_typestatic void walk_social_type(struct social_type *s){ if (!s) return; touch( s->name ); touch(s->char_no_arg); touch(s->others_no_arg); touch(s->char_found); touch(s->others_found); touch(s->vict_found); touch(s->char_auto); touch(s->others_auto);}
开发者ID:h3rb,项目名称:Assault-3.0,代码行数:14,
示例10: schedstatic voidsched(void){ char *flags; Job *j; Bufblock *buf; int slot; Node *n; Envy *e; if(jobs == 0){ usage(); return; } j = jobs; jobs = j->next; if(DEBUG(D_EXEC)) printf("firing up job for target %s/n", wtos(j->t, ' ')); slot = nextslot(); events[slot].job = j; buf = newbuf(); e = buildenv(j, slot); shprint(j->r->recipe, e, buf); if(!tflag && (nflag || !(j->r->attr&QUIET))) Bwrite(&bout, buf->start, (long)strlen(buf->start)); freebuf(buf); if(nflag||tflag){ for(n = j->n; n; n = n->next){ if(tflag){ if(!(n->flags&VIRTUAL)) touch(n->name); else if(explain) Bprint(&bout, "no touch of virtual '%s'/n", n->name); } n->time = time((long *)0); MADESET(n, MADE); } } else { if(DEBUG(D_EXEC)) printf("recipe='%s'", j->r->recipe);/**/ Bflush(&bout); if(j->r->attr&NOMINUSE) flags = 0; else flags = "-e"; events[slot].pid = execsh(flags, j->r->recipe, 0, e); usage(); nrunning++; if(DEBUG(D_EXEC)) printf("pid for target %s = %d/n", wtos(j->t, ' '), events[slot].pid); }}
开发者ID:8l,项目名称:cmm,代码行数:52,
示例11: save1/* * Save/copy the indicated messages at the end of the passed file name. * If mark is true, mark the message "saved." */intsave1(char str[], int mark, const char *cmd, struct ignoretab *ignore){ struct message *mp; char *file; const char *disp; int f, *msgvec, *ip; FILE *obuf; msgvec = (int *)salloc((msgCount + 2) * sizeof(*msgvec)); if ((file = snarf(str, &f)) == NULL) return (1); if (!f) { *msgvec = first(0, MMNORM); if (*msgvec == 0) { printf("No messages to %s./n", cmd); return (1); } msgvec[1] = 0; } if (f && getmsglist(str, msgvec, 0) < 0) return (1); if ((file = expand(file)) == NULL) return (1); printf("/"%s/" ", file); (void)fflush(stdout); if (access(file, 0) >= 0) disp = "[Appended]"; else disp = "[New file]"; if ((obuf = Fopen(file, "a")) == NULL) { warn((char *)NULL); return (1); } for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { mp = &message[*ip - 1]; touch(mp); if (sendmessage(mp, obuf, ignore, NULL) < 0) { warnx("%s", file); (void)Fclose(obuf); return (1); } if (mark) mp->m_flag |= MSAVED; } (void)fflush(obuf); if (ferror(obuf)) warn("%s", file); (void)Fclose(obuf); printf("%s/n", disp); return (0);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:56,
示例12: mallocchar *mv(int argc, char**argv,char *output){ char **arg = (char **) malloc(sizeof(char*)*4); arg[0] = argv[0]; arg[1] = argv[1]; arg[2] = argv[3]; char *contendio = cat(3, arg); rm(3, arg, output); if (!strcmp(output, "")){ arg[1] = argv[2]; touch(2, arg, contendio, output); } return "";}
开发者ID:adgalad,项目名称:Sistemas-Operativos,代码行数:13,
示例13: touchvoid EditableMap::resize_map(int new_width, int new_height) { touch(); /* create new map/decoration */ short **new_map = create_new_array(map, new_width, new_height); short **new_decoration = create_new_array(decoration, new_width, new_height); cleanup(); map = new_map; decoration = new_decoration; width = new_width; height = new_height;}
开发者ID:SuperNascher,项目名称:goatattack,代码行数:13,
示例14: mID //--------------------------------------------------------------------- Page::Page(PageID pageID, PagedWorldSection* parent) : mID(pageID) , mParent(parent) , mDeferredProcessInProgress(false) , mModified(false) , mDebugNode(0) { WorkQueue* wq = Root::getSingleton().getWorkQueue(); mWorkQueueChannel = wq->getChannel("Ogre/Page"); wq->addRequestHandler(mWorkQueueChannel, this); wq->addResponseHandler(mWorkQueueChannel, this); touch(); }
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:14,
示例15: mJointNum//-----------------------------------------------------------------------------// LLJoint()// Class Constructor//-----------------------------------------------------------------------------LLJoint::LLJoint(const std::string &name, LLJoint *parent) : mJointNum(0){ init(); mUpdateXform = FALSE; setName(name); if (parent) { parent->addChild( this ); } touch();}
开发者ID:Belxjander,项目名称:Kirito,代码行数:17,
示例16: set_warstatic void set_war(fdja_value *node, char *key, fdja_value *val){ fdja_value *par = parent(node); if (par == NULL) return; fdja_value *wars = fdja_l(par, "wars"); if (wars == NULL) wars = fdja_set(par, "wars", fdja_object_malloc()); fdja_set(wars, key, val); touch(node);}
开发者ID:flon-io,项目名称:flon,代码行数:13,
示例17: touchvoid net::nstream_proactor::conn_nstream::read(){ touch(); buffer buf; int n_bytes = N->recv(buf); if(n_bytes <= 0){ //assume connection reset (may not be) error = connection_reset_error; Conn_Container.remove(_info->conn_ID); }else{ Dispatcher.recv(recv_event(_info, buf)); }}
开发者ID:sbunce,项目名称:p2p,代码行数:13,
示例18: touchconst char *http_request_line(int fd, char *reqpath, char *env, size_t *env_len){ static char buf[8192]; /* static variables are not on the stack */ char *sp1, *sp2, *qp, *envp = env; /* For lab 2: don't remove this line. */ touch("http_request_line"); if (http_read_line(fd, buf, sizeof(buf)) < 0) return "Socket IO error"; /* Parse request like "GET /foo.html HTTP/1.0" */ sp1 = strchr(buf, ' '); if (!sp1) return "Cannot parse HTTP request (1)"; *sp1 = '/0'; sp1++; if (*sp1 != '/') return "Bad request path"; sp2 = strchr(sp1, ' '); if (!sp2) return "Cannot parse HTTP request (2)"; *sp2 = '/0'; sp2++; /* We only support GET and POST requests */ if (strcmp(buf, "GET") && strcmp(buf, "POST")) return "Unsupported request (not GET or POST)"; envp += sprintf(envp, "REQUEST_METHOD=%s", buf) + 1; envp += sprintf(envp, "SERVER_PROTOCOL=%s", sp2) + 1; /* parse out query string, e.g. "foo.py?user=bob" */ if ((qp = strchr(sp1, '?'))) { *qp = '/0'; envp += sprintf(envp, "QUERY_STRING=%s", qp + 1) + 1; } /* decode URL escape sequences in the requested path into reqpath */ url_decode(reqpath, sp1); envp += sprintf(envp, "REQUEST_URI=%s", reqpath) + 1; envp += sprintf(envp, "SERVER_NAME=zoobar.org") + 1; *envp = 0; *env_len = envp - env + 1; return NULL;}
开发者ID:chapter09,项目名称:mit_6858,代码行数:51,
示例19: verifystatic intverify(char* path, char* old, char* processor, int must){ char* ns; char* os; int nz; int oz; int r; Sfio_t* nf; Sfio_t* of; r = 0; if (nf = sfopen(NiL, path, "r")) { if ((ns = sfgetr(nf, '/n', 1)) && (nz = sfvalue(nf) - 1) > 0) { ns += nz; if ((oz = strlen(processor)) <= nz && !strcmp(processor, ns - oz)) r = 1; else error(2, "%s: %s clashes with %s", path, processor, ns - nz); } if (r && old && sfseek(nf, 0L, 0) == 0 && (of = sfopen(NiL, old, "r"))) { for (;;) { ns = sfreserve(nf, 0, 0); nz = sfvalue(nf); os = sfreserve(of, 0, 0); oz = sfvalue(nf); if (nz <= 0 || oz <= 0) break; if (nz > oz) nz = oz; if (memcmp(ns, os, nz)) break; nz = sfread(nf, ns, nz); oz = sfread(of, os, nz); if (!nz || !oz) break; } sfclose(of); if (!nz && !oz && !touch(old, (time_t)-1, (time_t)-1, 0)) r = 0; } sfclose(nf); } else if (must) error(ERROR_SYSTEM|2, "%s: cannot read", path); return r;}
开发者ID:nathanmkaya,项目名称:ksh-arch,代码行数:51,
示例20: touch//-----------------------------------------------------------------------------// LLJoint()// Class Constructor//-----------------------------------------------------------------------------LLJoint::LLJoint(){ mName = "unnamed"; mParent = NULL; mXform.setScaleChildOffset(TRUE); mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY; mUpdateXform = TRUE; mJointNum = -1; touch();#if MESH_ENABLED mResetAfterRestoreOldXform = false;#endif //MESH_ENABLED}
开发者ID:KSLcom,项目名称:AstraViewer,代码行数:18,
示例21: ranlibintranlib(char **argv){ int rv; archive = *argv; do { rv = options & AR_T? touch() : do_ranlib(); if (!rv && *argv) archive = *argv; } while (rv && *argv++); return rv;}
开发者ID:McIkye,项目名称:tools,代码行数:14,
示例22: push_error_valuestatic void push_error_value(fdja_value *node, fdja_value *error){ fdja_value *errors = fdja_l(node, "errors"); if (errors == NULL) errors = fdja_set(node, "errors", fdja_array_malloc()); if (fdja_l(error, "ctime") == NULL) { fdja_set(error, "ctime", fdja_sym(flu_tstamp(NULL, 1, 'u'))); } fdja_push(errors, error); touch(node);}
开发者ID:flon-io,项目名称:flon,代码行数:14,
示例23: clear//*********************************************************************************************************void CDisplayerVisualActivitySequence::setActive(bool active){ //H_AUTO(R2_CDisplayerVisualActivitySequence_setActive) if (active == _Active) return; if (!active) { clear(); } else { touch(); } _Active = active;}
开发者ID:mixxit,项目名称:solinia,代码行数:15,
示例24: Term__source_locationvoid Term__source_location(VM* vm){ Term* t = as_term_ref(vm->input(0)); if (t == NULL) return vm->throw_str("NULL reference"); Value* out = vm->output(); touch(out); set_list(out, 4); set_int(list_get(out, 0), t->sourceLoc.col); set_int(list_get(out, 1), t->sourceLoc.line); set_int(list_get(out, 2), t->sourceLoc.colEnd); set_int(list_get(out, 3), t->sourceLoc.lineEnd);}
开发者ID:ShenTensen,项目名称:circa,代码行数:14,
示例25: undeletecmd/* * Undelete the indicated messages. */intundeletecmd(void *v){ int *msgvec = v; int *ip; struct message *mp; for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { mp = &message[*ip - 1]; touch(mp); dot = mp; mp->m_flag &= ~MDELETED; } return(0);}
开发者ID:UNGLinux,项目名称:Obase,代码行数:18,
示例26: getNullchar *getNull(void){#ifdef WIN32 static char *fname = 0; if (fname) return (fname); /* already created */ /* * Since "nul" only works for write operation, * for read, we have to make our own null file */ fname = aprintf("%s/BitKeeper_nul", TMP_PATH); unless (exists(fname)) { touch(fname, 0666); } else {
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:15,
示例27: touch //----------------------------------------------------------------------- void PagingLandScapePage::preloadInBackground() { touch(); if (mPageState == STATE_INITED) { // set new state mPageState = STATE_PRELOADING; S_LOG_VERBOSE("Preloading PagingLandScapePage at (" << mTableX << ", " << mTableZ << ")"); mPageMgr.getSceneManager()->getData2DManager()->load(mTableX, mTableZ); } else { S_LOG_WARNING("PagingLandScapePage at (" << mTableX << ", " << mTableZ << ") already preloaded (or not inited), ignoring request"); } }
开发者ID:Arsakes,项目名称:ember,代码行数:16,
注:本文中的touch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ touch_nmi_watchdog函数代码示例 C++ totalTime函数代码示例 |