本文整理汇总了C++中NetIO::getObjectClassHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ NetIO::getObjectClassHandle方法的具体用法?C++ NetIO::getObjectClassHandle怎么用?C++ NetIO::getObjectClassHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetIO
的用法示例。
在下文中一共展示了NetIO::getObjectClassHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entityStateManager
//------------------------------------------------------------------------------
// entityStateManager() -- (Output support)
// -- Update the entity object for this NIB(Player)
//------------------------------------------------------------------------------
bool Nib::entityStateManager(const double curExecTime)
{
bool ok = true;
if (getPlayer()->isMode(simulation::Player::ACTIVE) && isPlayerStateUpdateRequired(curExecTime)) {
// Need to update this entity object ...
NetIO* netIO = static_cast<NetIO*>(getNetIO());
RTI::RTIambassador* rtiAmb = netIO->getRTIambassador();
// ---
// First, make sure this entity has been registered
// ---
if (!isRegistered()) {
try {
RTI::ObjectClassHandle theClassHandle = netIO->getObjectClassHandle( getClassIndex() );
makeObjectName();
setObjectHandle( rtiAmb->registerObjectInstance( theClassHandle, getObjectName() ) );
netIO->addNibToObjectTables(this, simulation::NetIO::OUTPUT_NIB);
std::cout << "rprfom::Nib::updateEntity(): Register entity: " << getObjectName() << " handle = " << getObjectHandle() << std::endl;
}
catch (RTI::Exception& e) {
std::cerr << &e << std::endl;
ok = false;
}
}
// ---
// Next, update the entity's attribute values ...
// ---
if ( ok && isRegistered()) {
try {
// Create the attribute-value pair set
RTI::AttributeHandleValuePairSet* attrs = nullptr;
attrs = RTI::AttributeSetFactory::create( NetIO::NUM_OBJECT_ATTRIBUTES );
// Load the set with updated attribute values
updateBasicEntity(attrs,curExecTime);
updatePhysicalEntity(attrs,curExecTime);
updatePlatform(attrs,curExecTime);
// Send attributes to the RTI
//std::cout << "RprFom::Nib::updateEntity(): Update entity: " << getObjectName() << " handle = " << getObjectHandle() << std::endl;
ok = netIO->updateAttributeValues(getObjectHandle(), attrs);
delete attrs;
}
catch (RTI::Exception& e) {
std::cerr << &e << std::endl;
ok = false;
}
}
} // end -- if active player needs an update
return ok;
}