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


C++ UIDSet类代码示例

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


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

示例1: uid_to_remove

/**
 * Test multiple responders
 */
void DiscoveryAgentTest::testMultipleResponders() {
  UIDSet uids;
  ResponderList responders;
  UID uid_to_remove(0x7a70, 0x00002001);
  uids.AddUID(uid_to_remove);
  uids.AddUID(UID(0x7a70, 0x00002002));
  uids.AddUID(UID(0x7a77, 0x00002002));
  PopulateResponderListFromUIDs(uids, &responders);
  MockDiscoveryTarget target(responders);

  DiscoveryAgent agent(&target);
  OLA_INFO << "starting discovery with two responder";
  agent.StartFullDiscovery(
      ola::NewSingleCallback(this,
                             &DiscoveryAgentTest::DiscoverySuccessful,
                             static_cast<const UIDSet*>(&uids)));
  CPPUNIT_ASSERT(m_callback_run);
  m_callback_run = false;

  // now try incremental, adding one uid and removing another
  UID uid_to_add(0x8080, 0x00103456);
  uids.RemoveUID(uid_to_remove);
  uids.AddUID(uid_to_add);
  // update the responder list
  target.RemoveResponder(uid_to_remove);
  target.AddResponder(new MockResponder(uid_to_add));

  OLA_INFO << "starting incremental discovery with modified responder list";
  agent.StartIncrementalDiscovery(
      ola::NewSingleCallback(this,
                             &DiscoveryAgentTest::DiscoverySuccessful,
                             static_cast<const UIDSet*>(&uids)));
  CPPUNIT_ASSERT(m_callback_run);
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:37,代码来源:DiscoveryAgentTest.cpp

示例2: _WaitForFolderState

void
IMAPFolder::MessageEntriesFetched()
{
	_WaitForFolderState();

	// Synchronize all pending flags first
	UIDToFlagsMap::const_iterator pendingIterator = fPendingFlagsMap.begin();
	for (; pendingIterator != fPendingFlagsMap.end(); pendingIterator++)
		SyncMessageFlags(pendingIterator->first, pendingIterator->second);

	fPendingFlagsMap.clear();

	// Delete all local messages that are no longer found on the server

	MutexLocker locker(fLock);
	UIDSet deleteUIDs;
	UIDToRefMap::const_iterator iterator = fRefMap.begin();
	for (; iterator != fRefMap.end(); iterator++) {
		uint32 uid = iterator->first;
		if (fSynchronizedUIDsSet.find(uid) == fSynchronizedUIDsSet.end())
			deleteUIDs.insert(uid);
	}

	fSynchronizedUIDsSet.clear();
	locker.Unlock();

	UIDSet::const_iterator deleteIterator = deleteUIDs.begin();
	for (; deleteIterator != deleteUIDs.end(); deleteIterator++)
		_DeleteLocalMessage(*deleteIterator);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:30,代码来源:IMAPFolder.cpp

示例3: controller

/*
 * Check that interleaving requests and discovery commands work.
 */
void QueueingRDMControllerTest::testRequestAndDiscovery() {
  MockRDMController mock_controller;
  auto_ptr<ola::rdm::DiscoverableQueueingRDMController> controller(
      new ola::rdm::DiscoverableQueueingRDMController(&mock_controller, 1));

  UIDSet uids;
  UID uid1(2, 3);
  UID uid2(10, 11);
  uids.AddUID(uid1);
  uids.AddUID(uid2);

  // Send a request, but don't run the RDM request callback
  RDMRequest *get_request = NewGetRequest(m_source, m_destination);
  mock_controller.ExpectCallAndCapture(get_request);

  RDMReply *expected_reply = new RDMReply(
      ola::rdm::RDM_COMPLETED_OK,
      NewGetResponse(m_destination, m_source));

  controller->SendRDMRequest(
      get_request,
      ola::NewSingleCallback(
          this,
          &QueueingRDMControllerTest::VerifyResponse,
          expected_reply));

  // now queue up a discovery request
  controller->RunFullDiscovery(
      NewSingleCallback(
          this,
          &QueueingRDMControllerTest::VerifyDiscoveryComplete,
          &uids));
  mock_controller.Verify();
  OLA_ASSERT_FALSE(m_discovery_complete_count);

  // now run the RDM callback, this should unblock the discovery process
  mock_controller.AddExpectedDiscoveryCall(true, NULL);
  mock_controller.RunRDMCallback(expected_reply);
  mock_controller.Verify();

  // now queue another RDM request
  RDMRequest *get_request2 = NewGetRequest(m_source, m_destination);
  RDMReply *expected_reply2 = new RDMReply(
      ola::rdm::RDM_COMPLETED_OK,
      NewGetResponse(m_destination, m_source));
  mock_controller.ExpectCallAndReplyWith(get_request2, expected_reply2);

  // discovery is still running so this won't send the request just yet.
  controller->SendRDMRequest(
      get_request2,
      ola::NewSingleCallback(
          this,
          &QueueingRDMControllerTest::VerifyResponse,
          expected_reply2));

  // now finish the discovery
  mock_controller.RunDiscoveryCallback(uids);
  OLA_ASSERT_TRUE(m_discovery_complete_count);
  mock_controller.Verify();
}
开发者ID:nightrune,项目名称:ola,代码行数:63,代码来源:QueueingRDMControllerTest.cpp

示例4: PopulateResponderListFromUIDs

/**
 * Build a vector of MockResponder objects with the given uids.
 */
void DiscoveryAgentTest::PopulateResponderListFromUIDs(
    const UIDSet &uids,
    ResponderList *responders) {
  UIDSet::Iterator iter = uids.Begin();
  for (; iter != uids.End(); iter++)
    responders->push_back(new MockResponder(*iter));
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:10,代码来源:DiscoveryAgentTest.cpp

示例5: ShowUIDs

 void ShowUIDs() {
   UIDSet::Iterator iter = m_uids.Begin();
   cout << "---------- " << m_uids.Size() << " UIDs -------" << endl;
   char c = 'A';
   for (; iter != m_uids.End(); ++iter) {
     if (c <= 'Z') {
       cout << *iter << " (" << c++ << ")" << endl;
     } else {
       cout << *iter << endl;
     }
   }
   cout << "-------------------------" << endl;
 }
开发者ID:DanielAeolusLaude,项目名称:ola,代码行数:13,代码来源:ja-rule-controller.cpp

示例6: runner

/**
 * Called when RDM discovery completes
 */
void OlaServerServiceImpl::RDMDiscoveryComplete(
    unsigned int universe_id,
    ola::rpc::RpcService::CompletionCallback* done,
    ola::proto::UIDListReply *response,
    const UIDSet &uids) {
  ClosureRunner runner(done);

  response->set_universe(universe_id);
  UIDSet::Iterator iter = uids.Begin();
  for (; iter != uids.End(); ++iter) {
    ola::proto::UID *uid = response->add_uid();
    SetProtoUID(*iter, uid);
  }
}
开发者ID:basileus,项目名称:ola,代码行数:17,代码来源:OlaServerServiceImpl.cpp

示例7: runner

/**
 * Called when RDM discovery completes
 */
void OlaServerServiceImpl::RDMDiscoveryComplete(
    unsigned int universe_id,
    google::protobuf::Closure* done,
    ola::proto::UIDListReply *response,
    const UIDSet &uids) {
  ClosureRunner runner(done);

  response->set_universe(universe_id);
  UIDSet::Iterator iter = uids.Begin();
  for (; iter != uids.End(); ++iter) {
    ola::proto::UID *uid = response->add_uid();
    uid->set_esta_id(iter->ManufacturerId());
    uid->set_device_id(iter->DeviceId());
  }
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:18,代码来源:OlaServerServiceImpl.cpp

示例8: main

int main(int argc, char* argv[]) {
    UIDSet uids;

    if (argc < 3) {
        std::cerr << "ERROR: Must have at least two arguments: basename and a UID"
                  << std::endl;
        return -1;
    }

    try {
        stoi(argv[1], NULL, 10);
        std::cerr << "ERROR: First argument must not be an integer"
                  << std::endl;
        return -1;
    } catch (...) {}

    std::string basename(std::string(argv[1]) + "_mixed");

    if (basename.find("/") != std::string::npos) {
        std::cerr << "ERROR: Basename may not contain path separator"
                  << std::endl;
        return -1;
    }

    for (int i = 2; i < argc; ++i) {
        uids.insert(stoi(argv[i], NULL, 10));
    }
    ParamSet extraParams;
    extraParams.insert(-1); // Don't-care value
    SetuidState startState = SetuidState::get();
    Explorer explorer(
        Graph(VG(), uids, startState),
        EG(),
        uids,
        extraParams);

    explorer.exploreAll();

    Graph const& graph = explorer.getGraph();
    GraphName name(basename, uids, extraParams);
    ArchiveWriter<Graph>().write(graph, name);
    DotWriter<Graph>().write(graph, name);

    return 0;
}
开发者ID:mdittmer,项目名称:unix-process-identity,代码行数:45,代码来源:CollectSetuidPrivData.cpp

示例9: DiscoveryFailed

/**
 * Called when discovery completes and fails for some reason.
 */
void DiscoveryAgentTest::DiscoveryFailed(const UIDSet *expected,
                                         bool successful,
                                         const UIDSet &received) {
  OLA_INFO << "in discovery callback, size is " << received.Size() <<
      ", state: " << successful;
  OLA_ASSERT_FALSE(successful);
  OLA_ASSERT_EQ(*expected, received);
  m_callback_run = true;
}
开发者ID:DouglasHeriot,项目名称:ola,代码行数:12,代码来源:DiscoveryAgentTest.cpp

示例10: PopulateResponderListFromUIDs

/**
 * Test a responder that replies with too little data.
 */
void DiscoveryAgentTest::testBriefResponder() {
  UIDSet uids;
  ResponderList responders;
  uids.AddUID(UID(0x7a70, 0x00002002));
  PopulateResponderListFromUIDs(uids, &responders);
  // add the BriefResponder
  UID brief_uid = UID(0x7a77, 0x00002002);
  responders.push_back(new BriefResponder(brief_uid));
  MockDiscoveryTarget target(responders);

  DiscoveryAgent agent(&target);
  OLA_INFO << "starting discovery with brief responder";
  agent.StartFullDiscovery(
      ola::NewSingleCallback(this,
                             &DiscoveryAgentTest::DiscoveryFailed,
                             static_cast<const UIDSet*>(&uids)));
  OLA_ASSERT_TRUE(m_callback_run);
}
开发者ID:DouglasHeriot,项目名称:ola,代码行数:21,代码来源:DiscoveryAgentTest.cpp

示例11: DiscoverySuccessful

/**
 * Called when discovery completes
 */
void DiscoveryAgentTest::DiscoverySuccessful(const UIDSet *expected,
                                             bool successful,
                                             const UIDSet &received) {
  OLA_INFO << "in discovery callback, size is " << received.Size() <<
      ", state: " << successful;
  CPPUNIT_ASSERT(successful);
  CPPUNIT_ASSERT_EQUAL(*expected, received);
  m_callback_run = true;
}
开发者ID:Siliconsoul,项目名称:ola,代码行数:12,代码来源:DiscoveryAgentTest.cpp

示例12: normal_responder_uid

/**
 * Test a responder that replies with responses larger than the DUB size
 */
void DiscoveryAgentTest::testRamblingResponder() {
  const UID normal_responder_uid(0x7a70, 0x00002002);
  const UID rambling_responder_uid(0x7a77, 0x0002002);

  UIDSet uids;
  ResponderList responders;
  uids.AddUID(normal_responder_uid);
  PopulateResponderListFromUIDs(uids, &responders);
  // add the RamblingResponder
  responders.push_back(new RamblingResponder(rambling_responder_uid));
  MockDiscoveryTarget target(responders);

  DiscoveryAgent agent(&target);
  uids.AddUID(rambling_responder_uid);
  OLA_INFO << "starting discovery with rambling responder";
  agent.StartFullDiscovery(
      ola::NewSingleCallback(this,
                             &DiscoveryAgentTest::DiscoverySuccessful,
                             static_cast<const UIDSet*>(&uids)));
  OLA_ASSERT_TRUE(m_callback_run);
}
开发者ID:DouglasHeriot,项目名称:ola,代码行数:24,代码来源:DiscoveryAgentTest.cpp

示例13: OLA_ASSERT_EQ

/*
 * Test the UIDSet
 */
void UIDTest::testUIDSet() {
  UIDSet set1;
  OLA_ASSERT_EQ(0u, set1.Size());

  UID uid(1, 2);
  UID uid2(2, 10);
  set1.AddUID(uid);
  OLA_ASSERT_EQ(1u, set1.Size());
  OLA_ASSERT_EQ(string("0001:00000002"), set1.ToString());
  OLA_ASSERT_TRUE(set1.Contains(uid));
  OLA_ASSERT_FALSE(set1.Contains(uid2));
  set1.AddUID(uid);
  OLA_ASSERT_EQ(1u, set1.Size());

  set1.AddUID(uid2);
  OLA_ASSERT_EQ(2u, set1.Size());
  OLA_ASSERT_EQ(string("0001:00000002,0002:0000000a"), set1.ToString());
  OLA_ASSERT_TRUE(set1.Contains(uid));
  OLA_ASSERT_TRUE(set1.Contains(uid2));

  UIDSet set2(set1);
  OLA_ASSERT_EQ(set1, set2);
  UIDSet set3;
  OLA_ASSERT_EQ(0u, set3.Size());
  set3 = set2;
  OLA_ASSERT_EQ(set1, set2);

  set3.RemoveUID(uid2);
  OLA_ASSERT_EQ(1u, set3.Size());
  OLA_ASSERT_EQ(string("0001:00000002"), set3.ToString());

  UIDSet difference = set1.SetDifference(set3);
  OLA_ASSERT_EQ(1u, difference.Size());
  OLA_ASSERT_TRUE(set1.Contains(uid));
  OLA_ASSERT_TRUE(set1.Contains(uid2));

  difference = set3.SetDifference(set1);
  OLA_ASSERT_EQ(0u, difference.Size());
}
开发者ID:basileus,项目名称:ola,代码行数:42,代码来源:UIDTest.cpp

示例14: UIDList

/*
 * This is called when we receive uids for a universe
 * @param universes a vector of OlaUniverses
 */
void UIDList(const ola::rdm::UIDSet &uids,
             const string &error) {
  UIDSet vendorcast;
  if (error.empty()) {
    UIDSet::Iterator iter = uids.Begin();
    for (; iter != uids.End(); ++iter) {
      cout << *iter << endl;
      vendorcast.AddUID(UID::VendorcastAddress(*iter));
    }
    if (opts.vendorcast) {
      iter = vendorcast.Begin();
      for (; iter != vendorcast.End(); ++iter) {
        cout << *iter << endl;
      }
    }
    if (opts.broadcast) {
      cout << UID::AllDevices().ToString() << endl;
    }
  } else {
    cerr << error << endl;
  }
  ss->Terminate();
}
开发者ID:Jazeido,项目名称:ola,代码行数:27,代码来源:ola-rdm-discover.cpp

示例15:

GraphName::GraphName(
    std::string const& basename,
    UIDSet const& uidSet,
    ParamSet const& paramSet) {
    std::vector<int> uids, params;
    for (UIDSet::const_iterator it = uidSet.begin(), ie = uidSet.end();
         it != ie; ++it) {
        uids.push_back(static_cast<int>(*it));
    }
    std::sort(uids.begin(), uids.end());
    for (ParamSet::const_iterator it = paramSet.begin(), ie = paramSet.end();
         it != ie; ++it) {
        params.push_back(*it);
    }
    std::sort(params.begin(), params.end());

    std::stringstream ss;
    ss << basename << "__u_";
    for (std::vector<int>::iterator it = uids.begin(), ie = uids.end();
         it != ie; ++it) {
        ss << *it;
        if (it +1 != uids.end()) {
            ss << "_";
        }
    }
    ss << "__p_";
    for (std::vector<int>::iterator it = params.begin(), ie = params.end();
         it != ie; ++it) {
        ss << *it;
        if (it +1 != params.end()) {
            ss << "_";
        }
    }

    name = ss.str();
}
开发者ID:mdittmer,项目名称:unix-process-identity,代码行数:36,代码来源:GraphName.cpp


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