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


C++ qiLogDebug函数代码示例

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


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

示例1: qiLogDebug

void StrandPrivate::enqueue(boost::shared_ptr<Callback> cbStruct)
{
  qiLogDebug() << "Enqueueing job id " << cbStruct->id;
  bool shouldschedule = false;

  {
    boost::mutex::scoped_lock lock(_mutex);
    // the callback may have been canceled
    if (cbStruct->state == State_None)
    {
      _queue.push_back(cbStruct);
      cbStruct->state = State_Scheduled;
    }
    else
      qiLogDebug() << "Job is not schedulable, state " << (int)cbStruct->state;
    // if process was not scheduled yet, do it, there is work to do
    if (!_processing)
    {
      _processing = true;
      shouldschedule = true;
    }
  }

  if (shouldschedule)
  {
    qiLogDebug() << "StrandPrivate::process was not scheduled, doing it";
    _eventLoop.async(boost::bind(&StrandPrivate::process, shared_from_this()),
        qi::Duration(0));
  }
}
开发者ID:hejunbok,项目名称:libqi,代码行数:30,代码来源:strand.cpp

示例2: insertAsyncParentTrace

 // Find out our async parent and add to it
 static bool insertAsyncParentTrace(CallList& l, CallData* d)
 {
   if (l.empty())
   {
     qiLogDebug() << "empty";
     return false;
   }
   qiLogDebug() << l.front()->tStart;
   // Get first entry that started after our post time.
   CallList::iterator it = std::upper_bound(l.begin(), l.end(), CallTime(d->tPost));
   if (it == l.begin())
   { // damm, first element is older than us
     qiLogInfo() << "No async parent can be found";
     return false;
   }
   --it;
   qiLogDebug() << "Child check";
   // try if a sync child is better placed than it
   bool wasInserted = insertAsyncParentTrace((*it)->children, d);
   if (wasInserted)
     return true;
   // was not inserted in children, insert here
   (*it)->asyncChildren.push_back(d);
   d->asyncParent = *it;
   return true;
 }
开发者ID:ZhaozhengPlus,项目名称:libqi,代码行数:27,代码来源:traceanalyzer.cpp

示例3: qiLogDebug

  void RemoteObject::close(const std::string& reason, bool fromSignal)
  {
    qiLogDebug() << "Closing remote object";
    TransportSocketPtr socket;
    {
       boost::mutex::scoped_lock lock(_socketMutex);
       socket = _socket;
       _socket.reset();
    }
    if (socket)
    { // Do not hold any lock when invoking signals.
        qiLogDebug() << "Removing connection from socket " << (void*)socket.get();
        socket->messagePendingDisconnect(_service, TransportSocket::ALL_OBJECTS, _linkMessageDispatcher);
        if (!fromSignal)
          socket->disconnected.disconnect(_linkDisconnected);
    }
    std::map<int, qi::Promise<AnyReference> > promises;
    {
      boost::mutex::scoped_lock lock(_promisesMutex);
      promises = _promises;
      _promises.clear();
    }
    // Nobody should be able to add anything to promises at this point.
    std::map<int, qi::Promise<AnyReference> >::iterator it;
    for (it = promises.begin(); it != promises.end(); ++it)
    {
      qiLogVerbose() << "Reporting error for request " << it->first << "(" << reason << ")";
      it->second.setError(reason);
    }

    //@warning: remove connection are not removed
    //          not very important ATM, because RemoteObject
    //          cant be reconnected
  }
开发者ID:ZhaozhengPlus,项目名称:libqi,代码行数:34,代码来源:remoteobject.cpp

示例4: TEST

TEST(Proxy, Property)
{
  boost::shared_ptr<Bar> bar(new Bar);
  qi::AnyObject gbar = qi::AnyReference::from(bar).toObject();
  ASSERT_TRUE(!!gbar);
  // The session must die before bar.
  TestSessionPair p;
  p.server()->registerService("bar", gbar);
  // we need that to force two clients
  p.server()->registerService("bar2", gbar);
  qi::AnyObject client = p.client()->service("bar");
  ASSERT_EQ(0, client.call<int>("sum"));

  qi::ProxyProperty<int> pp(client, "prop");
  bar->set(1);
  ASSERT_EQ(1, pp.get());
  pp.set(2);
  ASSERT_EQ(2, bar->get());
  // althoug PropertyProxy::set is itself synchronous, notify on remote end
  // may be asynchronous, so subscribe below may come too soon and catch
  // the pp.set above
  qi::os::msleep(100);
  qiLogDebug() << "subscribe";
  bar->subscribe();
  qi::os::msleep(100);
  qiLogDebug() << "set 3";
  pp.set(3);
  // this is an event, all notify are asychronous
  PERSIST_ASSERT(, bar->sum() == 3, 500);

  Bar bar2;
  qi::SignalLink l = pp.connect(boost::bind(&Bar::onProp, &bar2, _1));
  bar->set(4);
  // this one is async (remote notify of local property set)
  PERSIST_ASSERT(, bar2.sum() == 4, 500);
  pp.disconnect(l);
  bar->set(5); // we expect an async op *not* to happen, no choice but wait.
  qi::os::msleep(200);
  ASSERT_EQ(4, bar2.sum());
  // reconnect to see if disconnect did not break anything
  l = pp.connect(boost::bind(&Bar::onProp, &bar2, _1));
  bar->set(4);
  PERSIST_ASSERT(, bar2.sum() == 8, 500);

  // proxy-proxy
  qi::AnyObject client2 = p.client()->service("bar2");
  qi::ProxyProperty<int> pp2(client2, "prop");
  Bar bar3;
  pp2.connect(boost::bind(&Bar::onProp, &bar3, _1));
  qiLogDebug() << "set 2";
  pp.set(2);
  PERSIST(, bar3.sum() == 2, 1000);
  ASSERT_EQ(2, bar3.sum());
  PERSIST(, bar2.sum() == 10, 500);
  ASSERT_EQ(10, bar2.sum());
  qiLogDebug() << "set 3";
  pp2.set(3);
  PERSIST_ASSERT(, bar2.sum() == 13, 500);
  PERSIST_ASSERT(, bar3.sum() == 5, 500);
}
开发者ID:ZhaozhengPlus,项目名称:libqi,代码行数:60,代码来源:test_proxy.cpp

示例5: TEST

TEST(QiSession, GettingServiceWhileDisconnecting)
{
  qi::SessionPtr server = qi::makeSession();
  server->listenStandalone("tcp://0.0.0.0:0");

  qi::DynamicObjectBuilder builder;
  qi::AnyObject object(builder.object());

  std::string serviceName = "sarace";
  server->registerService(serviceName, object);

  qi::SessionPtr client = qi::makeSession();

  for(int i = 0; i < 1000; ++i)
  {
    client->connect(server->endpoints()[0]);
    qi::Future<void> closing = client->close().async();
    try
    {
      qi::AnyObject remoteObject = client->service(serviceName);
      bool remoteObjectWasFound = remoteObject;
      ASSERT_TRUE(remoteObjectWasFound);
    }
    catch(const qi::FutureException& e)
    {
      qiLogDebug() << "Got expected error: " << e.what();
    }
    catch(const std::exception& e)
    {
      qiLogDebug() << "Got standard error: " << e.what();
    }
    closing.wait();
  }
}
开发者ID:soshiant1992,项目名称:libqi,代码行数:34,代码来源:test_call_on_close_session.cpp

示例6: prom

  qi::Future<SignalLink> RemoteObject::metaConnect(unsigned int event, const SignalSubscriber& sub)
  {
    qi::Promise<SignalLink> prom(qi::FutureCallbackType_Sync);

    // Bind the subscriber locally.
    SignalLink uid = DynamicObject::metaConnect(event, sub);

    boost::recursive_mutex::scoped_lock _lock(_localToRemoteSignalLinkMutex);
    // maintain a map of localsignal -> remotesignal
    //(we only use one remotesignal, for many locals)
    LocalToRemoteSignalLinkMap::iterator it;
    RemoteSignalLinks& rsl = _localToRemoteSignalLink[event];
    rsl.localSignalLink.push_back(uid);

    if (rsl.remoteSignalLink == qi::SignalBase::invalidSignalLink)
    {
      /* Try to handle struct versionning.
      * Hypothesis: Everything in this address space uses the same struct
      * version. It makes sense since typesystem does not handle conflicting
      * definitions for the same type name (due to global typeid->typeinterface factory).
      *
      * So we use the very first subscriber to try to detect a version mismatch
      * between what the callback expects, and what the signal advertises.
      * If so we inform the remote end to try to convert for us.
      */
      Signature subSignature = sub.signature();
      float score = 1;
      if (subSignature.isValid())
      {
        const MetaSignal* ms = metaObject().signal(event);
        if (!ms)
          return makeFutureError<SignalLink>("Signal not found");
        score = ms->parametersSignature().isConvertibleTo(subSignature);
        qiLogDebug() << "Conversion score " << score << " " << ms->parametersSignature().toString() << " -> "
                     << subSignature.toString();
        if (!score)
        {
          std::ostringstream ss;
          ss << "Subscriber not compatible to signal signature: cannot convert " << ms->parametersSignature().toString()
             << " to " << subSignature.toString();
          return makeFutureError<SignalLink>(ss.str());
        }
      }
      rsl.remoteSignalLink = uid;
      qiLogDebug() << "connect() to " << event << " gave " << uid << " (new remote connection)";
      if (score >= 0.2)
        rsl.future = _self.async<SignalLink>("registerEvent", _service, event, uid);
      else // we might or might not be capable to convert, ask the remote end to try also
        rsl.future =
            _self.async<SignalLink>("registerEventWithSignature", _service, event, uid, subSignature.toString());
    }
    else
    {
      qiLogDebug() << "connect() to " << event << " gave " << uid << " (reusing remote connection)";
    }

    rsl.future.connect(boost::bind<void>(&onEventConnected, this, _1, prom, uid));
    return prom.future();
  }
开发者ID:ZhaozhengPlus,项目名称:libqi,代码行数:59,代码来源:remoteobject.cpp

示例7: replyBuf

qi::Buffer replyBuf(const qi::Buffer& buf)
{
  qiLogDebug() << "enter";
  if (msDelay)
    qi::os::msleep(msDelay);
  qi::Buffer res = qi::Buffer(buf);
  qiLogDebug() << "leave";
  return res;
}
开发者ID:bsautron,项目名称:libqi,代码行数:9,代码来源:perf_transport.cpp

示例8: recordCount

 /// The number of records.
 size_t recordCount() const
 {
   qiLogDebug("qi.signalspy") << "Getting record count "
                              << (strand()->isInThisContext() ? "from strand" : "from outside");
   return async([this]
   {
     qiLogDebug("qi.signalspy") << "Getting record count";
     return _records.size();
   }).value();
 }
开发者ID:david781,项目名称:libqi,代码行数:11,代码来源:signalspy.hpp

示例9: lock

  qi::FutureSync<void> ServiceDirectoryClient::onSocketDisconnected(std::string error) {
    qi::Future<void> fut;
    {
      qi::TransportSocketPtr socket;
      { // can't hold lock while disconnecting signals, so swap _sdSocket.
        boost::mutex::scoped_lock lock(_mutex);
        std::swap(socket, _sdSocket);
      }

      if (!socket)
        return qi::Future<void>(0);
      // We just manually triggered onSocketDisconnected, so unlink
      // from socket signal before disconnecting it.
      socket->disconnected.disconnect(_sdSocketDisconnectedSignalLink);
      // Manually trigger close on our remoteobject or it will be called
      // asynchronously from socket.disconnected signal, and we would need to
      // wait fo it.
      _remoteObject.close();
      fut = socket->disconnect();

      // Hold the socket shared ptr alive until the future returns.
      // otherwise, the destructor will block us until disconnect terminates
      // Nasty glitch: socket is reusing promises, so this future hook will stay
      // So pass shared pointer by pointer: that way a single delete statement
      // will end all copies.
      fut.connect(&sharedPtrHolder, new TransportSocketPtr(socket));
    }

    qi::SignalLink add=0, remove=0;
    qi::AnyObject object;
    {
      boost::mutex::scoped_lock lock(_mutex);
      std::swap(add, _addSignalLink);
      std::swap(remove, _removeSignalLink);
    }
    try {
      if (add != 0)
      {
        _object.disconnect(add);
      }
    } catch (std::runtime_error &e) {
      qiLogDebug() << "Cannot disconnect SDC::serviceAdded: " << e.what();
    }
    try {
      if (remove != 0)
      {
        _object.disconnect(remove);
      }
    } catch (std::runtime_error &e) {
        qiLogDebug() << "Cannot disconnect SDC::serviceRemoved: " << e.what();
    }
    disconnected(error);

    return fut;
  }
开发者ID:cgestes,项目名称:libqi,代码行数:55,代码来源:servicedirectoryclient.cpp

示例10: record

  /// Direct access to a record, by order of arrival.
  Record record(size_t index) const
  {
    qiLogDebug("qi.signalspy") << "Getting record #" << index << " "
                               << (strand()->isInThisContext() ? "from strand" : "from outside");

    return async([this, index]
    {
      qiLogDebug("qi.signalspy") << "Getting record #" << index;
      return _records[index];
    }).value();
  }
开发者ID:david781,项目名称:libqi,代码行数:12,代码来源:signalspy.hpp

示例11: qiLogDebug

void TimelinePrivate::stop(bool join)
{
  qiLogDebug() << "Stopping timeline " << _name;
  _executer->stopExecuter(join);

  {
    boost::unique_lock<boost::recursive_mutex> lock(_methodMonitor);

    killMotionOrders();
  }

  qiLogDebug() << "Timeline " << _name << " stopped";
}
开发者ID:cgestes,项目名称:libqicore,代码行数:13,代码来源:timeline.cpp

示例12: lock

  unsigned int ServiceDirectory::registerService(const ServiceInfo &svcinfo)
  {
    boost::shared_ptr<ServiceBoundObject> sbo = serviceBoundObject.lock();
    if (!sbo)
      throw std::runtime_error("ServiceBoundObject has expired.");

    TransportSocketPtr socket = sbo->currentSocket();
    boost::recursive_mutex::scoped_lock lock(mutex);
    std::map<std::string, unsigned int>::iterator it;
    it = nameToIdx.find(svcinfo.name());
    if (it != nameToIdx.end())
    {
      std::stringstream ss;
      ss << "Service \"" <<
        svcinfo.name() <<
        "\" (#" << it->second << ") is already registered. " <<
        "Rejecting conflicting registration attempt.";
      qiLogWarning()  << ss.str();
      throw std::runtime_error(ss.str());
    }

    unsigned int idx = ++servicesCount;
    nameToIdx[svcinfo.name()] = idx;
    // Do not add serviceDirectory on the map (socket() == null)
    if (idx != qi::Message::Service_ServiceDirectory)
      socketToIdx[socket].push_back(idx);
    pendingServices[idx] = svcinfo;
    pendingServices[idx].setServiceId(idx);
    idxToSocket[idx] = socket;

    std::stringstream ss;
    ss << "Registered Service \"" << svcinfo.name() << "\" (#" << idx << ")";
    if (! svcinfo.name().empty() && svcinfo.name()[0] == '_') {
      // Hide services whose name starts with an underscore
      qiLogDebug() << ss.str();
    }
    else
    {
      qiLogInfo() << ss.str();
    }

    qi::UrlVector::const_iterator jt;
    for (jt = svcinfo.endpoints().begin(); jt != svcinfo.endpoints().end(); ++jt)
    {
      qiLogDebug() << "Service \"" << svcinfo.name() << "\" is now on " << jt->str();
    }

    return idx;
  }
开发者ID:ZhaozhengPlus,项目名称:libqi,代码行数:49,代码来源:servicedirectory.cpp

示例13: qiLogDebug

 void *Buffer::read(size_t off, size_t length) const
 {
   if (!_p)
   {
     qiLogDebug("qi.buffer") << "read on empty buffer";
     return 0;
   }
   if (off + length > _p->used)
   {
     qiLogDebug("qi.buffer") << "Attempt to read " << off+length
      <<" on buffer of size " << _p->used;
     return 0;
   }
   return (char*)_p->data() + off;
 }
开发者ID:gnatali,项目名称:libqi,代码行数:15,代码来源:buffer.cpp

示例14: qiLogDebug

  bool ParameterModel::addChoice(ChoiceModelPtr choice)
  {
    qiLogDebug() << "addChoice function" << std::endl;
    Signature signature(_p->_metaProperty.signature());

    //if false choice and parameter are the same type
    if(Signature(choice->value().signature()).isConvertibleTo(signature) < 1.0f )
    {
      qiLogWarning() << "choice.type (i.e "
                     << choice->value().signature().toString()
                     << ") != parameter.type (i.e "
                     << _p->_defaultValue.signature().toString()
                     <<")"
                     << std::endl;
      return false;
    }

    //If choice.value is not in [parameter.min, paramater.max] then the choice
    //is incorrect
    if(!_p->inInterval(choice->value(),
                       _p->_min,
                       _p->_max)
       )
    {
      qiLogInfo()    << "Choice : is not in interval"
                     << std::endl;
      return false;
    }

    _p->_choices.push_front(choice);
    return true;
  }
开发者ID:cgestes,项目名称:libqicore,代码行数:32,代码来源:parametermodel.cpp

示例15: qiLogVerbose

    void *dlopen(const char *filename, int flag) {
      g_LastError.reset();
      std::string fullName = path::findLib(filename);
      if (fullName.empty())
      {
        qiLogVerbose() << "Could not locate library " << filename;
        fullName = filename; // Do not return here, let sys call fails and set errno.
        if (fullName.empty())
        {
          // do not allow dlopen(""), it will return a valid handler to the
          // current process
          g_LastError.reset(const_cast<char*>("trying to dlopen empty filename"));
          return NULL;
        }
      }
      void *handle = NULL;
      boost::filesystem::path fname(fullName, qi::unicodeFacet());
      qiLogDebug() << "opening " << fname;
#ifdef _WIN32
      handle = LoadLibraryW(fname.wstring(qi::unicodeFacet()).c_str());
#else
      if (flag == -1)
        flag = RTLD_NOW;
      handle = ::dlopen(fname.string(qi::unicodeFacet()).c_str(), flag);
#endif
      return handle;
    }
开发者ID:cgestes,项目名称:libqi,代码行数:27,代码来源:dlfcn.cpp


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