4 #ifndef ILANG_ILA_SYMBOL_H__
5 #define ILANG_ILA_SYMBOL_H__
24 Symbol(
const std::string& str);
32 const std::string&
str()
const;
34 const char*
c_str()
const;
36 const std::string
format_str(
const std::string& prefix =
"",
37 const std::string& suffix =
"")
const;
41 const size_t&
id()
const;
44 void set_name(
const std::string& name);
48 std::ostream&
Print(std::ostream& out)
const;
66 static size_t counter_;
72 #endif // ILANG_ILA_SYMBOL_H__
Symbol & operator=(const Symbol &rhs)
Overload assignment.
friend bool operator<(const Symbol &lhs, const Symbol &rhs)
Overload comparison <.
~Symbol()
Default destructor.
const std::string & str() const
Get the name as basic string.
void set_name(const std::string &name)
Update the name (should not be initialized before).
int to_int() const
Convert the name to integer and return.
The symbol is the name and ID of an object. Every object has an unique symbol.
Definition: symbol.h:16
Symbol()
Default constructor (empty name).
const char * c_str() const
Get the name as c-type string.
std::ostream & Print(std::ostream &out) const
Output function.
friend std::ostream & operator<<(std::ostream &out, const Symbol &s)
Overload output stream.
const std::string format_str(const std::string &prefix="", const std::string &suffix="") const
Get the symbol as cpp string.
friend bool operator==(const Symbol &lhs, const Symbol &rhs)
Overload comparison ==.
const size_t & id() const
Get the id.