objectclassset.cc

来自「certi-SHM-3.0.tar 不错的开源的分布式方针软件 大家多多支持 他」· CC 代码 · 共 752 行 · 第 1/2 页

CC
752
字号
    // Broadcast DiscoverObject message recursively    if (ocbList != 0) {        currentClass = theClass->Father ;        while (currentClass != 0) {            D.Out(pdRegister,                  "Broadcasting Discover msg to parent class "                  "%d for instance %d.",                  currentClass, theObjectHandle);            // It may throw ObjectClassNotDefined            theClass = getWithHandle(currentClass);            theClass->broadcastClassMessage(ocbList);            currentClass = theClass->Father ;        }        delete ocbList ;    }    D.Out(pdRegister, "Instance %d has been registered.", theObjectHandle);}// ----------------------------------------------------------------------------//! subscribe.voidObjectClassSet::subscribe(FederateHandle theFederateHandle,                          ObjectClassHandle theClassHandle,                          AttributeHandle *theAttributeList,                          UShort theListSize,                          bool SubOrUnsub)    throw (ObjectClassNotDefined,           AttributeNotDefined,           RTIinternalError,           SecurityError){    // It may throw ObjectClassNotDefined    ObjectClass *theClass = getWithHandle(theClassHandle);    if (SubOrUnsub == RTI_TRUE)        D.Out(pdInit, "Federate %d attempts to subscribe to Object Class %d.",              theFederateHandle, theClassHandle);    else        D.Out(pdTerm, "Federate %d attempts to unsubscribe from Object "              "Class %d.", theFederateHandle, theClassHandle);    // It may throw AttributeNotDefined    Boolean result = theClass->subscribe(theFederateHandle,                                         theAttributeList,                                         theListSize,                                         SubOrUnsub);    // If Result is true, the Federate has never been a subscriber of this    // class, so it my have missed some DiscoverObject messages, for this    // class or one of its sub-class. Therefore, we must start a recursive    // process to check this class and its subclass for possible instances    // to discover, until we have reached an already subscribed class in    // each branch.    if (result == RTI_TRUE)        recursiveDiscovering(theClass->getHandle(), // Start process with this class                             theFederateHandle, // Send msgs to this Federate                             theClass->getHandle());    // Discovered objects belong to the same class, the original one.}// ----------------------------------------------------------------------------//! updateAttributeValues.voidObjectClassSet::updateAttributeValues(FederateHandle theFederateHandle,                                      ObjectHandle theObjectHandle,                                      AttributeHandle *theAttribArray,                                      AttributeValue *theValueArray,                                      UShort theArraySize,                                      FederationTime theTime,                                      const char *theUserTag)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           RTIinternalError,           InvalidObjectHandle){    // It may throw ObjectNotKnown    ObjectClass * objectClass = getInstanceClass(theObjectHandle);    ObjectClassHandle currentClass = objectClass->getHandle();    D.Out(pdProtocol, "Federate %d Updating object %d from class %d.",          theFederateHandle, theObjectHandle, currentClass);    // It may throw a bunch of exceptions    ObjectClassBroadcastList *ocbList = NULL ;    ocbList = objectClass->updateAttributeValues(theFederateHandle,                                                 theObjectHandle,                                                 theAttribArray,                                                 theValueArray,                                                 theArraySize,                                                 theTime,                                                 theUserTag);    // Broadcast ReflectAttributeValues message recursively    currentClass = objectClass->Father ;    while (currentClass != 0) {        D.Out(pdProtocol,              "Broadcasting RAV msg to parent class %d for instance %d.",              currentClass, theObjectHandle);        // It may throw ObjectClassNotDefined        objectClass = getWithHandle(currentClass);        objectClass->broadcastClassMessage(ocbList);        currentClass = objectClass->Father ;    }    delete ocbList ;}// ----------------------------------------------------------------------------//! isAttributeOwnedByFederate.BooleanObjectClassSet::isAttributeOwnedByFederate(ObjectHandle theObject,                                           AttributeHandle theAttribute,                                           FederateHandle theFederateHandle)    throw (ObjectNotKnown,           AttributeNotDefined,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass * objectClass = getInstanceClass(theObject);    // It may throw a bunch of exceptions.    return objectClass->isAttributeOwnedByFederate(theObject,                                                   theAttribute,                                                   theFederateHandle);}// ----------------------------------------------------------------------------//! queryAttributeOwnership.voidObjectClassSet::queryAttributeOwnership(ObjectHandle theObject,                                        AttributeHandle theAttribute,                                        FederateHandle theFederateHandle)    throw (ObjectNotKnown,           AttributeNotDefined,           RTIinternalError){    D.Out(pdDebug, "queryAttributeOwnership sur l'attribut %u de l'objet %u",          theAttribute, theObject);    // It may throw ObjectNotKnown    ObjectClass * objectClass = getInstanceClass(theObject);    // It may throw a bunch of exceptions.    objectClass->queryAttributeOwnership(theObject,                                         theAttribute,                                         theFederateHandle);}// ----------------------------------------------------------------------------//! negotiatedAttributeOwnershipDivestiture.voidObjectClassSet::negotiatedAttributeOwnershipDivestiture(FederateHandle theFederateHandle,                                        ObjectHandle theObjectHandle,                                        AttributeHandle *theAttributeList,                                        UShort theListSize,                                        const char *theTag)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           AttributeAlreadyBeingDivested,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass *objectClass = getInstanceClass(theObjectHandle);    ObjectClassHandle currentClass = objectClass->getHandle();    // It may throw a bunch of exceptions.    ObjectClassBroadcastList *ocbList = NULL ;    ocbList =        objectClass->negotiatedAttributeOwnershipDivestiture(theFederateHandle,                                                             theObjectHandle,                                                             theAttributeList,                                                             theListSize,                                                             theTag);    // Broadcast ReflectAttributeValues message recursively    currentClass = objectClass->Father ;    while (currentClass != 0) {        D.Out(pdProtocol,              "Broadcasting NAOD msg to parent class %d for instance %d.",              currentClass, theObjectHandle);        // It may throw ObjectClassNotDefined        objectClass = getWithHandle(currentClass);        objectClass->broadcastClassMessage(ocbList);        currentClass = objectClass->Father ;    }    delete ocbList ;}// ----------------------------------------------------------------------------//! attributeOwnershipAcquisitionIfAvailable.voidObjectClassSet::attributeOwnershipAcquisitionIfAvailable(FederateHandle theFederateHandle,                                         ObjectHandle theObjectHandle,                                         AttributeHandle *theAttributeList,                                         UShort theListSize)    throw (ObjectNotKnown,           ObjectClassNotPublished,           AttributeNotDefined,           AttributeNotPublished,           FederateOwnsAttributes,           AttributeAlreadyBeingAcquired,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass * objectClass = getInstanceClass(theObjectHandle);    // It may throw a bunch of exceptions.    objectClass->attributeOwnershipAcquisitionIfAvailable(theFederateHandle,                                                          theObjectHandle,                                                          theAttributeList,                                                          theListSize);}// ----------------------------------------------------------------------------//! unconditionalAttributeOwnershipDivestiturevoidObjectClassSet::unconditionalAttributeOwnershipDivestiture(FederateHandle theFederateHandle,                                           ObjectHandle theObjectHandle,                                           AttributeHandle *theAttributeList,                                           UShort theListSize)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass *objectClass = getInstanceClass(theObjectHandle);    ObjectClassHandle currentClass = objectClass->getHandle();    // It may throw a bunch of exceptions.    ObjectClassBroadcastList *ocbList = NULL ;    ocbList = objectClass->        unconditionalAttributeOwnershipDivestiture(theFederateHandle,                                                   theObjectHandle,                                                   theAttributeList,                                                   theListSize);    // Broadcast ReflectAttributeValues message recursively    currentClass = objectClass->Father ;    while (currentClass != 0) {        D.Out(pdProtocol,              "Broadcasting UAOD msg to parent class %d for instance %d.",              currentClass, theObjectHandle);        // It may throw ObjectClassNotDefined        objectClass = getWithHandle(currentClass);        objectClass->broadcastClassMessage(ocbList);        currentClass = objectClass->Father ;    }    delete ocbList ;}// ----------------------------------------------------------------------------//! attributeOwnershipAcquisition.voidObjectClassSet::attributeOwnershipAcquisition(FederateHandle theFederateHandle,                              ObjectHandle theObjectHandle,                              AttributeHandle *theAttributeList,                              UShort theListSize,                              const char *theTag)    throw (ObjectNotKnown,           ObjectClassNotPublished,           AttributeNotDefined,           AttributeNotPublished,           FederateOwnsAttributes,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass * objectClass = getInstanceClass(theObjectHandle);    // It may throw a bunch of exceptions.    objectClass->attributeOwnershipAcquisition(theFederateHandle,                                               theObjectHandle,                                               theAttributeList,                                               theListSize,                                               theTag);}// ----------------------------------------------------------------------------//! cancelNegotiatedAttributeOwnershipDivestiture.voidObjectClassSet::cancelNegotiatedAttributeOwnershipDivestiture(FederateHandle theFederateHandle,                                              ObjectHandle theObjectHandle,                                              AttributeHandle *theAttributeList,                                              UShort theListSize)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           AttributeDivestitureWasNotRequested,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass *objectClass = getInstanceClass(theObjectHandle);    // It may throw a bunch of exceptions.    objectClass->        cancelNegotiatedAttributeOwnershipDivestiture(theFederateHandle,                                                      theObjectHandle,                                                      theAttributeList,                                                      theListSize);}// ----------------------------------------------------------------------------//! attributeOwnershipReleaseResponse.AttributeHandleSet * ObjectClassSet::attributeOwnershipReleaseResponse(FederateHandle theFederateHandle,                                  ObjectHandle theObjectHandle,                                  AttributeHandle *theAttributeList,                                  UShort theListSize)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           FederateWasNotAskedToReleaseAttribute,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass *objectClass = getInstanceClass(theObjectHandle);    // It may throw a bunch of exceptions.    return(objectClass->attributeOwnershipReleaseResponse(theFederateHandle,                                                          theObjectHandle,                                                          theAttributeList,                                                          theListSize));}// ----------------------------------------------------------------------------//! cancelAttributeOwnershipAcquisition.void ObjectClassSet::cancelAttributeOwnershipAcquisition(FederateHandle theFederateHandle,                                    ObjectHandle theObjectHandle,                                    AttributeHandle *theAttributeList,                                    UShort theListSize)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeAlreadyOwned,           AttributeAcquisitionWasNotRequested,           RTIinternalError){    // It may throw ObjectNotKnown    ObjectClass *objectClass = getInstanceClass(theObjectHandle);    // It may throw a bunch of exceptions.    objectClass->cancelAttributeOwnershipAcquisition(theFederateHandle,                                                     theObjectHandle,                                                     theAttributeList,                                                     theListSize);}} // namespace certi// $Id: ObjectClassSet.cc,v 3.11 2003/03/04 09:47:04 breholee Exp $

⌨️ 快捷键说明

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