예제 #1
0
void Treebank<T>::productions(std::vector<Production>& internals, std::vector<Production>& lexicals) const
{
  typedef typename std::vector<T>::const_iterator iterator;

  for(iterator t_iter(trees.begin()); t_iter != trees.end(); ++t_iter)
    t_iter->productions(internals,lexicals);
}
예제 #2
0
파일: HostProcess.cpp 프로젝트: manut/TAO
void
HostProcess::dump_summary (ostream &strm)
{
  strm << "Host process " << this->proc_name_ << " pid(" << this->pid_ << ") from logfile " << this->logfile_name_ <<  endl;
  size_t num = this->listen_endpoints_.size();
  if (num > 0)
    {
      strm << "  listening on ";
      size_t count = 0;
      for (ACE_DLList_Iterator <Endpoint> t_iter (this->listen_endpoints_);
           !t_iter.done();
           t_iter.advance())
        {
          Endpoint *ep = 0;
          t_iter.next(ep);
          strm << ep->addr_.c_str();
          if (++count < num)
            strm << ", ";
        }
      strm << endl;
    }

  strm << "  " << threads_.size() << " threads";
#if 0
  if (clients_.current_size() > 0)
    strm << ", client to " << clients_.current_size();
  if (servers_.current_size() > 0)
    strm << ", server to " << servers_.current_size();
#endif
  strm << endl;
}
예제 #3
0
void Treebank<T>::collect_internal_counts(std::map<Production, double> & binary_counts,
					  std::map<Production, double> & unary_counts,
					  std::map< int, double> & LHS_counts) const
{
  typedef typename std::vector<T>::const_iterator iterator;

  for(iterator t_iter(trees.begin()); t_iter != trees.end(); ++t_iter)
    t_iter->collect_internal_counts(binary_counts,unary_counts,LHS_counts);
}
예제 #4
0
파일: HostProcess.cpp 프로젝트: manut/TAO
void
HostProcess::dump_thread_invocations (ostream &strm)
{
  this->dump_ident (strm, "invocations by thread:");
  for (ACE_DLList_Iterator <Thread> t_iter (this->threads_);
       !t_iter.done();
       t_iter.advance())
    {
      Thread *thr = 0;
      t_iter.next(thr);
      thr->dump_invocations (strm);
      strm << endl;
      thr->dump_incidents (strm);
      strm << endl;
    }
}
예제 #5
0
파일: Log.cpp 프로젝트: manut/TAO
void
Log::handle_msg_octets ()
{
  int pos = this->dump_target_->add_octets(this->line_, this->offset_);
  if (this->dump_target_ == &this->unknown_msg_)
    {
      for (ACE_DLList_Iterator<Thread> t_iter(this->giop_waiters_);
           !t_iter.done();
           t_iter.advance())
        {
          Thread *th = 0;
          t_iter.next(th);
          GIOP_Buffer *waiter = th->giop_target();
          if (waiter == 0)
            continue;
          if (waiter->matches (this->dump_target_))
            {
              waiter->transfer_from (this->dump_target_);
              this->dump_target_ = waiter;
              t_iter.remove();
              break;
            }
        }
    }
  if (pos == -1) // done
    {
      Invocation *inv = this->dump_target_->owner();
      if (inv != 0)
        {
          size_t len = 0;
          const char *oid = this->dump_target_->target_oid(len);
          if (oid != 0)
            inv->set_target (oid, len);
        }
      else
        {
          if (this->dump_target_ == &this->unknown_msg_)
            ACE_ERROR ((LM_ERROR, "%d dump ended with no target owner\n", this->offset_));
        }
      this->dump_target_ = 0;
      this->unknown_msg_.reset();
    }
}
예제 #6
0
파일: HostProcess.cpp 프로젝트: manut/TAO
void
HostProcess::dump_thread_detail (ostream &strm)
{
  this->dump_ident (strm, "thread details:");
  long total_sent = 0;
  long total_recv = 0;
  size_t total_bytes_sent = 0;
  size_t total_bytes_recv = 0;
  for (ACE_DLList_Iterator <Thread> t_iter (this->threads_);
       !t_iter.done();
       t_iter.advance())
    {
      Thread *thr = 0;
      t_iter.next(thr);
      thr->dump_detail (strm);
      thr->get_summary (total_recv, total_sent, total_bytes_recv, total_bytes_sent);
    }
  strm << "Total requests sent: " << total_sent << " received: " << total_recv << endl;
  strm << "Total requests bytes sent: " << total_bytes_sent << " received: " << total_bytes_recv << endl;
}
예제 #7
0
파일: Log.cpp 프로젝트: manut/TAO
void
Log::parse_dump_giop_msg_i (void)
{
  int sending = ACE_OS::strstr (this->info_,"send") != 0 ? 0 : 1;
  int type =  ACE_OS::strstr (this->info_,"Request") != 0 ? 0 : 1;
  int mode = sending + type * 2;

  char *pos = strrchr (this->info_,'[');
  long rid = ACE_OS::strtol(pos+1, 0, 10);
  PeerProcess *pp = this->thr_->incoming();
  if (pp == 0)
    {
      ACE_ERROR((LM_ERROR,
                 "%d: dump_msg, could not find pp for incoming, text = %s\n",
                 this->offset_, this->info_));
      return;
    }

  GIOP_Buffer *target = 0;
  switch (mode)
    {
    case 1: { // receiving request
      this->thr_->handle_request();
      Invocation *inv = pp->new_invocation (rid, this->thr_);
      if (inv == 0)
        {
          ACE_ERROR ((LM_ERROR,
                      "%d: process %s already has invocation %d\n",
                      this->offset_, pp->id(), rid));
          break;
        }
      inv->init (this->line_, this->offset_, this->thr_);
      this->thr_->push_invocation (inv);
      target = inv->octets(true);
      if (target == 0)
        {
          ACE_ERROR ((LM_ERROR, "%d: no target octets for new recv reqeust, id = %d\n",
                      this->offset_, rid));
          return;
        }
      break;
    }
    case 0: // sending request
      this->thr_->enter_wait(pp);
      this->thr_->push_invocation (0);
      // fall through.
    case 3: { // receiving reply
      Invocation *inv = pp->find_invocation(rid, this->thr_->active_handle());
      if (inv == 0)
        {
          ACE_ERROR ((LM_ERROR,
                      "%d: could not find existing invocation for req_id %d\n",
                      this->offset_, rid));
          inv = pp->new_invocation (rid,this->thr_);
        }
      inv->init (this->line_, this->offset_, this->thr_);
      target = inv->octets(mode == 0);
      if (target == 0 && mode == 3)
        {
          ACE_ERROR ((LM_ERROR,
                      "%d: could not map invocation to target for req_id %d\n",
                      this->offset_, rid));
          return;
        }
//       if (mode == 3)
//         this->thr_->exit_wait(pp, this->offset_);
      break;
    }
    case 2: { // sending reply
      target = new GIOP_Buffer(this->line_, this->offset_, this->thr_);
      this->thr_->pop_invocation ();
      break;
    }
    default:;
    }

  this->thr_->set_giop_target (target);
  if (this->giop_waiters_.size() > 0)
    {
      Thread *other_thr = 0;
      for (ACE_DLList_Iterator<Thread> t_iter(this->giop_waiters_);
           !t_iter.done();
           t_iter.advance())
        {
          t_iter.next(other_thr);
          GIOP_Buffer *tgt = other_thr->giop_target();
          if (target == 0)
            {
              ACE_ERROR ((LM_ERROR, "%d: dump_giop_msg_i, target is null, mode = %d, reqid = %d\n",
                          this->offset_, mode, rid));
              return;
            }
          if (tgt != 0 && this->thr_ != other_thr && target->matches (tgt))
            {
              this->thr_->set_dup (other_thr, true);
            }
        }
    }
  this->giop_waiters_.insert_tail(this->thr_);
}
    int Pager::insert(int index, const QPixmap & image)
    {
        index = clampIndex(index, true);

        d->images.insert(index, image);
        d->updateScrollBar();
        d->labels.insert(index, QString());
        // Deal with null images FIXME

        // Modify current index if necessary
        if (index <= d->currentIndex && d->images.size() > 0)
        {
            d->currentIndex += 1;
            d->guiIndex += 1.0;
        }

        // Modify index modifiers
        QMap< int, double > updatedModifiers;
        QMutableMapIterator< int, double > iter(d->indexPreModifiers);
        iter.toBack();
        while (iter.hasPrevious())
        {
            iter.previous();
            int targetIndex = iter.key();
            if (targetIndex >= index)
            {
                double modifier = iter.value();
                iter.remove();
                updatedModifiers[targetIndex + 1] = modifier;
            }
            else
            {
                break;
            }
        }
        d->indexPreModifiers.unite(updatedModifiers);

        updatedModifiers.clear();
        iter = d->indexPostModifiers;
        iter.toBack();
        while (iter.hasPrevious())
        {
            iter.previous();
            int targetIndex = iter.key();
            if (targetIndex >= index)
            {
                double modifier = iter.value();
                iter.remove();
                updatedModifiers[targetIndex + 1] = modifier;
            }
            else
            {
                break;
            }
        }
        d->indexPostModifiers.unite(updatedModifiers);

        // Modify transition times
        QMap< int, QTime > updatedTimes;
        QMutableMapIterator< int, QTime > t_iter(d->transitionTimes);
        t_iter.toBack();
        while (t_iter.hasPrevious())
        {
            t_iter.previous();
            int targetIndex = t_iter.key();
            if (targetIndex >= index)
            {
                QTime time = t_iter.value();
                t_iter.remove();
                updatedTimes[targetIndex + 1] = time;
            }
            else
            {
                break;
            }
        }
        d->transitionTimes.unite(updatedTimes);

        // Modify Search Hits
        QMap< int, int > updatedSearchHits;
        QMutableMapIterator< int, int > iter2(d->searchHits);
        iter2.toBack();
        while (iter2.hasPrevious())
        {
            iter2.previous();
            int targetIndex = iter2.key();
            if (targetIndex >= index)
            {
                int hits = iter2.value();
                iter2.remove();
                updatedSearchHits[targetIndex + 1] = hits;
            }
            else
            {
                break;
            }
        }
        d->searchHits.unite(updatedSearchHits);

        // Modify Annotations
        QMap< int, int > updatedHasAnnotation;
        iter2 = d->hasAnnotation;
        iter2.toBack();
        while (iter2.hasPrevious())
        {
            iter2.previous();
            int targetIndex = iter2.key();
            if (targetIndex >= index)
            {
                int hits = iter2.value();
                iter2.remove();
                updatedHasAnnotation[targetIndex + 1] = hits;
            }
            else
            {
                break;
            }
        }
        d->hasAnnotation.unite(updatedHasAnnotation);

        // Mask newly insert page
        d->indexPreModifiers[index] = -1.0;

        // Set up transition
        d->transitionTimes[index];

        d->timer.start();
        update();
        return index;
    }