📄 objectattribute.cc
字号:
// -*- mode:C++ ; tab-width:4 ; c-basic-offset:4 ; indent-tabs-mode:nil -*-// ----------------------------------------------------------------------------// 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.6 2003/02/21 17:36:39 breholee Exp $// ----------------------------------------------------------------------------#include "ObjectAttribute.hh"namespace certi {static pdCDebug D("OBJECTATTRIBUTE", "(Obj_Attr) - ");// ----------------------------------------------------------------------------//! Default constructor (all atttributes to default state).ObjectAttribute::ObjectAttribute(void) : handle(0), owner(0), divesting(RTI_FALSE){}// ----------------------------------------------------------------------------//! Constructor that sets handle and attribute owner.ObjectAttribute::ObjectAttribute(AttributeHandle newHandle, FederateHandle newOwner) : handle(newHandle), owner(newOwner), divesting(RTI_FALSE){}// ----------------------------------------------------------------------------//! Destructor (nothing to do).ObjectAttribute::~ObjectAttribute(void){}// ----------------------------------------------------------------------------//! Displays the object attribute information.voidObjectAttribute::display(void) const{ if (handle != 0) cout << "Attribute " << handle << " ; Owner " << owner << endl ;}// ----------------------------------------------------------------------------//! Returns the ownerFederateHandleObjectAttribute::getOwner(void) const{ return owner ;}// ----------------------------------------------------------------------------//! Change the federate owner.voidObjectAttribute::setOwner(FederateHandle newOwner){ owner = newOwner ;}// ----------------------------------------------------------------------------//! Returns attribute divesting state.BooleanObjectAttribute::beingDivested(void) 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(int indice) const throw (RTIinternalError){ if ((indice <= 0) || (indice > ownerCandidates.size())) throw RTIinternalError(); list<FederateHandle>::const_iterator i = ownerCandidates.begin(); for (int j = 1 ; i != ownerCandidates.end(); i++, j++) { if (j == indice) return (*i); }}// ----------------------------------------------------------------------------boolObjectAttribute::hasCandidates(void) const{ return (!ownerCandidates.empty());}// ----------------------------------------------------------------------------AttributeHandleObjectAttribute::getHandle(void) const{ return handle ;}// ----------------------------------------------------------------------------voidObjectAttribute::setHandle(AttributeHandle h){ handle = h ;}} //namespace certi// $Id: ObjectAttribute.cc,v 3.6 2003/02/21 17:36:39 breholee Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -