⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 #federation.cc#

📁 certi-SHM-3.0.tar 不错的开源的分布式方针软件 大家多多支持 他是linux
💻 CC#
📖 第 1 页 / 共 3 页
字号:
// ----------------------------------------------------------------------------//! unregisterSynchronization.voidFederation::unregisterSynchronization(FederateHandle federate_handle,                                      const char *label)    throw (FederateNotExecutionMember,           FederationNotPaused,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    this->check(federate_handle); // It may throw FederateNotExecutionMember.    if ((label == NULL) || (strlen(label) > MAX_USER_TAG_LENGTH))        throw RTIinternalError("Bad pause label(null or too long).");    // Set federate synchronized on this label.    Federate *federate = getByHandle(federate_handle);    federate->removeSynchronizationLabel(label);    // Test in every federate is synchronized. Otherwise, quit method.    list<Federate *>::iterator j ;    for (j = begin(); j != end(); j++) {        if ((*j)->isSynchronizationLabel(label) == true)            return ;    }    // All federates from federation has called synchronizationPointAchieved.    D.Out(pdTerm, "Federation %d is not Paused anymore.", handle);    // Remove label from federation list.    std::map<const char *, const char *>::iterator i ;    i = synchronizationLabels.begin();    for (; i != synchronizationLabels.end(); i++) {        if (!strcmp((*i).first, label)) {            delete (*i).first ;            delete (*i).second ;            synchronizationLabels.erase(i);            break ;        }    }    // send a federationSynchronized().    NetworkMessage msg ;    msg.type = m_FEDERATION_SYNCHRONIZED ;    msg.exception = e_NO_EXCEPTION ;    msg.federation = handle ;    msg.federate = federate_handle ;    msg.setLabel(label);    broadcastAnyMessage(&msg, 0);    D.Out(pdTerm, "Federation %d is synchronized on %s.", handle, label);}// ----------------------------------------------------------------------------// subscribeInteractionvoidFederation::subscribeInteraction(FederateHandle federate,                                 InteractionClassHandle interaction,                                 bool sub)    throw (InteractionClassNotDefined,           FederateNotExecutionMember,           SaveInProgress,           SecurityError,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->Interactions->subscribe(federate, interaction, sub);    D.Out(pdRegister,          "Federation %d: Federate %d(un)subscribes to Interaction %d.",          handle, federate, interaction);}// ----------------------------------------------------------------------------// subscribeObjectvoidFederation::subscribeObject(FederateHandle federate,                            ObjectClassHandle object,                            AttributeHandle *attributes,                            UShort list_size,                            bool sub)    throw (ObjectClassNotDefined,           AttributeNotDefined,           FederateNotExecutionMember,           SaveInProgress,           SecurityError,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->subscribe(federate, object, attributes, list_size, sub);    D.Out(pdRegister,          "Federation %d: Federate %d(un)sub. to %d attrib. of ObjClass %d.",          handle, federate, list_size, object);}// ----------------------------------------------------------------------------// updateAttributeValuesvoidFederation::updateAttributeValues(FederateHandle federate,                                  ObjectHandle id,                                  AttributeHandle *attributes,                                  AttributeValue *values,                                  UShort list_size,                                  FederationTime time,                                  const char *tag)    throw (FederateNotExecutionMember,           ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->updateAttributeValues(federate, id, attributes, values,                                               list_size, time, tag);    D.Out(pdRegister,          "Federation %d: Federate %d updated attributes of Object %d.",          handle, federate, id);}// ----------------------------------------------------------------------------//! Update the current time of a regulator federate.voidFederation::updateRegulator(FederateHandle federate_handle,                            FederationTime time)    throw (FederateNotExecutionMember,           RTIinternalError){    // It may throw FederateNotExecutionMember    Federate *federate = getByHandle(federate_handle);    if (federate->isRegulator() == false) {        D.Out(pdExcept, "Federate %d is not a regulator.", federate_handle);        throw RTIinternalError("Time regulation not enabled.");    }    D.Out(pdTerm, "Federation %d: Federate %d's new time is %f.",          handle, federate_handle, time);    regulators.update(federate_handle, time);    NetworkMessage msg ;    msg.type = m_MESSAGE_NULL ;    msg.exception = e_NO_EXCEPTION ;    msg.federation = handle ;    msg.federate = federate_handle ;    msg.date = time ;    broadcastAnyMessage(&msg, federate_handle);}// ----------------------------------------------------------------------------// isOwner (isAttributeOwnedByFederate)boolFederation::isOwner(FederateHandle federate,                    ObjectHandle id,                    AttributeHandle attribute)    throw (FederateNotExecutionMember,           ObjectNotKnown,           AttributeNotDefined,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    D.Out(pdDebug, "Owner of Object %u Atrribute %u", id, attribute);    // It may throw *NotDefined    return(root->ObjectClasses->isAttributeOwnedByFederate(id, attribute,                                                           federate));}// ----------------------------------------------------------------------------// queryAttributeOwnershipvoidFederation::queryAttributeOwnership(FederateHandle federate,                                    ObjectHandle id,                                    AttributeHandle attribute)    throw (FederateNotExecutionMember,           ObjectNotKnown,           AttributeNotDefined,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    D.Out(pdDebug, "Owner of Object %u Atrribute %u", id, attribute);    // It may throw *NotDefined    root->ObjectClasses->queryAttributeOwnership(id, attribute, federate);}// ----------------------------------------------------------------------------// negotiateDivestiture (negotiatedAttributeOwnershipDivestiture)voidFederation::negotiateDivestiture(FederateHandle federate,                                 ObjectHandle id,                                 AttributeHandle *attribs,                                 UShort list_size,                                 const char *tag)    throw (FederateNotExecutionMember,           ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           AttributeAlreadyBeingDivested,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->negotiatedAttributeOwnershipDivestiture(federate,                                                                 id,                                                                 attribs,                                                                 list_size,                                                                 tag);}// ----------------------------------------------------------------------------// acquireIfAvailable (attributeOwnershipAcquisitionIfAvailable)voidFederation::acquireIfAvailable(FederateHandle federate,                               ObjectHandle id,                               AttributeHandle *attribs,                               UShort list_size)    throw (ObjectNotKnown,           ObjectClassNotPublished,           AttributeNotDefined,           AttributeNotPublished,           FederateOwnsAttributes,           AttributeAlreadyBeingAcquired,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->attributeOwnershipAcquisitionIfAvailable(federate,                                                                  id,                                                                  attribs,                                                                  list_size);}// ----------------------------------------------------------------------------// divest (unconditionalAttributeOwnershipDivestiture)voidFederation::divest(FederateHandle federate,                   ObjectHandle id,                   AttributeHandle *attrs,                   UShort list_size)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->unconditionalAttributeOwnershipDivestiture(federate,                                                                    id,                                                                    attrs,                                                                    list_size);}// ----------------------------------------------------------------------------// attributeOwnershipAcquisitionvoidFederation::acquire(FederateHandle federate,                    ObjectHandle id,                    AttributeHandle *attributes,                    UShort list_size,                    const char *tag)    throw (ObjectNotKnown,           ObjectClassNotPublished,           AttributeNotDefined,           AttributeNotPublished,           FederateOwnsAttributes,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->attributeOwnershipAcquisition(federate,                                                       id,                                                       attributes,                                                       list_size,                                                       tag);    D.Out(pdDebug, "Acquisition on Object %u ", id);}// ----------------------------------------------------------------------------// cancelDivestiture (cancelNegotiatedAttributeOwnershipDivestiture)voidFederation::cancelDivestiture(FederateHandle federate,                              ObjectHandle id,                              AttributeHandle *attributes,                              UShort list_size)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           AttributeDivestitureWasNotRequested,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    // It may throw *NotDefined    root->ObjectClasses->        cancelNegotiatedAttributeOwnershipDivestiture(federate,                                                      id,                                                      attributes,                                                      list_size);    D.Out(pdDebug, "CancelDivestiture sur Objet %u ", id);}// ----------------------------------------------------------------------------// respondRelease (attributeOwnershipRealeaseResponse)AttributeHandleSet*Federation::respondRelease(FederateHandle federate,                           ObjectHandle id,                           AttributeHandle *attributes,                           UShort list_size)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           FederateWasNotAskedToReleaseAttribute,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    D.Out(pdDebug, "RespondRelease on Object %u.", id);    // It may throw *NotDefined    return(root->ObjectClasses->attributeOwnershipReleaseResponse(federate,                                                                  id,                                                                  attributes,                                                                  list_size));}// ----------------------------------------------------------------------------// cancelAttributeOwnershipAcquisitionvoidFederation::cancelAcquisition(FederateHandle federate,                              ObjectHandle id,                              AttributeHandle *attributes,                              UShort list_size)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeAlreadyOwned,           AttributeAcquisitionWasNotRequested,           FederateNotExecutionMember,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    // It may throw FederateNotExecutionMember.    this->check(federate);    D.Out(pdDebug, "CancelAcquisition sur Objet %u ", id);    // It may throw *NotDefined    root->ObjectClasses->cancelAttributeOwnershipAcquisition(federate,                                                             id,                                                             attributes,                                                             list_size);}}} // namespace certi/rtig// $Id: Federation.cc,v 3.12 2003/03/21 15:06:46 breholee Exp $

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -