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


C++ Universe::MergeMode方法代码示例

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


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

示例1: testSetMergeMode

/*
 * Check the SetMergeMode method works
 */
void OlaServerServiceImplTest::testSetMergeMode() {
  UniverseStore store(NULL, NULL);
  OlaServerServiceImpl impl(&store,
                            NULL,
                            NULL,
                            NULL,
                            NULL,
                            NULL,
                            NULL,
                            m_uid);
  OlaClientService service(NULL, &impl);

  unsigned int universe_id = 0;

  GenericAckCheck<SetMergeModeCheck> ack_check;
  GenericMissingUniverseCheck<SetMergeModeCheck, ola::proto::Ack>
    missing_universe_check;

  // Check we get an error for a missing universe
  CallSetMergeMode(&service, universe_id, ola::proto::HTP,
                   missing_universe_check);
  Universe *universe = store.GetUniverse(universe_id);
  OLA_ASSERT_FALSE(universe);

  // Check SetUniverseName works
  universe = store.GetUniverseOrCreate(universe_id);
  CallSetMergeMode(&service, universe_id, ola::proto::HTP, ack_check);
  OLA_ASSERT(Universe::MERGE_HTP == universe->MergeMode());

  // Run it again
  CallSetMergeMode(&service, universe_id, ola::proto::LTP, ack_check);
  OLA_ASSERT(Universe::MERGE_LTP == universe->MergeMode());
}
开发者ID:mlba-team,项目名称:open-lighting,代码行数:36,代码来源:OlaServerServiceImplTest.cpp

示例2: testUpdateDmxData

/*
 * Check the UpdateDmxData method works
 */
void OlaServerServiceImplTest::testUpdateDmxData() {
  UniverseStore store(NULL, NULL);
  ola::TimeStamp time1;
  ola::Client client(NULL);
  ola::Client client2(NULL);
  OlaServerServiceImpl impl(&store,
                            NULL,
                            NULL,
                            NULL,
                            NULL,
                            NULL,
                            &time1,
                            m_uid);
  OlaClientService service1(&client, &impl);
  OlaClientService service2(&client2, &impl);

  GenericMissingUniverseCheck<UpdateDmxDataCheck, ola::proto::Ack>
    missing_universe_check;
  GenericAckCheck<UpdateDmxDataCheck> ack_check;
  unsigned int universe_id = 0;
  DmxBuffer dmx_data("this is a test");
  DmxBuffer dmx_data2("different data hmm");

  // Update a universe that doesn't exist
  m_clock.CurrentTime(&time1);
  CallUpdateDmxData(&service1, universe_id, dmx_data, missing_universe_check);
  Universe *universe = store.GetUniverse(universe_id);
  OLA_ASSERT_FALSE(universe);

  // Update a universe that exists
  m_clock.CurrentTime(&time1);
  universe = store.GetUniverseOrCreate(universe_id);
  CallUpdateDmxData(&service1, universe_id, dmx_data, ack_check);
  OLA_ASSERT(dmx_data == universe->GetDMX());

  // Update a second client with an older timestamp
  // make sure we're in ltp mode
  OLA_ASSERT_EQ(universe->MergeMode(), Universe::MERGE_LTP);
  time1 = time1 - ola::TimeInterval(1000000);
  CallUpdateDmxData(&service2, universe_id, dmx_data2, ack_check);
  OLA_ASSERT_EQ(dmx_data.Size(), universe->GetDMX().Size());
  // Should continue to hold the old data
  OLA_ASSERT(dmx_data == universe->GetDMX());

  // Now send a new update
  m_clock.CurrentTime(&time1);
  CallUpdateDmxData(&service2, universe_id, dmx_data2, ack_check);
  OLA_ASSERT(dmx_data2 == universe->GetDMX());
}
开发者ID:mlba-team,项目名称:open-lighting,代码行数:52,代码来源:OlaServerServiceImplTest.cpp

示例3: testLifecycle

/*
 * Test that we can create universes and save their settings
 */
void UniverseTest::testLifecycle() {
  Universe *universe = m_store->GetUniverse(TEST_UNIVERSE);
  OLA_ASSERT_FALSE(universe);

  universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE);
  OLA_ASSERT(universe);
  OLA_ASSERT_EQ(TEST_UNIVERSE, universe->UniverseId());
  OLA_ASSERT_EQ((unsigned int) 1, m_store->UniverseCount());
  OLA_ASSERT_EQ(Universe::MERGE_LTP, universe->MergeMode());
  OLA_ASSERT_FALSE(universe->IsActive());

  string universe_name = "New Name";
  universe->SetName(universe_name);
  universe->SetMergeMode(Universe::MERGE_HTP);

  OLA_ASSERT_EQ(universe_name, universe->Name());
  OLA_ASSERT_EQ(Universe::MERGE_HTP, universe->MergeMode());

  // delete it
  m_store->AddUniverseGarbageCollection(universe);
  m_store->GarbageCollectUniverses();
  OLA_ASSERT_EQ((unsigned int) 0, m_store->UniverseCount());
  universe = m_store->GetUniverse(TEST_UNIVERSE);
  OLA_ASSERT_FALSE(universe);

  // now re-create it
  universe = m_store->GetUniverseOrCreate(TEST_UNIVERSE);
  OLA_ASSERT(universe);
  OLA_ASSERT_EQ((unsigned int) 1, m_store->UniverseCount());
  OLA_ASSERT_EQ(TEST_UNIVERSE, universe->UniverseId());
  OLA_ASSERT_EQ(universe_name, universe->Name());
  OLA_ASSERT_EQ(Universe::MERGE_HTP, universe->MergeMode());

  m_store->DeleteAll();
  OLA_ASSERT_EQ((unsigned int) 0, m_store->UniverseCount());
}
开发者ID:NextGenIntelligence,项目名称:ola,代码行数:39,代码来源:UniverseTest.cpp

示例4: GetUniverseInfo

/*
 * Returns information on the active universes.
 */
void OlaServerServiceImpl::GetUniverseInfo(
    RpcController* controller,
    const OptionalUniverseRequest* request,
    UniverseInfoReply* response,
    ola::rpc::RpcService::CompletionCallback* done) {
  ClosureRunner runner(done);
  UniverseInfo *universe_info;

  if (request->has_universe()) {
    // return info for a single universe
    Universe *universe = m_universe_store->GetUniverse(request->universe());
    if (!universe)
      return MissingUniverseError(controller);

    universe_info = response->add_universe();
    universe_info->set_universe(universe->UniverseId());
    universe_info->set_name(universe->Name());
    universe_info->set_merge_mode(universe->MergeMode() == Universe::MERGE_HTP
        ? ola::proto::HTP: ola::proto::LTP);
    universe_info->set_input_port_count(universe->InputPortCount());
    universe_info->set_output_port_count(universe->OutputPortCount());
    universe_info->set_rdm_devices(universe->UIDCount());
  } else {
    // return all
    vector<Universe*> uni_list;
    m_universe_store->GetList(&uni_list);
    vector<Universe*>::const_iterator iter;

    for (iter = uni_list.begin(); iter != uni_list.end(); ++iter) {
      universe_info = response->add_universe();
      universe_info->set_universe((*iter)->UniverseId());
      universe_info->set_name((*iter)->Name());
      universe_info->set_merge_mode((*iter)->MergeMode() == Universe::MERGE_HTP
          ? ola::proto::HTP: ola::proto::LTP);
      universe_info->set_input_port_count((*iter)->InputPortCount());
      universe_info->set_output_port_count((*iter)->OutputPortCount());
      universe_info->set_rdm_devices((*iter)->UIDCount());
    }
  }
}
开发者ID:basileus,项目名称:ola,代码行数:43,代码来源:OlaServerServiceImpl.cpp


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