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

📄 ownershipservices.cc

📁 分布式仿真 开放源码
💻 CC
字号:
// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2002, 2003  ONERA//// This file is part of CERTI-libRTI//// CERTI-libRTI is free software ; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public License// as published by the Free Software Foundation ; either version 2 of// the License, or (at your option) any later version.//// CERTI-libRTI is distributed in the hope that it will be useful, but// WITHOUT ANY WARRANTY ; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this program ; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307// USA//// $Id: OwnershipServices.cc,v 3.1 2003/07/04 12:00:58 breholee Exp $// ----------------------------------------------------------------------------#include <config.h>#include "RTIambassador.hh"#include "Message.hh"namespace certi {static pdCDebug D("LIBRTI", "(libRTI OwM) - ");// ===========================================================================// OWNERSHIP MANAGEMENT// ===========================================================================// ----------------------------------------------------------------------------// UnConditional Attribute Ownership DivestiturevoidRTIambassador::unconditionalAttributeOwnershipDivestiture(ObjectHandle theObject,                                           const AttributeHandleSet &attrs)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::UNCONDITIONAL_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;    req.setObject(theObject);    req.setAHS(attrs);    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 ;    req.type = Message::NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;    req.setObject(theObject);    req.setTag(theTag);    req.setAHS(attrs);    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 ;    req.type = Message::ATTRIBUTE_OWNERSHIP_ACQUISITION ;    req.setObject(theObject);    req.setTag(theTag);    req.setAHS(desiredAttributes);    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 ;    req.type = Message::ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE ;    req.setObject(theObject);    req.setAHS(attrs);    executeService(&req, &rep);    if (rep.getExceptionType() == e_NO_EXCEPTION) {        return rep.getAHS();    }    return NULL ;}// ----------------------------------------------------------------------------// Cancel Negotiated Attribute Ownership DivestiturevoidRTIambassador::cancelNegotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,                                              const AttributeHandleSet& attrs)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotOwned,           AttributeDivestitureWasNotRequested,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::CANCEL_NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE ;    req.setObject(theObject);    req.setAHS(attrs);    executeService(&req, &rep);}// ----------------------------------------------------------------------------// Cancel Attribute Ownership AcquisitionvoidRTIambassador::cancelAttributeOwnershipAcquisition(ObjectHandle theObject,                                    const AttributeHandleSet& attrs)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeAlreadyOwned,           AttributeAcquisitionWasNotRequested,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION ;    req.setObject(theObject);    req.setAHS(attrs);    executeService(&req, &rep);}// ----------------------------------------------------------------------------// Attribute Ownership Acquisition If AvailablevoidRTIambassador::attributeOwnershipAcquisitionIfAvailable(ObjectHandle theObject,                                         const AttributeHandleSet& desired)    throw (ObjectNotKnown,           ObjectClassNotPublished,           AttributeNotDefined,           AttributeNotPublished,           FederateOwnsAttributes,           AttributeAlreadyBeingAcquired,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::ATTRIBUTE_OWNERSHIP_ACQUISITION_IF_AVAILABLE ;    req.setObject(theObject);    req.setAHS(desired);    executeService(&req, &rep);}// ----------------------------------------------------------------------------// Query Attribute OwnershipvoidRTIambassador::queryAttributeOwnership(ObjectHandle theObject,                        AttributeHandle theAttribute)    throw (ObjectNotKnown,           AttributeNotDefined,           AttributeNotKnown,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::QUERY_ATTRIBUTE_OWNERSHIP ;    req.setObject(theObject);    req.setAttribute(theAttribute);    executeService(&req, &rep);}// ----------------------------------------------------------------------------// 5.16 Is Attribute Owned By FederateBooleanRTIambassador::isAttributeOwnedByFederate(ObjectHandle theObject,                                          AttributeHandle theAttribute)    throw (ObjectNotKnown,           AttributeNotDefined,           FederateNotExecutionMember,           ConcurrentAccessAttempted,           SaveInProgress,           RestoreInProgress,           RTIinternalError){    Message req, rep ;    req.type = Message::IS_ATTRIBUTE_OWNED_BY_FEDERATE ;    req.setObject(theObject);    req.setAttribute(theAttribute);    executeService(&req, &rep);    return ((strcmp(rep.getTag(), "RTI_TRUE") == 0) ? RTI_TRUE : RTI_FALSE);}}// $Id: OwnershipServices.cc,v 3.1 2003/07/04 12:00:58 breholee Exp $

⌨️ 快捷键说明

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