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

C++ publish函数代码示例

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

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



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

示例1: addDownwardDetector

void VisionSystem::pipeLineDetectorOn()
{
    addDownwardDetector(m_pipelineDetector);
    publish(EventType::PIPELINE_DETECTOR_ON,
            core::EventPtr(new core::Event()));
}
开发者ID:JasonHagler,项目名称:tortuga,代码行数:6,代码来源:VisionSystem.cpp


示例2: publish

void Telemetry::pub(const char * topic, const char * msg)
{
    publish(topic,msg);
}
开发者ID:Overdrivr,项目名称:Telemetry-mbed,代码行数:4,代码来源:Telemetry.cpp


示例3: start

bool SynapseSimulatorUpdater<MType>::
start(std::function<bool()> thread_init,
      std::function<bool()> thread_destroy) {
  struct Synchronizer : public DataBuffer {
    DeviceNeuronStateBuffer<MType>* neuron_state;
    SynapticFireVectorBuffer<MType>* synaptic_fire;
    SynapticCurrentBuffer<MType>* synaptic_current;
    float simulation_time;
    float time_step;
  };
  auto synchronizer_publisher = new SpecificPublisher<Synchronizer>();
  for (size_t i = 0; i < num_buffers_; ++i) {
    synchronizer_publisher->addBlank(new Synchronizer());
  }
  auto master_function = [this,
                          synchronizer_publisher,
                          thread_init,
                          thread_destroy]() {
    thread_init();
    float simulation_time = 0.0f;
    float time_step = simulation_parameters_->getTimeStep();
    unsigned int simulation_step = 0;
    Mailbox mailbox;
    while(true) {
      DeviceNeuronStateBuffer<MType>* neuron_state = nullptr;
      neuron_state_subscription_->pull(&neuron_state, &mailbox);
      SynapticFireVectorBuffer<MType>* synaptic_fire = nullptr;
      fire_subscription_->pull(&synaptic_fire, &mailbox);
      if (!mailbox.wait(&neuron_state, &synaptic_fire)) {
        neuron_state_subscription_->cancel();
        fire_subscription_->cancel();
        if (neuron_state) {
          neuron_state->release();
        }
        if (synaptic_fire) {
          synaptic_fire->release();
        }
        delete synchronizer_publisher;
        break;
      }
      auto synchronizer = synchronizer_publisher->getBlank();
      auto synaptic_current = this->getBlank();
      synaptic_current->simulation_step = simulation_step;
      if (!synaptic_current->clear()) {
        std::cerr << "Failed to clear SynapticCurrentBuffer." <<
          std::endl;
      }
      synchronizer->neuron_state = neuron_state;
      synchronizer->synaptic_fire = synaptic_fire;
      synchronizer->synaptic_current = synaptic_current;
      synchronizer->time_step = time_step;
      synchronizer->simulation_time = simulation_time;
      auto prerelease_function = [this, synchronizer]() {
        this->publish(synchronizer->synaptic_current);
        synchronizer->neuron_state->release();
        synchronizer->synaptic_fire->release();
      };
      synchronizer->setPrereleaseFunction(prerelease_function);
      synchronizer_publisher->publish(synchronizer);
      simulation_time += time_step;
      ++simulation_step;
    }
    thread_destroy();
  };
  master_thread_ = std::thread(master_function);

  for (size_t i = 0; i < simulators_.size(); ++i) {
    auto simulator = simulators_[i];
    auto unit_offset = device_synaptic_vector_offsets_[i];
    auto subscription = synchronizer_publisher->subscribe();
    auto worker_function = [subscription, 
                            simulator, 
                            unit_offset,
                            thread_init,
                            thread_destroy]() {
      thread_init();
      auto word_offset = Bit::num_words(unit_offset);
      while (true) {
        auto synchronizer = subscription->pull();
        if (nullptr == synchronizer) {
          delete subscription;
          break;
        }
        SynapseUpdateParameters parameters;
        parameters.synaptic_fire =
          synchronizer->synaptic_fire->getFireBits() + word_offset;
        parameters.neuron_voltage =
          synchronizer->neuron_state->getVoltages();
        parameters.device_neuron_fire =
          synchronizer->neuron_state->getFireBits();
        parameters.synaptic_current =
          synchronizer->synaptic_current->getCurrents();
        parameters.write_lock =
          synchronizer->synaptic_current->getWriteLock();
        parameters.simulation_time = synchronizer->simulation_time;
        parameters.time_step = synchronizer->time_step;
        if (!simulator->update(&parameters)) {
          std::cerr << "An error occurred updating a SynapseSimulator." <<
            std::endl;
        }
//.........这里部分代码省略.........
开发者ID:BrainComputationLab,项目名称:ncs,代码行数:101,代码来源:SynapseSimulatorUpdater.hpp


示例4: publish

void rice::tutorial::splitstream::MySplitStreamClient::deliver(::rice::p2p::commonapi::Id* id, ::rice::p2p::commonapi::Message* message)
{
    if(dynamic_cast< MySplitStreamClient_PublishContent* >(message) != nullptr) {
        publish();
    }
}
开发者ID:subhash1-0,项目名称:thirstyCrow,代码行数:6,代码来源:MySplitStreamClient.cpp


示例5: metadataSubscriptionCallback

 void metadataSubscriptionCallback(ros::pub_sub_conn* conn)
 {
   publish( "map_metadata", meta_data_message_ );
 }
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:4,代码来源:main.cpp


示例6: addForwardDetector

void VisionSystem::hedgeDetectorOn()
{
    addForwardDetector(m_hedgeDetector);
    publish(EventType::HEDGE_DETECTOR_ON,
            core::EventPtr(new core::Event()));
}
开发者ID:JasonHagler,项目名称:tortuga,代码行数:6,代码来源:VisionSystem.cpp


示例7: publish

bool MQTT::publish(String& topic, const char* buf, uint32_t buf_len, int qos, int retain)
{
	return publish(topic.c_str(), buf, buf_len, qos, retain);
}
开发者ID:i-n-g-o,项目名称:esp-mqtt-arduino,代码行数:4,代码来源:MQTT.cpp


示例8: publish

void VisionSystem::downwardSafeDetectorOff()
{
    m_downward->removeDetector(m_downwardSafeDetector);
    publish(EventType::SAFE_DETECTOR_OFF,
            core::EventPtr(new core::Event()));
}
开发者ID:JasonHagler,项目名称:tortuga,代码行数:6,代码来源:VisionSystem.cpp


示例9: publish

bool MQTTclient::publish(const String& topic, const float& msg) {
	return publish(topic, String(msg));
}
开发者ID:pumanzor,项目名称:iot-redlibre,代码行数:3,代码来源:MQTTclient.cpp


示例10: publish

void MosqConnect::pub(QString topic, QString subject)
{
    publish(NULL, topic.toAscii(), subject.size(), subject.toAscii());
}
开发者ID:simonsso,项目名称:mqtt2nexa,代码行数:4,代码来源:MosqConnect.cpp


示例11: TextMessage

String MessageChannel::publish( MessageSession *p_session , MessagePublisher *pub , const char *msg ) {
	TextMessage *l_msg = new TextMessage();
	l_msg -> setMessageType( pub -> msgtype );
	l_msg -> setText( msg );
	return( publish( p_session , pub , l_msg ) );
}
开发者ID:AbhishekGhosh,项目名称:Artificial-Human,代码行数:6,代码来源:messagechannel.cpp


示例12: publish

/*!
 * \brief Publish a message
 * \param topic The topic of the publish
 * \param msg The (ASCII) message to publish
 *
 * Create a PUBLISH packet and send it to the MQTT server
 *
 * \returns false if sending the message failed somehow
 */
bool MQTT::publish(const char * topic, const char * msg, uint8_t qos)
{
    return publish(topic, (const uint8_t *)msg, strlen(msg), qos);
}
开发者ID:SodaqMoja,项目名称:Sodaq_MQTT,代码行数:13,代码来源:Sodaq_MQTT.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pud_addr_end函数代码示例发布时间:2022-05-30
下一篇:
C++ ptype函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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