📄 routingspace.cc
字号:
// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2003, 2004 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: RoutingSpace.cc,v 3.6 2004/01/09 16:17:43 breholee Exp $// ----------------------------------------------------------------------------#include <config.h>#include "RoutingSpace.hh"#include "helper.hh"#include <iostream>#include <cassert>using std::vector ;using std::cout ;using std::endl ;using std::string ;namespace certi {// ----------------------------------------------------------------------------/** Constructor */RoutingSpace::RoutingSpace() { }// ----------------------------------------------------------------------------/** Destructor */RoutingSpace::~RoutingSpace() { }// ----------------------------------------------------------------------------/** Add a dimension. A copy of the dimension parameter is added in the routing space. \param d Dimension to add */voidRoutingSpace::addDimension(const Dimension &d){ dimensions.push_back(d); assert(dimensions.back().getHandle() == dimensions.size());}// ----------------------------------------------------------------------------/** Set the routing space's handle \param h Routing space handle */voidRoutingSpace::setHandle(SpaceHandle h){ handle = h ;}// ----------------------------------------------------------------------------/** Display (stdout) the routing space details */voidRoutingSpace::display() const{ cout << "RoutingSpace \"" << name << "\"" << endl ;}// ----------------------------------------------------------------------------/** Set the routing space's name \param s Routing space name */voidRoutingSpace::setName(string s){ name = s ;}// ----------------------------------------------------------------------------/** Get the routing space's name \return Routing space name */stringRoutingSpace::getName() const{ return name ;}// ----------------------------------------------------------------------------/** get the routing space's handle \return Handle */SpaceHandleRoutingSpace::getHandle() const{ return handle ;}// ----------------------------------------------------------------------------/** Get the handle of the specified dimension \param dimension_name Dimension name \return Dimension handle */DimensionHandleRoutingSpace::getDimensionHandle(string dimension_name) const throw (NameNotFound){ vector<Dimension>::const_iterator it = std::find_if( dimensions.begin(), dimensions.end(), NameComparator<Dimension>(dimension_name)); if (it == dimensions.end()) throw NameNotFound(); else return it->getHandle();}// ----------------------------------------------------------------------------/** Get the name of the specified dimension \param dimension_handle Dimension handle \return Dimension name */stringRoutingSpace::getDimensionName(DimensionHandle dimension_handle) const throw (DimensionNotDefined){ vector<Dimension>::const_iterator it = std::find_if( dimensions.begin(), dimensions.end(), HandleComparator<Dimension>(dimension_handle)); if (it == dimensions.end()) throw DimensionNotDefined(); else return it->getName();}// ----------------------------------------------------------------------------/** Get the number of dimensions of this space \return Number of dimensions */size_tRoutingSpace::size() const{ return dimensions.size();}} // namespace certi// $Id: RoutingSpace.cc,v 3.6 2004/01/09 16:17:43 breholee Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -