torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RouterHeuristicBase.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the HeuristicBase class.
18 
19 #ifndef TORC_ROUTER_ROUTERHEURISTICBASE_HPP
20 #define TORC_ROUTER_ROUTERHEURISTICBASE_HPP
21 
23 #include <boost/unordered_map.hpp>
24 #include <boost/any.hpp>
25 
26 
27 namespace torc {
28 namespace router {
29 
30  /// \brief Provides the interface for net routers.
32  // types
33  /// \brief Imported type names
35  typedef boost::unordered_map<boost::uint32_t, boost::any> ParameterMap;
36 
37  protected:
38  // members
39  /// \brief Database reference.
40  DDB& mDB;
41  /// \brief Parameter map.
43 
44  public:
45  // constructor
46  /// \brief Public Constructor
47  RouterHeuristicBase(DDB& inDB) : mDB(inDB) {}
48  /// \brief Destructor.
49  virtual ~RouterHeuristicBase() {}
50 
51  /// \brief Get a parameter.
52  boost::any getParameter(boost::uint32_t index) {
53  ParameterMap::iterator p = mParameters.find(index);
54  if (p != mParameters.end()) {
55  return p->second;
56  }
57  return boost::any();
58  }
59  /// \brief Set a parameter.
60  void setParameter(boost::uint32_t index, boost::any inParameter) {
61  mParameters[index] = inParameter;
62  }
63  /// \brief Do something with the parameters.
64  virtual void processParameters() {}
65 
66  };
67 
68 } // namespace router
69 } // namespace torc
70 
71 #endif // TORC_ROUTER_ROUTERHEURISTICBASE_HPP
RouterHeuristicBase(DDB &inDB)
Public Constructor.
virtual ~RouterHeuristicBase()
Destructor.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
boost::any getParameter(boost::uint32_t index)
Get a parameter.
architecture::DDB DDB
Imported type names.
boost::unordered_map< boost::uint32_t, boost::any > ParameterMap
void setParameter(boost::uint32_t index, boost::any inParameter)
Set a parameter.
Provides the interface for net routers.
virtual void processParameters()
Do something with the parameters.
Header for the DDB class.
ParameterMap mParameters
Parameter map.