Commit 33b8572e authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

added possibility to create endpoint and provider_handle from an hg_addr_t

parent 35cbb419
......@@ -40,6 +40,8 @@ private:
engine* m_engine;
hg_addr_t m_addr;
public:
/**
* @brief Constructor. Made private since endpoint instances
* can only be created using engine::lookup.
......@@ -47,10 +49,14 @@ private:
* @param e Engine that created the endpoint.
* @param addr Mercury address.
*/
endpoint(engine& e, hg_addr_t addr)
: m_engine(&e), m_addr(addr) {}
public:
endpoint(engine& e, hg_addr_t addr, bool take_ownership=true)
: m_engine(&e), m_addr(HG_ADDR_NULL) {
if(take_ownership) {
m_addr = addr;
} else {
margo_addr_dup(m_engine->m_mid, addr, &m_addr);
}
}
/**
* @brief Default constructor defined so that endpoints can
......
......@@ -28,6 +28,16 @@ private:
public:
/**
* @brief Constructor from a HG address.
*
* @param e engine.
* @param addr Address to encapsulate.
* @param provider_id provider id.
*/
provider_handle(engine& e, hg_addr_t addr, uint16_t provider_id=0, bool take_ownership=true)
: endpoint(e, addr, take_ownership), m_provider_id(provider_id) {}
/**
* @brief Constructor.
*
......
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