Commit 520d24e6 authored by Matthieu Dorier's avatar Matthieu Dorier

changed endpoint internal engine to pointer

parent 07eaf7fb
......@@ -21,14 +21,17 @@ class endpoint {
private:
engine& m_engine;
engine* m_engine;
hg_addr_t m_addr;
endpoint(engine& e, hg_addr_t addr)
: m_engine(e), m_addr(addr) {}
: m_engine(&e), m_addr(addr) {}
public:
endpoint()
: m_engine(nullptr), m_addr(HG_ADDR_NULL) {}
endpoint(const endpoint& other);
endpoint(endpoint&& other)
......
......@@ -13,7 +13,7 @@ namespace thallium {
callable_remote_procedure::callable_remote_procedure(hg_id_t id, const endpoint& ep, bool ignore_resp) {
m_ignore_response = ignore_resp;
// TODO throw exception if this call fails
margo_create(ep.m_engine.m_mid, ep.m_addr, id, &m_handle);
margo_create(ep.m_engine->m_mid, ep.m_addr, id, &m_handle);
}
}
......@@ -11,20 +11,20 @@ namespace thallium {
endpoint::endpoint(const endpoint& other)
: m_engine(other.m_engine) {
if(other.m_addr != HG_ADDR_NULL) {
margo_addr_dup(m_engine.m_mid, other.m_addr, &m_addr);
margo_addr_dup(m_engine->m_mid, other.m_addr, &m_addr);
} else {
m_addr = HG_ADDR_NULL;
}
}
endpoint& endpoint::operator=(const endpoint& other) {
// TODO throw an exception if the two endpoints don't have the same m_margo
if(&other == this) return *this;
if(m_addr != HG_ADDR_NULL) {
margo_addr_free(m_engine.m_mid, m_addr);
margo_addr_free(m_engine->m_mid, m_addr);
}
m_engine = other.m_engine;
if(other.m_addr != HG_ADDR_NULL) {
margo_addr_dup(m_engine.m_mid, other.m_addr, &m_addr);
margo_addr_dup(m_engine->m_mid, other.m_addr, &m_addr);
} else {
m_addr = HG_ADDR_NULL;
}
......@@ -32,11 +32,11 @@ endpoint& endpoint::operator=(const endpoint& other) {
}
endpoint& endpoint::operator=(endpoint&& other) {
// TODO throw an exception if the two endpoints don't have the same m_margo
if(&other == this) return *this;
if(m_addr != HG_ADDR_NULL) {
margo_addr_free(m_engine.m_mid, m_addr);
margo_addr_free(m_engine->m_mid, m_addr);
}
m_engine = other.m_engine;
m_addr = other.m_addr;
other.m_addr = HG_ADDR_NULL;
return *this;
......@@ -44,7 +44,7 @@ endpoint& endpoint::operator=(endpoint&& other) {
endpoint::~endpoint() {
if(m_addr != HG_ADDR_NULL) {
margo_addr_free(m_engine.m_mid, m_addr);
margo_addr_free(m_engine->m_mid, m_addr);
}
}
......@@ -53,12 +53,12 @@ endpoint::operator std::string() const {
if(m_addr == HG_ADDR_NULL) return std::string();
hg_size_t size;
margo_addr_to_string(m_engine.m_mid, NULL, &size, m_addr);
margo_addr_to_string(m_engine->m_mid, NULL, &size, m_addr);
std::string result(size+1,' ');
size += 1;
margo_addr_to_string(m_engine.m_mid, &result[0], &size, m_addr);
margo_addr_to_string(m_engine->m_mid, &result[0], &size, m_addr);
return result;
}
......
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