本文整理汇总了C++中Universe::UniverseId方法的典型用法代码示例。如果您正苦于以下问题:C++ Universe::UniverseId方法的具体用法?C++ Universe::UniverseId怎么用?C++ Universe::UniverseId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Universe
的用法示例。
在下文中一共展示了Universe::UniverseId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleNodeList
void ArtNetDevice::HandleNodeList(Request *request,
string *response,
RpcController *controller) {
if (!request->has_node_list()) {
controller->SetFailed("Missing NodeListRequest");
return;
}
unsigned int universe_id = request->node_list().universe();
vector<IPV4Address> node_addresses;
vector<OutputPort*> output_ports;
OutputPorts(&output_ports);
vector<OutputPort*>::const_iterator port_iter = output_ports.begin();
for (; port_iter != output_ports.end(); port_iter++) {
Universe *universe = (*port_iter)->GetUniverse();
if (universe && universe->UniverseId() == universe_id) {
m_node->GetSubscribedNodes((*port_iter)->PortId(), &node_addresses);
break;
}
}
ola::plugin::artnet::Reply reply;
reply.set_type(ola::plugin::artnet::Reply::ARTNET_NODE_LIST_REPLY);
ola::plugin::artnet::NodeListReply *node_list_reply =
reply.mutable_node_list();
vector<IPV4Address>::const_iterator iter = node_addresses.begin();
for (; iter != node_addresses.end(); ++iter) {
OutputNode *node = node_list_reply->add_node();
node->set_ip_address(iter->AsInt());
}
reply.SerializeToString(response);
}
示例2: GenericPatchPort
bool PortManager::GenericPatchPort(PortClass *port,
unsigned int new_universe_id) {
if (!port)
return false;
Universe *universe = port->GetUniverse();
if (universe && universe->UniverseId() == new_universe_id)
return true;
AbstractDevice *device = port->GetDevice();
if (device) {
if (!device->AllowLooping()) {
// check ports of the opposite type
if (CheckLooping<PortClass>(device, new_universe_id))
return false;
}
if (!device->AllowMultiPortPatching()) {
if (CheckMultiPort<PortClass>(device, new_universe_id))
return false;
}
}
// unpatch if required
if (universe) {
OLA_DEBUG << "Port " << port->UniqueId() << " is bound to universe " <<
universe->UniverseId();
m_broker->RemovePort(port);
universe->RemovePort(port);
}
universe = m_universe_store->GetUniverseOrCreate(new_universe_id);
if (!universe)
return false;
if (port->SetUniverse(universe)) {
OLA_INFO << "Patched " << port->UniqueId() << " to universe " <<
universe->UniverseId();
m_broker->AddPort(port);
universe->AddPort(port);
} else {
if (!universe->IsActive())
m_universe_store->AddUniverseGarbageCollection(universe);
}
return true;
}
示例3: GetUniverse
/*
* Write data to this port.
*/
bool E131OutputPort::WriteDMX(const DmxBuffer &buffer, uint8_t priority) {
Universe *universe = GetUniverse();
if (!universe)
return false;
m_last_priority = (GetPriorityMode() == PRIORITY_MODE_STATIC) ?
GetPriority() : priority;
return m_node->SendDMX(universe->UniverseId(), buffer, m_last_priority,
m_preview_on);
}
示例4: GenericUnPatchPort
bool PortManager::GenericUnPatchPort(PortClass *port) {
if (!port)
return false;
Universe *universe = port->GetUniverse();
m_broker->RemovePort(port);
if (universe) {
universe->RemovePort(port);
port->SetUniverse(NULL);
OLA_INFO << "Unpatched " << port->UniqueId() << " from uni "
<< universe->UniverseId();
}
return true;
}
示例5: 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());
}
示例6: GetUIDs
/*
* Fetch the UID list for a universe
*/
void OlaServerServiceImpl::GetUIDs(
RpcController* controller,
const ola::proto::UniverseRequest* request,
ola::proto::UIDListReply* response,
ola::rpc::RpcService::CompletionCallback* done) {
ClosureRunner runner(done);
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return MissingUniverseError(controller);
response->set_universe(universe->UniverseId());
UIDSet uid_set;
universe->GetUIDs(&uid_set);
UIDSet::Iterator iter = uid_set.Begin();
for (; iter != uid_set.End(); ++iter) {
ola::proto::UID *uid = response->add_uid();
SetProtoUID(*iter, uid);
}
}
示例7: GetUIDs
/*
* Fetch the UID list for a universe
*/
void OlaServerServiceImpl::GetUIDs(RpcController* controller,
const ola::proto::UniverseRequest* request,
ola::proto::UIDListReply* response,
google::protobuf::Closure* done) {
ClosureRunner runner(done);
Universe *universe = m_universe_store->GetUniverse(request->universe());
if (!universe)
return MissingUniverseError(controller);
response->set_universe(universe->UniverseId());
UIDSet uid_set;
universe->GetUIDs(&uid_set);
UIDSet::Iterator iter = uid_set.Begin();
for (; iter != uid_set.End(); ++iter) {
ola::proto::UID *uid = response->add_uid();
uid->set_esta_id(iter->ManufacturerId());
uid->set_device_id(iter->DeviceId());
}
}
示例8: 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());
}
}
}