当前位置: 首页>>代码示例>>C++>>正文


C++ Proc类代码示例

本文整理汇总了C++中Proc的典型用法代码示例。如果您正苦于以下问题:C++ Proc类的具体用法?C++ Proc怎么用?C++ Proc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Proc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
	Proc* proc = new Proc();


	Environment* env = new Environment();

	Country greece("Greece"), albania("Albania"), skopia("Skopia"), bulgaria("Bulgaria"), romania("Romania");

	env->getCountries()->push_back(&greece);
	env->getCountries()->push_back(&albania);
	env->getCountries()->push_back(&skopia);
	env->getCountries()->push_back(&bulgaria);
	env->getCountries()->push_back(&romania);

	greece.addCountry(&albania);
	greece.addCountry(&bulgaria);
	greece.addCountry(&skopia);

	albania.addCountry(&bulgaria);
	bulgaria.addCountry(&skopia);
	bulgaria.addCountry(&romania);
	romania.addCountry(&skopia);

	proc->actions.push_back(new Color(Country::RED));
	proc->actions.push_back(new Color(Country::BLUE));
	proc->actions.push_back(new Color(Country::YELLOW));
	proc->actions.push_back(new Color(Country::GREEN));

	proc->proccess(env,new Color(Country::RED));

	env->print();
	return 0;
}
开发者ID:Loopush,项目名称:Loopop,代码行数:34,代码来源:ColorCountries.cpp

示例2: rb_iterate

  VALUE rb_iterate(VALUE(*ifunc)(VALUE), VALUE ary, VALUE(*cb)(ANYARGS), VALUE cb_data) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    // Minor optimization.
    if(ifunc == rb_each && kind_of<Array>(env->get_object(ary))) {
      for(size_t i = 0; i < rb_ary_size(ary); i++) {
        (*cb)(rb_ary_entry(ary, i), cb_data, Qnil);
      }

      return ary;
    }

    NativeMethod* nm = NativeMethod::create(env->state(),
                        (String*)Qnil, env->state()->shared.globals.rubinius.get(),
                        env->state()->symbol("call"), (void*)cb,
                        Fixnum::from(ITERATE_BLOCK));

    nm->set_ivar(env->state(), env->state()->symbol("cb_data"),
                 env->get_object(cb_data));

    Proc* prc = Proc::create(env->state(), env->state()->shared.globals.proc.get());
    prc->bound_method(env->state(), nm);

    env->set_outgoing_block(env->get_handle(prc));

    return (*ifunc)(ary);
  }
开发者ID:mutle,项目名称:rubinius,代码行数:27,代码来源:array.cpp

示例3: ReleaseMutex

bool Monitor::TerminateProc(int i)
{
	if (WaitForSingleObject(vectMutex, 1000) == ERROR_TIMEOUT)
	{
		
		ReleaseMutex(vectMutex);
		return false;
	}
	Proc *pk = P[i];
	ReleaseMutex(vectMutex);
	WaitForSingleObject(pk->Access, INFINITY);
	/*DWORD P1;
	if (GetExitCodeProcess(pk->prInf.hProcess, &P1) == FALSE)
	{
		ReleaseMutex(pk->Access);
		return false;
	}
	if (P1 != STILL_ACTIVE)
		return false;*/
	pk->Stop();
	ReleaseMutex(pk->Access);
	if (WaitForSingleObject(pk->prInf.hProcess, 3000) == WAIT_TIMEOUT)
		return false;
	return true;
}
开发者ID:pleomaxx3002,项目名称:Monitor,代码行数:25,代码来源:Monitor.cpp

示例4: linkproc

static void
linkproc(void)
{
	Proc *up = externup();
	spllo();
	up->kpfun(up->kparg);
	pexit("kproc dying", 0);
}
开发者ID:Requaos,项目名称:harvey,代码行数:8,代码来源:arch.c

示例5: main

int main()
{

	StmtList *SL, *SL1;
	Stmt *S1, *S2, *S3, *S4, *S5, *S6;
	Expr *E;

// statement list for Add function

	S1 = new AssignStmt("i",new Ident("n"));
	S2 = new AssignStmt("s",new Number(0));
	S3 = new AssignStmt("s",
                   new Plus(new Ident("s"), new Ident("i")));
	S4 = new AssignStmt("i",
                   new Minus(new Ident("i"), new Number(1)));
	SL1 = new StmtList();
	SL1->insert(S4);  SL1->insert(S3);
	E = new Ident("i");

	S5 = new WhileStmt(E,SL1);

	S6 = new AssignStmt("return", new Ident("s"));

	SL = new StmtList();
	SL->insert(S6);  SL->insert(S5);  SL->insert(S2); SL->insert(S1);

	cout << "Add(n)" << endl;
	cout << "i := n; s := 0;" << endl;
	cout << "while i do s := s+i; i := i-1 od;" << endl;
	cout << "return := s" << endl;
        Proc *Add;
	list<string> *paramlist;
	paramlist = new list<string>;
	paramlist->push_front("n");

	cout << "Creating function" << endl;

	Add = new Proc(paramlist,SL);

	map<string,int> NT;
	map<string,Proc*> FT;
	NT.clear();  FT.clear();
	FT["add"] = Add;
	list<Expr*> *arglist;
	Expr *E1;
	int n;
	cout << "Enter n:  ";
	cin >> n;
	E1 = new Number(n);
	arglist = new list<Expr*>;
	arglist->push_front(E1);

	cout << "Calling function" << endl;
	cout << "Add(" << E1->eval(NT,FT) << ") = ";
        cout << Add->apply(NT,FT,arglist) << endl;
       
	return 0;
}
开发者ID:davidivins,项目名称:schoolprojects,代码行数:58,代码来源:tproc.cpp

示例6: from_env

  Proc* Proc::from_env(STATE, Object* self, Object* env) {
    if(Proc* p = try_as<Proc>(env)) {
      return p;
    }

    if(BlockEnvironment* be = try_as<BlockEnvironment>(env)) {
      Proc* proc = Proc::create(state, self);
      proc->block(state, be);
      return proc;
    }

    return NULL;
  }
开发者ID:Energy0124,项目名称:rubinius,代码行数:13,代码来源:proc.cpp

示例7: G

  Proc* Proc::from_env(STATE, Object* env) {
    if(Proc* p = try_as<Proc>(env)) {
      return p;
    }

    if(BlockEnvironment* be = try_as<BlockEnvironment>(env)) {
      Proc* proc = Proc::create(state, G(proc));
      proc->block(state, be);
      return proc;
    }

    return reinterpret_cast<Proc*>(Primitives::failure());
  }
开发者ID:vasco,项目名称:rubinius,代码行数:13,代码来源:proc.cpp

示例8: pfx

void
BinUtil::TextSeg::dump(std::ostream& o, int flags, const char* pre) const
{
  string pfx(pre);
  string pfx1 = pfx + "  ";

  Seg::dump(o, flags, pre);
  o << pfx << "  Procedures (" << numProcs() << ")\n";
  for (ProcVec::const_iterator it = m_procs.begin(); 
       it != m_procs.end(); ++it) {
    Proc* x = *it;
    x->dump(o, flags, pfx1.c_str());
  }
}
开发者ID:wjcsharp,项目名称:hpctoolkit,代码行数:14,代码来源:Seg.cpp

示例9: wrap_c_function

    Proc* wrap_c_function(void* cb, VALUE cb_data, int arity) {
      NativeMethodEnvironment* env = NativeMethodEnvironment::get();
      NativeMethod* nm = NativeMethod::create(env->state(),
                          (String*)Qnil, env->state()->shared.globals.rubinius.get(),
                          env->state()->symbol("call"), cb,
                          Fixnum::from(arity));

      nm->set_ivar(env->state(), env->state()->symbol("cb_data"),
                   env->get_object(cb_data));

      Proc* prc = Proc::create(env->state(), env->state()->shared.globals.proc.get());
      prc->bound_method(env->state(), nm);

      return prc;
    }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例10: NetgenOutStream

  NetgenOutStream(ostream * aout, Proc proc ) :
    out(aout),
    printheader(1)
  { 
#ifdef PARALLEL
    if ( netgen::id == proc.GetProc() )
      print = true;
    else
      print = false;
#else
    if ( 0 == proc.GetProc() )
      print = true;
    else
      print = false;

#endif
  }
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:17,代码来源:netgenout.hpp

示例11: if

int
ACodeNode::compare(const ACodeNode* x, const ACodeNode* y)
{
  if (x->begLine() == y->begLine()) {
    bool endLinesEqual = (x->endLine() == y->endLine());
    if (endLinesEqual) {
      // We have two ACodeNode's with identical line intervals...
      
      // Use lexicographic comparison for procedures
      if (x->type() == ANode::TyProc && y->type() == ANode::TyProc) {
	Proc *px = (Proc*)x, *py = (Proc*)y;
	int cmp1 = px->name().compare(py->name());
	if (cmp1 != 0) { return cmp1; }
	int cmp2 = px->linkName().compare(py->linkName());
	if (cmp2 != 0) { return cmp2; }
      }
      
      // Use VMAInterval sets otherwise.
      bool x_lt_y = (x->vmaSet() < y->vmaSet());
      bool y_lt_x = (y->vmaSet() < x->vmaSet());
      bool vmaSetsEqual = (!x_lt_y && !y_lt_x);

      if (vmaSetsEqual) {
	// Try ranking a leaf node before a non-leaf node
	if ( !(x->isLeaf() && y->isLeaf())) {
	  if      (x->isLeaf()) { return -1; } // x < y
	  else if (y->isLeaf()) { return  1; } // x > y
	}
	
	// Give up!
	return 0;
      }
      else if (x_lt_y) { return -1; }
      else if (y_lt_x) { return  1; }
      else {
	DIAG_Die(DIAG_Unimplemented);
      }
    }
    else {
      return SrcFile::compare(x->endLine(), y->endLine());
    }
  }
  else {
    return SrcFile::compare(x->begLine(), y->begLine());
  }
}
开发者ID:HPCToolkit,项目名称:hpctoolkit,代码行数:46,代码来源:Struct-Tree.cpp

示例12: G

  Proc* Proc::from_env(STATE, Object* self, Object* env) {
    if(Proc* p = try_as<Proc>(env)) {
      if(p->klass() != self &&
         p->klass() != G(proc)->get_const(state, "Method")) {
        p = as<Proc>(p->duplicate(state));
        p->klass(state, as<Class>(self));
      }
      return p;
    }

    if(BlockEnvironment* be = try_as<BlockEnvironment>(env)) {
      Proc* proc = Proc::create(state, self);
      proc->block(state, be);
      return proc;
    }

    return reinterpret_cast<Proc*>(Primitives::failure());
  }
开发者ID:markburns,项目名称:rubinius,代码行数:18,代码来源:proc.cpp

示例13: wrap_c_function

    Proc* wrap_c_function(void* cb, VALUE cb_data, int arity) {
      NativeMethodEnvironment* env = NativeMethodEnvironment::get();
      NativeMethod* nm = NativeMethod::create(env->state(),
                          nil<String>(), env->state()->vm()->shared.globals.rubinius.get(),
                          env->state()->symbol("call"), cb,
                          Fixnum::from(arity), 0);

      nm->set_ivar(env->state(), env->state()->symbol("cb_data"),
                   env->get_object(cb_data));

      Object* current_block = env->block();
      if(!current_block->nil_p()) {
        nm->set_ivar(env->state(), env->state()->symbol("original_block"),
                     current_block);
      }

      Proc* prc = Proc::create(env->state(), env->state()->vm()->shared.globals.proc.get());
      prc->bound_method(env->state(), nm);

      return prc;
    }
开发者ID:cutorad,项目名称:rubinius,代码行数:21,代码来源:capi.cpp

示例14: GEQ

    Host::Host(long *GT, EPQ** GEQ, Alg** algList, long priorities, FILE* infile, bool v)
            :GT(GT), GEQ(GEQ), algList(algList), priorities(priorities), verbose(v){
        long PID, T, CPUT, priority;
        char IOs[1024], buf[4096];
        char* IOsStart = IOs;
        char* IOsEnd = IOs;
        vector<Event*> eventV;
        
        while(fgets(buf, 4096, infile)){
            IOs[0] = '\0';
            if(3 == sscanf(buf, "P%ld,%ld,%ld(%1023[0123456789,])%ld;", &PID, &T, &CPUT, IOs, &priority)){
                sscanf(buf, "%*[P0123456789,(])%ld;", &priority);
            }
            if(verbose){
                printf("%ld, %ld, %ld, %s, %ld\n", PID, T, CPUT, IOs, priority);
            }
            Proc* tmp = new Proc(PID, T, CPUT, priority);
            while(*IOsEnd != '\0'){
                if(*IOsEnd == ','){
                    *IOsEnd = '\0';
                    tmp->PIOQ.push(new Event(tmp, atol(IOsStart)));
                    IOsStart = IOsEnd+1;
                }
                IOsEnd++;
            }

            if(IOsStart != IOsEnd){
                tmp->PIOQ.push(new Event(tmp, atol(IOsStart)));
            }
            
            tmp->setIOs();
            eventV.push_back(new Event(tmp, T));

            IOsStart = IOs;
            IOsEnd = IOs;
        }
        
        *GEQ = new EPQ(EventComparator(), eventV);
        
    }
开发者ID:Alex-Aralis,项目名称:CSCI40300,代码行数:40,代码来源:libprocsim.cpp

示例15:

Proc*
File::findProc(const char* name, const char* linkname) const
{
  Proc* found = NULL;

  ProcMap::const_iterator it = m_procMap->find(name);
  if (it != m_procMap->end()) {
    if (linkname && linkname[0] != '\0') {
      for ( ; (it != m_procMap->end() && strcmp(it->first.c_str(), name) == 0);
	    ++it) {
	Proc* p = it->second;
	if (strcmp(p->linkName().c_str(), linkname) == 0) {
	  return p; // found = p
	}
      }
    }
    else {
      found = it->second;
    }
  }
  
  return found;
}
开发者ID:HPCToolkit,项目名称:hpctoolkit,代码行数:23,代码来源:Struct-Tree.cpp


注:本文中的Proc类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。