• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getSuccessors

void getSuccessors(SNode& node, std::vector<SNode>* s, std::vector<double>* c) {
	SNode reachableNode;
	for (int deltaX = -1; deltaX <= 1; ++deltaX) {
		for (int deltaY = -1; deltaY <= 1; ++deltaY) {
			if (deltaX == 0 && deltaY == 0 && node.velocityVector.first == 0 && node.velocityVector.second == 0) {
				continue;
			}

			reachableNode.position = std::make_pair(node.position.first + node.velocityVector.first + deltaX,
				node.position.second + node.velocityVector.second + deltaY);

			reachableNode.velocityVector = std::make_pair(node.velocityVector.first + deltaX,
				node.velocityVector.second + deltaY);

			reachableNode.setDirection(deltaX, deltaY);

			if (reachableNode.position.first > 0 &&
				reachableNode.position.second > 0 &&
				reachableNode.position.first < aStarStaticMap->sizeOnXaxis() &&
				reachableNode.position.second < aStarStaticMap->sizeOnYaxis() /*&&
																			  aStarStaticMap->canPlayerMoveFromThisPositionWithSuchVector(node.position.first,
																			  node.position.second,
																			  reachableNode.velocityVector.first,
																			  reachableNode.velocityVector.second)*/)
			{
				//std::cout << "ReachableNode: " << reachableNode.position.first << " " << reachableNode.position.second << std::endl;
				s->push_back(reachableNode);
				c->push_back(1);
			}
		}
	}
}
开发者ID:ngc696,项目名称:AI-ABBYY,代码行数:32,代码来源:CAStarStrategyOnYAGSBPL.cpp


示例2: copySwitching

void DerivationWriter :: copySwitching(SNode node)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      Symbol symbol = (Symbol)current.type;
      switch (symbol) {
         case nsSwitchOption:
         case nsBiggerSwitchOption:
         case nsLessSwitchOption:
            _writer.newBookmark();
            unpackChildren(current);
            if (symbol == nsBiggerSwitchOption) {
               _writer.insert(lxOption, GREATER_MESSAGE_ID);
            }
            else if (symbol == nsLessSwitchOption) {
               _writer.insert(lxOption, LESS_MESSAGE_ID);
            }
            else _writer.insert(lxOption, EQUAL_MESSAGE_ID);
            _writer.closeNode();
            _writer.removeBookmark();
            break;
         case nsLastSwitchOption:
            _writer.newBookmark();
            unpackChildren(current);
            _writer.insert(lxElse);
            _writer.closeNode();
            _writer.removeBookmark();
            break;
         default:
            break;
      }
      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:34,代码来源:


示例3: login

int Client::list(const string& path, vector<SNode>& attr)
{
   string revised_path = Metadata::revisePath(path);

   SectorMsg msg;
   msg.resize(65536);
   msg.setType(101);
   msg.setKey(m_iKey);
   msg.setData(0, revised_path.c_str(), revised_path.length() + 1);

   Address serv;
   m_Routing.lookup(revised_path, serv);
   login(serv.m_strIP, serv.m_iPort);

   if (m_GMP.rpc(serv.m_strIP.c_str(), serv.m_iPort, &msg, &msg) < 0)
      return SectorError::E_CONNECTION;

   if (msg.getType() < 0)
      return *(int32_t*)(msg.getData());

   string filelist = msg.getData();

   unsigned int s = 0;
   while (s < filelist.length())
   {
      int t = filelist.find(';', s);
      SNode sn;
      sn.deserialize(filelist.substr(s, t - s).c_str());
      attr.insert(attr.end(), sn);
      s = t + 1;
   }

   return attr.size();
}
开发者ID:besquared,项目名称:sector-sphere,代码行数:34,代码来源:client.cpp


示例4: copyVariable

void DerivationWriter :: copyVariable(SNode node)
{
   SNode local = node.firstChild();

   _writer.newNode(lxVariable);

   if (_hints != lxNone) {
      copyHints(_hints);
      _hints = lxNone;
   }

   unpackNode(local, 0);
   _writer.closeNode();

   SNode current = node.findChild((LexicalType)nsAssigning);
   if (current != lxNone) {
      _writer.newNode(lxExpression);
      _writer.appendNode(lxAssign);
      unpackNode(local, 1);

      unpackChildren(current);

      _writer.closeNode();
   }
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例5: resolveClosure

ref_t ModuleScope :: resolveClosure(ref_t closureMessage, ref_t outputRef, ident_t ns)
{
   ref_t signRef = 0;
   module->resolveAction(getAction(closureMessage), signRef);

   int paramCount = getParamCount(closureMessage);

   IdentifierString closureName(module->resolveReference(closureTemplateReference));
   if (signRef == 0) {
      if (paramCount > 0) {
         closureName.appendInt(paramCount);
      }

      if (isWeakReference(closureName)) {
         return module->mapReference(closureName, true);
      }
      else return mapFullReference(closureName, true);
   }
   else {   
      ref_t signatures[ARG_COUNT];
      size_t signLen = module->resolveSignature(signRef, signatures);

      List<SNode> parameters;
      SyntaxTree dummyTree;
      SyntaxWriter dummyWriter(dummyTree);
      dummyWriter.newNode(lxRoot);
      
      for (size_t i = 0; i < signLen; i++) {
         dummyWriter.appendNode(lxTarget, signatures[i]);
      }
      if (outputRef) {
         dummyWriter.appendNode(lxTarget, outputRef);
      }
      // if the output signature is not provided - use the super class
      else dummyWriter.appendNode(lxTarget, superReference);

      dummyWriter.closeNode();

      SNode paramNode = dummyTree.readRoot().firstChild();
      while (paramNode != lxNone) {
         parameters.add(paramNode);

         paramNode = paramNode.nextNode();
      }

      closureName.append('#');
      closureName.appendInt(paramCount + 1);

      ref_t templateReference = 0;
      if (isWeakReference(closureName)) {
         templateReference = module->mapReference(closureName, true);
      }
      else templateReference = mapFullReference(closureName, true);

      if (templateReference) {
         return generateTemplate(templateReference, parameters, ns, false);
      }
      else return superReference;
   }
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:60,代码来源:compilerscope.cpp


示例6: injectNewOperation

void CompilerLogic :: injectNewOperation(SNode node, _CompilerScope& scope, int operation, ref_t elementType, ref_t targetRef)
{
   SNode operationNode = node.injectNode((LexicalType)operation, targetRef);

   int size = defineStructSize(scope, targetRef, elementType, false);
   if (size != 0)
      operationNode.appendNode(lxSize, size);
}
开发者ID:,项目名称:,代码行数:8,代码来源:


示例7: TRUE

/** first
  0 - FALSE - call to handel nodes with next priority / order
  1 - TRUE (default) - first call for this object
*/
bool INode::childTopDown(bool first)
{
#ifdef DEBUGMSG
  qDebug("#  INode::childTopDown (%s) cont_td (this %p) first: %d", (const char *) name(), this, first);
    qDebug("##(xxx) INode::childTopDown (%s) (this %p) #childcount %d, ordercount %d, aktivorder %d, aktivcount %d, truncation %d",
      (const char *) name(), this, childcount_,ordercount_,aktivorder_,aktivcount_,truncation());
#endif
  SNode *el; // hilfspointer
  if (first) {// first call of 'childTopDown' for this object
    childList_ = &(sNode_->children()); // liste der subknoten erzeugen
    childcount_ = childList_->count(); // anzahl aller (noch) zu bearbeitenden knoten
    aktivorder_=-1; // prioritaet der zu bearbeitenden nodes
    if (childcount_ == 0) { //no sub nodes
      aktivcount_ = 0;
      execBottomUp();             //execState(BU);// BottomUp
      return 0;
    }
  } else { // recursiv call of 'childTopDown' for this object
    if (aktivcount_ > 0 || ordercount_ > 0 ) return 1;
    if (childcount_ <= 0) return 0;//all sub nodes are handled
    if (truncation()) return 0; //all sub nodes are handelt or node is trash
  }

  //Praemisse (ordercount_ == 0) && (childcount_ > 0)
  while (ordercount_ == 0) {
    aktivorder_ ++;
    for (el = childList_->first(); el != 0; el = childList_->next())
      if(el->order() == aktivorder_) ordercount_++; // anzahl der nodes der aktuellen prioritaet
  }
#ifdef DEBUGMSG
    qDebug("## INode::childTopDown (%s) (this %p) #childs %d, ordercount %d, aktivorder %d, aktivcount_ %d",
      (const char *) name(), this, childcount_, ordercount_, aktivorder_,aktivcount_);
#endif

    INode *inode;
    for (el = childList_->first(); el != 0; el = childList_->next()) {
      if (truncation()) { //bedingungen nicht mehr erfüllt
        aktivcount_ = 0;
        execBottomUp();             //execState(BU);// BottomUp
        return 0;
      }
      if (el->order() == aktivorder_) {
        incrementCount(); //einer mehr in der queue -> siehe decrementCount()
        childcount_--; ordercount_--; //aktuelle wird gleich bearbeitet
        inode = new INode(el);    //new INode
        CHECK_PTR(inode);
        inode->status(HI);
        inode->execState(TD);
        childLink(inode);         // remount node in the tree
        inode->execTopDown();     //start topdown operator
        //childcount_--; ordercount_--; //aktuelle wird gleich bearbeitet
//!MP25.07.2001 inode might be deleted
//!      analysis_->nodeChange(inode);  //info to the rest of the world
        analysis_->nodeChange(0);
      }
    }
  return 1;
}
开发者ID:BackupTheBerlios,项目名称:geoaida,代码行数:62,代码来源:inode.cpp


示例8: report

int Slave::report(const string& master_ip, const int& master_port, const int32_t& transid, const vector<string>& filelist, const int& change)
{
   vector<string> serlist;
   for (vector<string>::const_iterator i = filelist.begin(); i != filelist.end(); ++ i)
   {
      struct stat s;
      if (-1 == stat((m_strHomeDir + *i).c_str(), &s))
         continue;

      SNode sn;
      sn.m_strName = *i;
      sn.m_bIsDir = S_ISDIR(s.st_mode) ? 1 : 0;
      sn.m_llTimeStamp = s.st_mtime;
      sn.m_llSize = s.st_size;

      char buf[1024];
      sn.serialize(buf);

      //update local
      Address addr;
      addr.m_strIP = "127.0.0.1";
      addr.m_iPort = 0;
      m_pLocalFile->update(buf, addr, change);

      serlist.push_back(buf);
   }

   if (serlist.empty())
      return 0;

   SectorMsg msg;
   msg.setType(1);
   msg.setKey(0);
   msg.setData(0, (char*)&transid, 4);
   msg.setData(4, (char*)&m_iSlaveID, 4);
   msg.setData(8, (char*)&change, 4);
   int32_t num = serlist.size();
   msg.setData(12, (char*)&num, 4);
   int pos = 16;
   for (vector<string>::iterator i = serlist.begin(); i != serlist.end(); ++ i)
   {
      int32_t bufsize = i->length() + 1;
      msg.setData(pos, (char*)&bufsize, 4);
      msg.setData(pos + 4, i->c_str(), bufsize);
      pos += bufsize + 4;
   }

   cout << "report " << master_ip << " " << master_port << " " << num << endl;

   if (m_GMP.rpc(master_ip.c_str(), master_port, &msg, &msg) < 0)
      return -1;

   if (msg.getType() < 0)
      return *(int32_t*)msg.getData();

   return 1;
}
开发者ID:norouzi4d,项目名称:sector,代码行数:57,代码来源:slave.cpp


示例9: unpackChildren

void DerivationWriter :: unpackChildren(SNode node, int mode)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      unpackNode(current, mode);

      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:9,代码来源:


示例10: main

int main()
{
	
	//prueba del constructor por omision
	SNode<int> node;
	SNode<int> * aux = new SNode<int>;
	cout<<"Valores por omision"<<endl;
	printSNode(&node);cout<<endl;
	printSNode(aux);cout<<endl;
	
	//constructores por copia
	SNode<int> node1(10);
	SNode<int> * aux1 = new SNode<int>(20);
	cout<<"Valores por copia"<<endl;
	printSNode(&node1);cout<<endl;
	printSNode(aux1);cout<<endl;
	
	//insertamos elementos en una lista simple
	SNode<int> lista;
	for(int i = 0; i < 10 ; i++)
	{
		lista.insertNext(i);
	}
	cout<<"Valores de la lista"<<endl;
	imprimirLista(lista);
	
	//insertamos elementos en una lista simple de manera ordenada
	SNode<int> listaOrdenada;
	for(int i = 0; i < 10 ; i++)
	{
		listaOrdenada.orderedInsertion(i);
	}
	cout<<"Valores de lista Ordenada"<<endl;
	imprimirLista(listaOrdenada);
	
	//utilizamos el iterador sobre nodo
	cout<<"Valores lista ordenada usando iterador"<<endl;
	for(SNode<int>::Iterator it(&listaOrdenada); it.hasCurrent(); it.next())
	{
		cout<<it.getCurrent()->getData()<<" ";
	}
	cout<<endl;
	
	cout<<"Valores lista ordenada"<<endl;
	simpleSort(lista);
	//quickSort(lista);
	
	imprimirLista(lista);
	
	cout<<"Valores minimo de la lista"<<endl;
	cout<<searchMin(&lista)<<endl;	
	
	delete aux;
	delete aux1;
	return 0;
}
开发者ID:velasquezerik,项目名称:EstructurasDatos,代码行数:56,代码来源:TestSNode.C


示例11:

		void							TMCtrl::capture(AnimCtrl* animctrl, void* opaque)
		{
			if(!_node.valid())
				return;

			SNode* n = _node.get_unsafe();
			_pos_captured = n->pos();
			_rot_captured = n->rot();
			_scale_captured = n->scale();
		}
开发者ID:vinceplusplus,项目名称:z3D,代码行数:10,代码来源:TMCtrl.cpp


示例12: ENTERMETHOD

SNode SNode::multiplyParenthesesInProduct() const {
  ENTERMETHOD();
  CHECKNODETYPE(*this,NT_PRODUCT);

  const FactorArray &a = getFactorArray();
  const size_t       n = a.size();
  FactorArray        newFactorArray(a.getTree(), n);
  for(size_t i = 0; i < n; i++) {
    SNode f = a[i];
    newFactorArray *= powerExp(f.base().multiplyParentheses(), f.exponent().multiplyParentheses());
  }

  BitSet done(newFactorArray.size() + 1);
  do {
    FactorArray tmp = newFactorArray;
    newFactorArray.clear();
    done.setCapacity(tmp.size() + 1);
    done.clear();
    for(size_t i1 = 1; i1 < tmp.size(); i1++) {
      if(done.contains(i1)) continue;
      SNode f1 = tmp[i1];
      if((f1.base().getSymbol() == SUM) && !f1.exponent().isOne()) {
        continue;
      }
      for(size_t i2 = 0; i2 < i1; i2++) {
        if(done.contains(i1)) break;
        if(done.contains(i2)) continue;
        SNode f2 = tmp[i2];
        if((f2.base().getSymbol() == SUM) && !f2.exponent().isOne()) {
          continue;
        }
        if(f1.base().getSymbol() == SUM) {
          newFactorArray *= multiplyFactorSum(f2, f1.base());
          done.add(i1);
          done.add(i2);
        } else if(f2.base().getSymbol() == SUM) {
          newFactorArray *= multiplyFactorSum(f1, f2.base());
          done.add(i1);
          done.add(i2);
        }
      }
    }
    for(size_t i = 0; i < tmp.size(); i++) {
      if(!done.contains(i)) {
        newFactorArray *= tmp[i];
      }
    }
  } while(!done.isEmpty());
  SNode result = productExp(newFactorArray);
  RETURNNODE( result );
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:51,代码来源:SNodeMultiplyPar.cpp


示例13: injectVariableAssigning

void CompilerLogic :: injectVariableAssigning(SNode node, _CompilerScope& scope, _Compiler& compiler, ref_t targetRef, ref_t& type, bool paramMode)
{
   ClassInfo info;
   defineClassInfo(scope, info, targetRef);

   node.setArgument(defineStructSize(info, false));
   //HOTFIX : allowing to assign a reference variable
   if (!node.argument && paramMode) {
      // replace the parameter with the field expression
      compiler.injectFieldExpression(node.firstChild(lxObjectMask));

      type = info.fieldTypes.get(0).value2;
   }
}
开发者ID:,项目名称:,代码行数:14,代码来源:


示例14: copyNode

void SyntaxTree :: copyNode(SyntaxTree::Writer& writer, SyntaxTree::Node node)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      if (current.strArgument >= 0) {
         writer.newNode(current.type, current.identifier());
      }
      else writer.newNode(current.type, current.argument);

      copyNode(writer, current);

      writer.closeNode();

      current = current.nextNode();
   }
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:16,代码来源:syntaxtree.cpp


示例15: findTerminalInfo

SyntaxTree::Node SyntaxTree :: findTerminalInfo(SyntaxTree::Node node)
{
   if (node.existChild(lxRow))
      return node;

   SNode current = node.firstChild();
   while (current != lxNone) {
      SNode terminalNode = findTerminalInfo(current);
      if (terminalNode != lxNone)
         return terminalNode;

      current = current.nextNode();
   }

   return current;
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:16,代码来源:syntaxtree.cpp


示例16: optimizeEmbeddableGet

bool CompilerLogic :: optimizeEmbeddableGet(_CompilerScope& scope, _Compiler& compiler, SNode node)
{
   SNode callNode = node.findSubNode(lxDirectCalling, lxSDirctCalling);
   SNode callTarget = callNode.findChild(lxCallTarget);

   ClassInfo info;
   defineClassInfo(scope, info, callTarget.argument);

   ref_t subject = info.methodHints.get(Attribute(callNode.argument, maEmbeddableGet));
   // if it is possible to replace get&subject operation with eval&subject2:local
   if (subject != 0) {
      compiler.injectEmbeddableGet(node, callNode, subject);

      return true;
   }
   else return false;
}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例17: copyObject

void DerivationWriter :: copyObject(SNode node, int mode)
{
   int exprCounter = 0;
   SNode current = node.firstChild();
   while (current != lxNone) {
      if (current == nsExpression)
         exprCounter++;

      unpackNode(current, mode);

      current = current.nextNode();
   }

   if (mode == 1 && exprCounter > 1) {
      _writer.insert(lxExpression);
      _writer.closeNode();
   }
}
开发者ID:,项目名称:,代码行数:18,代码来源:


示例18: moveNodes

void SyntaxTree :: moveNodes(Writer& writer, SyntaxTree& buffer)
{
   SNode current = buffer.readRoot();
   while (current != lxNone) {
      if (current != lxIdle) {
         if (current.strArgument >= 0) {
            writer.newNode(current.type, current.identifier());
         }
         else writer.newNode(current.type, current.argument);

         SyntaxTree::copyNode(writer, current);
         writer.closeNode();

         current = lxIdle;
      }
      current = current.nextNode();
   }
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:18,代码来源:syntaxtree.cpp


示例19: iNode_delete

//////////
//
// Called to delete the indicated node
//
//////
	void iNode_delete(SNode** root, bool tlDeleteSelf)
	{
		SNode* node;


		// Make sure our environment is sane
		if (root && (node = *root))
		{
			//////////
			// Delete the op if need be
			//////
#ifdef iOp_politelyDelete
				if (node->opData)
				{
					// Delete op chain
					iOp_politelyDelete(&node->opData->op, false);

					// Delete the variable chain
					if (node->opData->firstVariable)
						iVariable_politelyDelete_chain(&node->opData->firstVariable, true);
				}
#endif


			//////////
			// Physically release the node if need be
			//////
				if (tlDeleteSelf)
				{
					// Pass everything which points through it to its mirror, and disconnect any nodes that don't pass through
					iNode_orphanize(root);

					// Delete any extra data
					if (node->_extraData_deleteFunc)
						node->extraData_deleteFunc(node);

					// Physically release it
					*root = NULL;
					free(node);
				}

		}
	}
开发者ID:RickCHodgin,项目名称:libsf,代码行数:48,代码来源:node.cpp


示例20: copyHints

void DerivationWriter :: copyHints(SNode current)
{
   while (((LexicalType)current.type) == nsHint) {
      _writer.newNode(lxAttribute);
      unpackChildren(current);
      _writer.closeNode();

      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:10,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SOAPCommand类代码示例发布时间:2022-05-31
下一篇:
C++ SMeshBuffer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap