PandA-2024.02
memory_symbol.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  */
44 #ifndef _MEMORY_SYMBOL_HPP_
45 #define _MEMORY_SYMBOL_HPP_
46 
47 #include "refcount.hpp"
48 #include <string>
49 
50 #include "string_manipulation.hpp" //STR
51 
52 #define MEM_PREFIX "MEM_"
53 
55 {
57  unsigned int variable;
58 
60  std::string symbol_name;
61 
63  std::string name;
64 
66  unsigned long long int address;
67 
68  public:
72  memory_symbol(unsigned int var, const std::string& _name, unsigned long long _address, unsigned int funId)
73  : variable(var),
74  symbol_name(STR(MEM_PREFIX) + "var_" + STR(var) + "_" + STR(funId)),
75  name(_name),
76  address(_address)
77  {
78  }
79 
83  ~memory_symbol() = default;
84 
88  void set_symbol_name(const std::string& _symbol_name)
89  {
90  symbol_name = _symbol_name;
91  }
92 
96  std::string get_symbol_name() const
97  {
98  return symbol_name;
99  }
100 
104  void set_name(const std::string& _name)
105  {
106  name = _name;
107  }
108 
112  std::string get_name() const
113  {
114  return name;
115  }
116 
120  void set_address(unsigned long long _address)
121  {
122  address = _address;
123  }
124 
128  unsigned long long int get_address() const
129  {
130  return address;
131  }
132 
136  unsigned int get_variable() const
137  {
138  return variable;
139  }
140 
141  bool notEQ(const memory_symbol& ref) const
142  {
143  return variable != ref.variable || name != ref.name || address != ref.address || symbol_name != ref.symbol_name;
144  }
145 };
148 
149 #endif
unsigned int variable
identifier of the variable
void set_address(unsigned long long _address)
Sets the actual address for the variable.
std::string name
name of the variable
void set_symbol_name(const std::string &_symbol_name)
Sets the actual name for the variable symbol.
unsigned long long int get_address() const
Gets the current address for the variable.
unsigned int get_variable() const
Gets the current the variable.
std::string symbol_name
name of the symbol
#define STR(s)
Macro which performs a lexical_cast to a string.
Auxiliary methods for manipulating string.
memory_symbol(unsigned int var, const std::string &_name, unsigned long long _address, unsigned int funId)
Constructor.
std::string get_symbol_name() const
Returns the current name for the variable symbol.
void set_name(const std::string &_name)
Sets the actual name for the variable.
Template definition of refcount.
std::string get_name() const
Returns the current name for the variable.
#define MEM_PREFIX
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
Definition: refcount.hpp:94
bool notEQ(const memory_symbol &ref) const
~memory_symbol()=default
Destructor.
unsigned long long int address
current variable address

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