📄 rtiambassador.cc
字号:
// codage getObjectToStringLength(tmp->_value.value, tmp->_value.length, longueur); char *valeur = new char[longueur] ; objectToString(tmp->_value.value, tmp->_value.length, valeur); req.setValue(i, valeur); } executeService(&req, &rep); delete theAttributes_aux ; return rep.eventRetraction ;}// ----------------------------------------------------------------------------voidRTIambassador::updateAttributeValues(ObjectHandle, const AttributeHandleValuePairSet&, const char *) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ----------------------------------------------------------------------------// Send InteractionEventRetractionHandleRTIambassador::sendInteraction(InteractionClassHandle theInteraction, const ParameterHandleValuePairSet& theParameters, const FedTime& theTime, const char *theTag) throw (InteractionClassNotDefined, InteractionClassNotPublished, InteractionParameterNotDefined, InvalidFederationTime, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError){ ULong longueur ; Message req, rep ; CParameterHandleValuePairSet *theParameters_aux ; theParameters_aux = new CParameterHandleValuePairSet(theParameters); CParameterHandleValuePair *tmp ; // envoyer la requete au RTI req.type = SEND_INTERACTION ; req.interactionClass = theInteraction ; req.date = (FederationTime) ((RTIfedTime&) theTime).getTime(); req.setTag(theTag); req.handleArraySize = theParameters_aux->_size ; for (int i = 0 ; i < theParameters_aux->_size ; i++) { tmp = theParameters_aux->getIeme(i); req.handleArray[i] = tmp->_param ; // codage getObjectToStringLength(tmp->_value.value, tmp->_value.length, longueur); char *valeur = new char[longueur] ; objectToString(tmp->_value.value, tmp->_value.length, valeur); req.setValue(i, valeur); } executeService(&req, &rep); delete theParameters_aux ; return rep.eventRetraction ;}// ----------------------------------------------------------------------------voidRTIambassador::sendInteraction(InteractionClassHandle, const ParameterHandleValuePairSet &, const char *) throw (InteractionClassNotDefined, InteractionClassNotPublished, InteractionParameterNotDefined, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ----------------------------------------------------------------------------// Delete ObjectEventRetractionHandleRTIambassador::deleteObjectInstance(ObjectHandle theObject, const FedTime& theTime, const char *theTag) throw (ObjectNotKnown, DeletePrivilegeNotHeld, InvalidFederationTime, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError){ Message req, rep ; // envoyer la requete au RTI req.type = DELETE_OBJECT ; req.object = (ObjectHandle) theObject ; req.date = (FederationTime) ((RTIfedTime&) theTime).getTime(); req.setTag(theTag); executeService(&req, &rep); return rep.eventRetraction ;}// ----------------------------------------------------------------------------voidRTIambassador::deleteObjectInstance(ObjectHandle /*theObject*/, const char */*theTag*/) throw (ObjectNotKnown, DeletePrivilegeNotHeld, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ----------------------------------------------------------------------------// Local Delete Object InstancevoidRTIambassador::localDeleteObjectInstance(ObjectHandle /*theObject*/) throw (ObjectNotKnown, FederateOwnsAttributes, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ----------------------------------------------------------------------------// Change Attribute Transportation TypevoidRTIambassador::changeAttributeTransportationType(ObjectHandle theObject, const AttributeHandleSet& theAttributes, TransportationHandle theType) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, InvalidTransportType, //CERTI InvalidTransportationHandle, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError){ Message req, rep ; CAttributeHandleValuePairSet *theAttributes_aux ; theAttributes_aux = new CAttributeHandleValuePairSet(theAttributes); CAttributeHandleValuePair *tmp ; TransportType theType_aux ; theType_aux = ((theType == 1) ? RELIABLE : BEST_EFFORT); // Envoyer la requete au RTI req.type = CHANGE_ATTRIBUTE_TRANSPORT_TYPE ; req.object = (ObjectHandle) theObject ; req.transport = theType_aux ; req.handleArraySize = theAttributes_aux->_size ; for (int i = 0 ; i < theAttributes_aux->_size ; i++) { tmp = theAttributes_aux->getIeme(i); req.handleArray[i] = tmp->_attrib ; } executeService(&req, &rep);}// ----------------------------------------------------------------------------// Change Interaction Transportation TypevoidRTIambassador::changeInteractionTransportationType(InteractionClassHandle theClass, TransportationHandle theType) throw (InteractionClassNotDefined, InteractionClassNotPublished, InvalidTransportType, //CERTI InvalidTransportationHandle, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError){ Message req, rep ; TransportType theType_aux ; theType_aux = ((theType == 1) ? RELIABLE : BEST_EFFORT); // envoyer la requete au RTI req.type = CHANGE_INTERACTION_TRANSPORT_TYPE ; req.interactionClass = theClass ; req.transport = theType_aux ; executeService(&req, &rep);}// ----------------------------------------------------------------------------// Request Attribute Value UpdatevoidRTIambassador::requestObjectAttributeValueUpdate(ObjectHandle /*theObject*/, const AttributeHandleSet&) throw (ObjectNotKnown, // not implemented AttributeNotDefined, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ----------------------------------------------------------------------------voidRTIambassador::requestClassAttributeValueUpdate(ObjectClassHandle /*theClass*/, const AttributeHandleSet&) throw (ObjectClassNotDefined, AttributeNotDefined, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, //not implemented RestoreInProgress, //not implemented RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService();}// ===========================================================================// OWNERSHIP MANAGEMENT// ===========================================================================// ----------------------------------------------------------------------------// UnConditional Attribute Ownership DivestiturevoidRTIambassador::unconditionalAttributeOwnershipDivestiture(ObjectHandle theObject, const AttributeHandleSet &attrs) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; // Envoyer la requete au RTI req.type = UNCONDITIONAL_ATTRIBUTE_OWNERSHIP_DIVESTITURE ; req.object = (ObjectHandle) theObject ; req.handleArraySize = attrs.size(); for (int i = 0 ; i < attrs.size(); i++) { req.handleArray[i] = attrs.getHandle(i); } executeService(&req, &rep);}// ----------------------------------------------------------------------------// Negotiated Attribute Ownership DivestiturevoidRTIambassador::negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject, const AttributeHandleSet& attrs, const char *theTag) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, AttributeAlreadyBeingDivested, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; // Envoyer la requete au RTI req.type = NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE ; req.object = (ObjectHandle) theObject ; req.setTag(theTag); req.handleArraySize = attrs.size(); for (int i = 0 ; i < attrs.size(); i++) { req.handleArray[i] = attrs.getHandle(i); } executeService(&req, &rep);}// ----------------------------------------------------------------------------// Attribute Ownership AcquisitionvoidRTIambassador::attributeOwnershipAcquisition(ObjectHandle theObject, const AttributeHandleSet& desiredAttributes, const char *theTag) throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined, AttributeNotPublished, FederateOwnsAttributes, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; // Envoyer la requete au RTI req.type = ATTRIBUTE_OWNERSHIP_ACQUISITION ; req.object = (ObjectHandle) theObject ; req.setTag(theTag); req.handleArraySize = desiredAttributes.size(); for (int i = 0 ; i < desiredAttributes.size(); i++) { req.handleArray[i] = desiredAttributes.getHandle(i); } executeService(&req, &rep);}// ----------------------------------------------------------------------------// Attribute Ownership Release ResponseAttributeHandleSet*RTIambassador::attributeOwnershipReleaseResponse(ObjectHandle theObject, const AttributeHandleSet& attrs) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, FederateWasNotAskedToReleaseAttribute, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; // Envoyer la requete au RTI req.type = ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE ; req.object = (ObjectHandle) theObject ; req.handleArraySize = attrs.size(); for (int i = 0 ; i < attrs.size(); i++) { req.handleArray[i] = attrs.getHandle(i); } executeService(&req, &rep); if (rep.exception == e_NO_EXCEPTION) { AttributeHandleSet *AttributeSet ; AttributeSet = AttributeHandleSetFactory::create(rep.handleArraySize); for (int i = 0 ; i < rep.handleArraySize ; i++) { AttributeSet->add(rep.handleArray[i]); } return AttributeSet ; } return NULL ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -