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

📄 objectattribute.cc

📁 分布式仿真 开放源码
💻 CC
字号:
// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2002, 2003  ONERA//// This file is part of CERTI-libCERTI//// CERTI-libCERTI 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-libCERTI 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: ObjectAttribute.cc,v 3.12 2003/07/09 16:04:46 breholee Exp $// ----------------------------------------------------------------------------#include <config.h>#include "ObjectAttribute.hh"#include "RegionImp.hh"#include "PrettyDebug.hh"#include <iostream>using std::cout ;using std::endl ;using std::list ;namespace certi {static pdCDebug D("OBJECTATTRIBUTE", "(Obj_Attr) - ");// ----------------------------------------------------------------------------//! Constructor that sets handle and attribute owner.ObjectAttribute::ObjectAttribute(AttributeHandle new_handle,                                 FederateHandle new_owner,                                 ObjectClassAttribute *associated_attribute)    : handle(new_handle), owner(new_owner), divesting(RTI_FALSE), space(0),      source(associated_attribute), region(0){}// ----------------------------------------------------------------------------//! Destructor (nothing to do).ObjectAttribute::~ObjectAttribute(){}// ----------------------------------------------------------------------------//! Displays the object attribute information.voidObjectAttribute::display() const{    if (handle != 0)        cout << "Attribute " << handle << " ; Owner " << owner << endl ;}// ----------------------------------------------------------------------------//! Returns the ownerFederateHandleObjectAttribute::getOwner() const{    return owner ;}// ----------------------------------------------------------------------------//! Change the federate owner.voidObjectAttribute::setOwner(FederateHandle newOwner){    owner = newOwner ;}// ----------------------------------------------------------------------------//! Returns attribute divesting state.BooleanObjectAttribute::beingDivested() const{    return divesting ;}// ----------------------------------------------------------------------------//! Put object attribute in divesting state.voidObjectAttribute::setDivesting(Boolean divestingState){    divesting = divestingState ;}// ----------------------------------------------------------------------------//! Return the candidate position in list, null otherwise.intObjectAttribute::isCandidate(FederateHandle candidate) const{    list<FederateHandle>::const_iterator i = ownerCandidates.begin();    for (int j = 1 ; i != ownerCandidates.end(); i++, j++) {        if ((*i) == candidate)            return j ;    }    return 0 ;}// ----------------------------------------------------------------------------//! Add a new candidate to list.voidObjectAttribute::addCandidate(FederateHandle candidate){    ownerCandidates.push_front(candidate);}// ----------------------------------------------------------------------------// Removes a candidate from list.voidObjectAttribute::removeCandidate(FederateHandle candidate){    ownerCandidates.remove(candidate);}// ----------------------------------------------------------------------------// Returns the federate candidate at position in list.FederateHandleObjectAttribute::getCandidate(unsigned int indice) const    throw (RTIinternalError){    if ((indice <= 0) || (indice > ownerCandidates.size()))        throw RTIinternalError();    list<FederateHandle>::const_iterator i = ownerCandidates.begin();    for (unsigned int j = 1 ; i != ownerCandidates.end(); i++, j++) {        if (j == indice)            return (*i);    }    throw RTIinternalError();}// ----------------------------------------------------------------------------boolObjectAttribute::hasCandidates() const{    return (!ownerCandidates.empty());}// ----------------------------------------------------------------------------AttributeHandleObjectAttribute::getHandle() const{    return handle ;}// ----------------------------------------------------------------------------voidObjectAttribute::setHandle(AttributeHandle h){    handle = h ;}// ----------------------------------------------------------------------------SpaceHandleObjectAttribute::getSpace() const{    return space ;}// ----------------------------------------------------------------------------voidObjectAttribute::setSpace(SpaceHandle h){    space = h ;}// ----------------------------------------------------------------------------voidObjectAttribute::associate(RegionImp *r){    region = r ;}// ----------------------------------------------------------------------------voidObjectAttribute::unassociate(RegionImp *r){    region = region == r ? 0 : region ;}} //namespace certi// $Id: ObjectAttribute.cc,v 3.12 2003/07/09 16:04:46 breholee Exp $

⌨️ 快捷键说明

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