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

📄 objectclassset.cc

📁 分布式仿真 开放源码
💻 CC
📖 第 1 页 / 共 2 页
字号:
    result = theClass->sendDiscoverMessages(theFederate, theOriginalClass);    if (result == RTI_TRUE) {        list<ObjectClassHandle>::const_iterator i = theClass->sonSet.begin();        for (; i != theClass->sonSet.end(); i++) {            recursiveDiscovering((*i), theFederate, theOriginalClass);        }    }}// ----------------------------------------------------------------------------//! registerInstance.voidObjectClassSet::registerObjectInstance(FederateHandle the_federate,                                       Object *the_object,                                       ObjectClassHandle the_class)    throw (InvalidObjectHandle,           ObjectClassNotDefined,           ObjectClassNotPublished,           ObjectAlreadyRegistered,           RTIinternalError){    ObjectClassHandle currentClass = the_class ;    // It may throw ObjectClassNotDefined    ObjectClass *theClass = getWithHandle(the_class);    // It may throw a bunch of exceptions.    ObjectClassBroadcastList *ocbList = NULL ;    ocbList = theClass->registerObjectInstance(the_federate, the_object,                                               the_class);    // 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, the_object);            // It may throw ObjectClassNotDefined            theClass = getWithHandle(currentClass);            theClass->broadcastClassMessage(ocbList);            currentClass = theClass->Father ;        }        delete ocbList ;    }    D[pdRegister] << "Instance " << the_object << " has been registered."                  << endl ;}// ----------------------------------------------------------------------------//! 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 ;}// ----------------------------------------------------------------------------//! 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);}// ----------------------------------------------------------------------------//! 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.14 2003/05/23 13:21:48 breholee Exp $

⌨️ 快捷键说明

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