PandA-2024.02
generic_obj.hpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
46 #ifndef GEN_OBJECT_HPP
47 #define GEN_OBJECT_HPP
48 
49 #include "config_HAVE_UNORDERED.hpp"
50 
51 #include "refcount.hpp"
52 #include <string>
53 #include <utility>
54 
61 
67 {
68  public:
71  {
87  };
88 
89  protected:
92 
95 
99 
101  std::string name;
102 
103  public:
107  generic_obj(const resource_type t, const std::string& _name) : type(t), name(_name)
108  {
109  }
110 
114  virtual ~generic_obj() = default;
115 
120  void print(std::ostream& os) const
121  {
122  os << name;
123  }
124 
131  friend std::ostream& operator<<(std::ostream& os, const generic_obj& s)
132  {
133  s.print(os);
134  return os;
135  }
136 
141  const std::string get_string() const
142  {
143  return name;
144  }
145 
151  unsigned int get_type() const
152  {
153  return type;
154  }
155 
161  {
162  SM = SM_;
163  }
164 
169  void set_out_sign(const structural_objectRef& out_sign_)
170  {
171  out_sign = out_sign_;
172  }
173 
179  {
180  return SM.lock();
181  }
182 
188  {
189  return out_sign.lock();
190  }
191 
196  bool operator<(const generic_obj& other) const;
197 };
198 
201 
202 #if !HAVE_UNORDERED
203 class GenericObjSorter : std::binary_function<generic_objRef, generic_objRef, bool>
204 {
205  public:
210 
217  bool operator()(const generic_objRef& x, const generic_objRef& y) const;
218 };
219 
221  : std::binary_function<std::pair<generic_objRef, unsigned int>, std::pair<generic_objRef, unsigned int>, bool>
222 {
223  public:
228 
235  bool operator()(const std::pair<generic_objRef, int>& x, const std::pair<generic_objRef, int>& y) const;
236 };
237 #endif
238 #endif
a multi unbounded controller
Definition: generic_obj.hpp:75
an element used for connecting the resources (e.g., muxes)
Definition: generic_obj.hpp:78
unsigned int get_type() const
Return generic_obj type.
specify the type of a connection object: UINT
Definition: generic_obj.hpp:86
a data port (in/out data)
Definition: generic_obj.hpp:77
Wrefcount< structural_object > out_sign
output signal associated to element.
Definition: generic_obj.hpp:98
const structural_objectRef get_out_sign() const
Gets structural_object of output signal associated to this object.
a converter from signed to signed int
Definition: generic_obj.hpp:83
std::string name
connection obj id
REF_FORWARD_DECL(structural_object)
void set_structural_obj(const structural_objectRef &SM_)
Sets structural_object associated to this object.
a converter from unsigned to unsigned int
Definition: generic_obj.hpp:80
const resource_type type
type of resource
Definition: generic_obj.hpp:91
const structural_objectRef get_structural_obj() const
Gets structural_object associated to this object.
const std::string get_string() const
Returns the name associated with the element.
generic_obj(const resource_type t, const std::string &_name)
This is the constructor of the object class.
void print(std::ostream &os) const
Prints elements into given stream.
a functional resource
Definition: generic_obj.hpp:73
a converter from real to real int
Definition: generic_obj.hpp:84
resource_type
Admissible resource types.
Definition: generic_obj.hpp:70
Generic class managing all resources into datapath.
Definition: generic_obj.hpp:66
virtual ~generic_obj()=default
Destructor.
Template definition of refcount.
void set_out_sign(const structural_objectRef &out_sign_)
Sets structural_object of output signal associated to this object.
bool operator<(const generic_obj &other) const
Definition: generic_obj.cpp:79
refcount< T > lock() const
Definition: refcount.hpp:212
Wrefcount< structural_object > SM
structural_object associated to element
Definition: generic_obj.hpp:94
friend std::ostream & operator<<(std::ostream &os, const generic_obj &s)
Friend definition of the << operator.
a converter from signed to unsigned int
Definition: generic_obj.hpp:82
an adder object representation used to compute some addresses
Definition: generic_obj.hpp:79
x
Return the smallest n such that 2^n >= _x.
a command port (mainly connections from/to controller)
Definition: generic_obj.hpp:76
specify the type of a connection object: INT
Definition: generic_obj.hpp:85
Base object for all the structural objects.
a converter from unsigned to signed int
Definition: generic_obj.hpp:81

Generated on Mon Feb 12 2024 13:02:54 for PandA-2024.02 by doxygen 1.8.13