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


C++ Batch::Print方法代码示例

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


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

示例1: Input

WindowResponse ParserWindow::Input(const Batch& ibatch) {
  g_log.info() << "Updating incParser " << m_incParser.Name() << " with batch: " << ibatch.Print();
  m_incParser.ApplyBatch(ibatch);
  const statik::STree& root = m_incParser.GetRoot();
  WindowResponse response;
  if (root.GetState().IsBad()) {
    g_log.debug() << " - Not extracting output, because root is bad!";
    return response;
  }
  // Find first item in incParser's output list, and draw everything
  response.actions.push_back(WindowAction(WindowAction::MOVE, 0, 0, 0));
  Batch batch;
  g_log.debug() << "Extracting changes from IncParser";
  m_incParser.ExtractChanges(batch);
  g_log.info() << "Printing WindowResponse list for batch of size " << batch.Size() << ": " << batch;
  if (m_nodes) {
    g_log.debug() << "m_nodes is: " << *m_nodes;
  }
  if (!batch.IsEmpty()) {
    for (Batch::batch_iter i = batch.begin(); i != batch.end(); ++i) {
      switch (i->op) {
      case Batch::OP_INSERT: {
          g_log.debug() << "Insert node: " << i->node->name << ":" << i->node->value;
          List* node = new List(i->node->name, i->node->value);
          if (i->pos) {
            node_iter pos_i = m_nodeMap.find(i->pos);
            if (m_nodeMap.end() == pos_i) {
              throw ISError("Received invalid pos for Insert");
            }
            List* pos = pos_i->second;
            g_log.debug() << " - at pos: " << pos->name << ":" << pos->value;
            node->right = pos->right;
            node->left = pos;
            pos->right = node;
            if (node->right) {
              node->right->left = node;
            }
            g_log.debug() << "Inserted " << *node;
            if (node->left) {
              g_log.debug() << " - with left: " << *node->left;
              if (node->left->right) {
                g_log.debug() << " - - which has right: " << *node->left->right;
              }
            }
            if (node->right) {
              g_log.debug() << " - with right: " << *node->right;
              if (node->right->left) {
                g_log.debug() << " - - which has left: " << *node->right->left;
              }
            }
          } else {
            g_log.debug() << "Setting this node as m_nodes";
            node->right = m_nodes;
            if (node->right) {
              node->right->left = node;
            }
            m_nodes = node;
          }
          m_nodeMap.insert(std::make_pair(i->node, node));
          g_log.debug() << "Done inserting node";
        }
        break;

      case Batch::OP_DELETE: {
          // Careful!  i->node is a pointer to dead data, it's just a lookup
          // handle for us.
          node_mod_iter node_i = m_nodeMap.find(i->node);
          if (m_nodeMap.end() == node_i) {
            throw ISError("Received invalid node for Delete");
          }
          List* node = node_i->second;
          g_log.debug() << "Delete node: " << node->name << ":" << node->value;
          List* left = node->left;
          List* right = node->right;
          if (left && left->right == node) {
            left->right = right;
          }
          if (right && right->left == node) {
            right->left = left;
          }
          if (m_nodes == node) {
            g_log.debug() << "Deleted node is m_nodes";
            if (left) {
              g_log.debug() << "going left";
              g_log.debug() << "going left to " << *left << " from " << *node;
              m_nodes = left;
            } else if (right) {
              g_log.debug() << "going right";
              g_log.debug() << "going right to " << *right << " from " << *node;
              m_nodes = right;
            } else {
              g_log.debug() << "nowhere to go; m_nodes is clear";
              m_nodes = NULL;
            }
          }
          g_log.debug() << "Deleted " << *node;
          if (node->left) {
            g_log.debug() << " - with left: " << *node->left;
          }
          if (node->right) {
//.........这里部分代码省略.........
开发者ID:nfomon,项目名称:shok,代码行数:101,代码来源:ParserWindow.cpp


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