Unverified Commit f88fb817 authored by Julian Kranz's avatar Julian Kranz
Browse files

cppgdsl: rreil id comparison

parent 1f051d86
......@@ -17,9 +17,13 @@ private:
std::string name;
void put(std::ostream &out);
static size_t subclass_counter;
public:
arch_id(std::string name);
size_t get_subclass_counter();
const std::string& get_name() {
return name;
}
......
......@@ -19,12 +19,17 @@ namespace rreil {
class id {
private:
virtual void put(std::ostream &out) = 0;
protected:
static size_t subclass_counter;
public:
virtual ~id() {
}
virtual size_t get_subclass_counter() = 0;
std::string to_string();
friend std::ostream &operator<< (std::ostream &out, id &_this);
virtual bool operator<(id const& other) const = 0;
virtual bool operator== (id &other) const = 0;
virtual void accept(id_visitor &v) = 0;
......
......@@ -24,9 +24,12 @@ private:
shared_id_type inner;
void put(std::ostream &out);
static size_t subclass_counter;
public:
shared_id(shared_id_type _id);
size_t get_subclass_counter();
shared_id_type get_inner() {
return inner;
}
......
......@@ -17,9 +17,12 @@ private:
int_t t;
void put(std::ostream &out);
static size_t subclass_counter;
public:
_virtual(int_t t);
size_t get_subclass_counter();
int_t get_t();
bool operator== (id &other) const;
......
......@@ -16,10 +16,16 @@ void gdsl::rreil::arch_id::put(std::ostream &out) {
out << name;
}
size_t gdsl::rreil::arch_id::subclass_counter = id::subclass_counter++;
arch_id::arch_id(string name) {
this->name = name;
}
size_t gdsl::rreil::arch_id::get_subclass_counter() {
return subclass_counter;
}
bool gdsl::rreil::arch_id::operator ==(id &other) const {
bool equals = false;
id_visitor iv;
......
......@@ -8,6 +8,8 @@
#include <cppgdsl/rreil/id/id.h>
#include <sstream>
size_t gdsl::rreil::id::subclass_counter = 0;
std::ostream &gdsl::rreil::operator <<(std::ostream &out, id &_this) {
_this.put(out);
return out;
......
......@@ -21,10 +21,16 @@ void gdsl::rreil::shared_id::put(std::ostream &out) {
out << shared_id_type_to_string(this->inner);
}
size_t gdsl::rreil::shared_id::subclass_counter = id::subclass_counter++;
gdsl::rreil::shared_id::shared_id(shared_id_type _id) {
this->inner = _id;
}
size_t gdsl::rreil::shared_id::get_subclass_counter() {
return subclass_counter;
}
bool gdsl::rreil::shared_id::operator ==(id &other) const {
bool equals = false;
id_visitor iv;
......
......@@ -14,10 +14,16 @@ void gdsl::rreil::_virtual::put(std::ostream &out) {
out << "t" << t;
}
size_t gdsl::rreil::_virtual::subclass_counter = id::subclass_counter++;
_virtual::_virtual(int_t t) {
this->t = t;
}
size_t gdsl::rreil::_virtual::get_subclass_counter() {
return subclass_counter;
}
int_t _virtual::get_t() {
return this->t;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment