bulk.cpp 1.14 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5 6
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
#include <thallium/bulk.hpp>
Matthieu Dorier's avatar
Matthieu Dorier committed
7
#include <thallium/remote_bulk.hpp>
Matthieu Dorier's avatar
Matthieu Dorier committed
8 9 10

namespace thallium {

11 12 13 14 15 16
hg_bulk_t bulk::get_bulk(bool copy=false) const {
    if(copy && m_bulk != HG_BULK_NULL)
        margo_bulk_ref_incr(m_bulk);
    return m_bulk;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
17 18 19 20 21 22 23 24
bulk::bulk_segment bulk::select(std::size_t offset, std::size_t size) const {
    return bulk_segment(*this, offset, size);
}

bulk::bulk_segment bulk::operator()(std::size_t offset, std::size_t size) const {
    return select(offset, size);
}

Matthieu Dorier's avatar
Matthieu Dorier committed
25 26
remote_bulk bulk::bulk_segment::on(const endpoint& ep) const {
    return remote_bulk(*this, ep);
Matthieu Dorier's avatar
Matthieu Dorier committed
27 28
}

Matthieu Dorier's avatar
Matthieu Dorier committed
29 30
remote_bulk bulk::on(const endpoint& ep) const {
    return remote_bulk(*this, ep);
31 32
}

Matthieu Dorier's avatar
Matthieu Dorier committed
33
std::size_t bulk::bulk_segment::operator>>(const remote_bulk& b) const {
34 35 36
    return b << *this;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
37
std::size_t bulk::bulk_segment::operator<<(const remote_bulk& b) const {
38 39 40
    return b >> *this;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
41
std::size_t bulk::operator>>(const remote_bulk& b) const {
42 43 44
    return b << (this->select(0,size()));
}

Matthieu Dorier's avatar
Matthieu Dorier committed
45
std::size_t bulk::operator<<(const remote_bulk& b) const {
46 47
    return b >> (this->select(0,size()));
}
Matthieu Dorier's avatar
Matthieu Dorier committed
48
}