Run.cpp 17.6 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5
/*
 * (C) 2018 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
6
#include "hepnos/Run.hpp"
7
#include "hepnos/DataSet.hpp"
8
#include "hepnos/AsyncEngine.hpp"
9
#include "hepnos/Prefetcher.hpp"
Matthieu Dorier's avatar
Matthieu Dorier committed
10
#include "ItemImpl.hpp"
11
#include "PrefetcherImpl.hpp"
12 13
#include "DataStoreImpl.hpp"
#include "WriteBatchImpl.hpp"
14
#include "AsyncEngineImpl.hpp"
15 16 17

namespace hepnos {

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
////////////////////////////////////////////////////////////////////////////////////////////
// Run::const_iterator::Impl declaration
////////////////////////////////////////////////////////////////////////////////////////////

class Run::const_iterator::Impl {

    friend class Run;

    public:
        SubRun m_current_subrun;
        std::shared_ptr<PrefetcherImpl> m_prefetcher;

        Impl()
        : m_current_subrun()
        {}

        Impl(const SubRun& subrun)
        : m_current_subrun(subrun)
        {}

        Impl(SubRun&& subrun)
            : m_current_subrun(std::move(subrun))
        {}

        Impl(const Impl& other)
            : m_current_subrun(other.m_current_subrun)
        {}

        ~Impl() {
            if(m_prefetcher)
                m_prefetcher->m_associated = false;
        }

        bool operator==(const Impl& other) const {
            return m_current_subrun == other.m_current_subrun;
        }

        void setPrefetcher(const std::shared_ptr<PrefetcherImpl>& p) {
            if(p->m_associated)
                throw Exception("Prefetcher object already in use");
            if(m_prefetcher)
                m_prefetcher->m_associated = false;
            m_prefetcher = p;
            m_prefetcher->m_associated = true;
        }
};


Matthieu Dorier's avatar
Matthieu Dorier committed
66
static Run::iterator Run_end;
67

68
Run::Run()
Matthieu Dorier's avatar
Matthieu Dorier committed
69
: m_impl(std::make_shared<ItemImpl>(nullptr, UUID(), InvalidRunNumber)) {} 
70

Matthieu Dorier's avatar
Matthieu Dorier committed
71
Run::Run(std::shared_ptr<ItemImpl>&& impl)
72
: m_impl(std::move(impl)) { }
73

Matthieu Dorier's avatar
Matthieu Dorier committed
74
Run::Run(const std::shared_ptr<ItemImpl>& impl)
75
: m_impl(impl) { }
76

77
DataStore Run::datastore() const {
78 79 80
    if(!valid()) { 
        throw Exception("Calling Run member function on an invalid Run object");
    }
81
    return DataStore(m_impl->m_datastore);
82 83
}

84 85 86
Run Run::next() const {
    if(!valid()) return Run();
   
Matthieu Dorier's avatar
Matthieu Dorier committed
87
    std::vector<std::shared_ptr<ItemImpl>> next_runs;
88
    size_t s = m_impl->m_datastore->nextItems(ItemType::RUN, ItemType::DATASET, m_impl, next_runs, 1);
89
    if(s == 0) return Run();
Matthieu Dorier's avatar
Matthieu Dorier committed
90
    return Run(std::move(next_runs[0]));
91 92 93 94 95 96 97
}

bool Run::valid() const {
    return m_impl && m_impl->m_datastore; 

}

98
ProductID Run::storeRawData(const std::string& key, const char* value, size_t vsize) {
99
    if(!valid()) {
100
        throw Exception("Calling Run member function on an invalid Run object");
101 102
    }
    // forward the call to the datastore's store function
Matthieu Dorier's avatar
Matthieu Dorier committed
103 104
    const ItemDescriptor& id = m_impl->m_descriptor;
    return m_impl->m_datastore->storeRawProduct(id, key, value, vsize);
105 106
}

107
ProductID Run::storeRawData(WriteBatch& batch, const std::string& key, const char* value, size_t vsize) {
108 109 110
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
111
    // forward the call to the batch's store function
Matthieu Dorier's avatar
Matthieu Dorier committed
112
    const ItemDescriptor& id = m_impl->m_descriptor;
113 114 115 116
    if(batch.m_impl)
        return batch.m_impl->storeRawProduct(id, key, value, vsize);
    else
        return m_impl->m_datastore->storeRawProduct(id, key, value, vsize);
117 118
}

119 120 121 122 123 124
ProductID Run::storeRawData(AsyncEngine& async, const std::string& key, const char* value, size_t vsize) {
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
    // forward the call to the async engine's store function
    const ItemDescriptor& id = m_impl->m_descriptor;
125 126 127 128
    if(async.m_impl)
        return async.m_impl->storeRawProduct(id, key, value, vsize);
    else
        return m_impl->m_datastore->storeRawProduct(id, key, value, vsize);
129 130
}

131
bool Run::loadRawData(const std::string& key, std::string& buffer) const {
132 133 134
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
135
    // forward the call to the datastore's load function
Matthieu Dorier's avatar
Matthieu Dorier committed
136 137
    const ItemDescriptor& id = m_impl->m_descriptor;
    return m_impl->m_datastore->loadRawProduct(id, key, buffer);
138 139
}

140
bool Run::loadRawData(const std::string& key, char* value, size_t* vsize) const {
141
    if(!valid()) {
142
        throw Exception("Calling DataSet member function on an invalid DataSet");
143 144
    }
    // forward the call to the datastore's load function
Matthieu Dorier's avatar
Matthieu Dorier committed
145 146
    const ItemDescriptor& id = m_impl->m_descriptor;
    return m_impl->m_datastore->loadRawProduct(id, key, value, vsize);
147 148
}

149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
bool Run::loadRawData(const Prefetcher& prefetcher, const std::string& key, std::string& buffer) const {
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
    const ItemDescriptor& id = m_impl->m_descriptor;
    return prefetcher.m_impl->loadRawProduct(id, key, buffer);
}

bool Run::loadRawData(const Prefetcher& prefetcher, const std::string& key, char* value, size_t* vsize) const {
    if(!valid()) {
        throw Exception("Calling DataSet member function on an invalid DataSet");
    }
    const ItemDescriptor& id = m_impl->m_descriptor;
    return prefetcher.m_impl->loadRawProduct(id, key, value, vsize);
}

165
bool Run::operator==(const Run& other) const {
166 167 168 169 170
    bool v1 = valid();
    bool v2 = other.valid();
    if(!v1 && !v2) return true;
    if(v1 && !v2)  return false;
    if(!v1 && v2)  return false;
171
    return (m_impl == other.m_impl) || (*m_impl == *other.m_impl);
172 173 174 175 176 177 178
}

bool Run::operator!=(const Run& other) const {
    return !(*this == other);
}

const RunNumber& Run::number() const {
179 180 181
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
182
    return m_impl->m_descriptor.run;
183 184
}

Matthieu Dorier's avatar
Matthieu Dorier committed
185
SubRun Run::createSubRun(const SubRunNumber& subRunNumber) {
186 187 188
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
189 190 191
    ItemDescriptor& id = m_impl->m_descriptor;
    m_impl->m_datastore->createItem(id.dataset, id.run, subRunNumber);
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, subRunNumber);
192
    return SubRun(std::move(new_subrun_impl));
193 194
}

Matthieu Dorier's avatar
Matthieu Dorier committed
195 196 197 198
SubRun Run::createSubRun(WriteBatch& batch, const SubRunNumber& subRunNumber) {
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
199
    ItemDescriptor& id = m_impl->m_descriptor;
200 201 202 203
    if(batch.m_impl)
        batch.m_impl->createItem(id.dataset, id.run, subRunNumber);
    else
        m_impl->m_datastore->createItem(id.dataset, id.run, subRunNumber);
Matthieu Dorier's avatar
Matthieu Dorier committed
204
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, subRunNumber);
205 206 207 208 209 210 211 212
    return SubRun(std::move(new_subrun_impl));
}

SubRun Run::createSubRun(AsyncEngine& async, const SubRunNumber& subRunNumber) {
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
    ItemDescriptor& id = m_impl->m_descriptor;
213 214 215 216
    if(async.m_impl)
        async.m_impl->createItem(id.dataset, id.run, subRunNumber);
    else
        m_impl->m_datastore->createItem(id.dataset, id.run, subRunNumber);
217
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, subRunNumber);
218
    return SubRun(std::move(new_subrun_impl));
Matthieu Dorier's avatar
Matthieu Dorier committed
219 220
}

221
SubRun Run::operator[](const SubRunNumber& subRunNumber) const {
Matthieu Dorier's avatar
Matthieu Dorier committed
222
    auto it = find(subRunNumber);
223 224
    if(!it->valid())
        throw Exception("Requested SubRun does not exist");
225 226 227
    return std::move(*it);
}

Matthieu Dorier's avatar
Matthieu Dorier committed
228
Run::iterator Run::find(const SubRunNumber& subRunNumber) {
229 230 231
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
232 233 234 235
    auto& id = m_impl->m_descriptor;
    bool b = m_impl->m_datastore->itemExists(id.dataset, 
                                             id.run,
                                             subRunNumber);
236
    if(!b) {
Matthieu Dorier's avatar
Matthieu Dorier committed
237
        return Run_end;
238
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
239
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, subRunNumber);
240
    return iterator(SubRun(std::move(new_subrun_impl)));
241 242
}

243 244 245 246
Run::iterator Run::find(const SubRunNumber& subRunNumber, const Prefetcher& prefetcher) {
    auto it = find(subRunNumber);
    if(it != end()) {
        it.m_impl->setPrefetcher(prefetcher.m_impl);
247
        prefetcher.m_impl->fetchRequestedProducts(it.m_impl->m_current_subrun.m_impl);
248 249 250 251 252
        prefetcher.m_impl->prefetchFrom(ItemType::SUBRUN, ItemType::RUN, it.m_impl->m_current_subrun.m_impl);
    }
    return it;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
253 254
Run::const_iterator Run::find(const SubRunNumber& subRunNumber) const {
    iterator it = const_cast<Run*>(this)->find(subRunNumber);
255 256 257
    return it;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
258 259
Run::iterator Run::begin() {
    auto it = find(0);
260
    if(it != end()) return it;
Matthieu Dorier's avatar
Matthieu Dorier committed
261

Matthieu Dorier's avatar
Matthieu Dorier committed
262 263
    auto& id = m_impl->m_descriptor;
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, 0);
264 265

    SubRun subrun(std::move(new_subrun_impl));
Matthieu Dorier's avatar
Matthieu Dorier committed
266 267 268
    subrun = subrun.next();

    if(subrun.valid()) return iterator(subrun);
269 270 271
    else return end();
}

272 273 274 275
Run::iterator Run::begin(const Prefetcher& prefetcher) {
    auto it = begin();
    if(it != end()) {
        it.m_impl->setPrefetcher(prefetcher.m_impl);
276
        prefetcher.m_impl->fetchRequestedProducts(it.m_impl->m_current_subrun.m_impl);
277 278 279 280 281
        prefetcher.m_impl->prefetchFrom(ItemType::SUBRUN, ItemType::RUN, it.m_impl->m_current_subrun.m_impl);
    }
    return it;
}

Matthieu Dorier's avatar
Matthieu Dorier committed
282
Run::iterator Run::end() {
283 284 285
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
286
    return Run_end;
Matthieu Dorier's avatar
Matthieu Dorier committed
287 288 289 290 291 292
}

Run::const_iterator Run::begin() const {
    return const_iterator(const_cast<Run*>(this)->begin());
}

293 294 295 296
Run::const_iterator Run::begin(const Prefetcher& prefetcher) const {
    return const_iterator(const_cast<Run*>(this)->begin(prefetcher));
}

Matthieu Dorier's avatar
Matthieu Dorier committed
297
Run::const_iterator Run::end() const {
298 299 300
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
301
    return Run_end;
302 303
}

Matthieu Dorier's avatar
Matthieu Dorier committed
304 305
Run::const_iterator Run::cbegin() const {
    return const_iterator(const_cast<Run*>(this)->begin());
306 307
}

308 309 310 311
Run::const_iterator Run::cbegin(const Prefetcher& prefetcher) const {
    return const_iterator(const_cast<Run*>(this)->begin(prefetcher));
}

Matthieu Dorier's avatar
Matthieu Dorier committed
312
Run::const_iterator Run::cend() const {
313 314 315
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
316
    return Run_end;
317 318
}

Matthieu Dorier's avatar
Matthieu Dorier committed
319 320 321 322 323 324
Run::iterator Run::lower_bound(const SubRunNumber& lb) {
    if(lb == 0) {
        auto it = find(0);
        if(it != end()) {
            return it;
        } else {
Matthieu Dorier's avatar
Matthieu Dorier committed
325 326
            auto& id = m_impl->m_descriptor;
            auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, 0);
327
            SubRun subrun(std::move(new_subrun_impl));
Matthieu Dorier's avatar
Matthieu Dorier committed
328 329 330 331 332 333 334 335 336 337
            subrun = subrun.next();
            if(!subrun.valid()) return end();
            else return iterator(subrun);
        }
    } else {
        auto it = find(lb-1);
        if(it != end()) {
            ++it;
            return it;
        }
Matthieu Dorier's avatar
Matthieu Dorier committed
338 339
        auto& id = m_impl->m_descriptor;
        auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, lb-1);
340
        SubRun subrun(std::move(new_subrun_impl));
Matthieu Dorier's avatar
Matthieu Dorier committed
341 342 343
        subrun = subrun.next();
        if(!subrun.valid()) return end();
        else return iterator(subrun);
344 345 346
    }
}

347 348 349 350
Run::iterator Run::lower_bound(const SubRunNumber& lb, const Prefetcher& prefetcher) {
    auto it = lower_bound(lb);
    if(it != end()) {
        it.m_impl->setPrefetcher(prefetcher.m_impl);
351
        prefetcher.m_impl->fetchRequestedProducts(it.m_impl->m_current_subrun.m_impl);
352 353
        prefetcher.m_impl->prefetchFrom(ItemType::SUBRUN, ItemType::RUN, it.m_impl->m_current_subrun.m_impl);
    }
354 355 356
    return it;
}

357 358 359 360 361 362 363 364
Run::const_iterator Run::lower_bound(const SubRunNumber& lb) const {
    return const_cast<Run*>(this)->lower_bound(lb);
}

Run::const_iterator Run::lower_bound(const SubRunNumber& lb, const Prefetcher& prefetcher) const {
    return const_cast<Run*>(this)->lower_bound(lb, prefetcher);
}

Matthieu Dorier's avatar
Matthieu Dorier committed
365
Run::iterator Run::upper_bound(const SubRunNumber& ub) {
366 367 368
    if(!valid()) {
        throw Exception("Calling Run member function on an invalid Run object");
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
369 370
    auto& id = m_impl->m_descriptor;
    auto new_subrun_impl = std::make_shared<ItemImpl>(m_impl->m_datastore, id.dataset, id.run, ub);
371
    SubRun subrun(std::move(new_subrun_impl));
Matthieu Dorier's avatar
Matthieu Dorier committed
372 373 374
    subrun = subrun.next();
    if(!subrun.valid()) return end();
    else return iterator(subrun);
375 376
}

377 378 379 380
Run::iterator Run::upper_bound(const SubRunNumber& ub, const Prefetcher& prefetcher) {
    auto it = upper_bound(ub);
    if(it != end()) {
        it.m_impl->setPrefetcher(prefetcher.m_impl);
381
        prefetcher.m_impl->fetchRequestedProducts(it.m_impl->m_current_subrun.m_impl);
382 383
        prefetcher.m_impl->prefetchFrom(ItemType::SUBRUN, ItemType::RUN, it.m_impl->m_current_subrun.m_impl);
    }
384 385
    return it;
}
Matthieu Dorier's avatar
Matthieu Dorier committed
386

387 388 389 390 391 392 393 394
Run::const_iterator Run::upper_bound(const SubRunNumber& ub) const {
    return const_cast<Run*>(this)->upper_bound(ub);
}

Run::const_iterator Run::upper_bound(const SubRunNumber& ub, const Prefetcher& prefetcher) const {
    return const_cast<Run*>(this)->upper_bound(ub, prefetcher);
}

395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
void Run::toDescriptor(RunDescriptor& descriptor) {
    std::memset(descriptor.data, 0, sizeof(descriptor.data));
    if(!valid()) return;
    std::memcpy(descriptor.data, &(m_impl->m_descriptor), sizeof(descriptor.data));
}

Run Run::fromDescriptor(const DataStore& datastore, const RunDescriptor& descriptor, bool validate) {
    auto itemImpl = std::make_shared<ItemImpl>(datastore.m_impl, UUID(), InvalidRunNumber);
    auto& itemDescriptor = itemImpl->m_descriptor;
    std::memcpy(&itemDescriptor, descriptor.data, sizeof(descriptor.data));
    if((!validate) || datastore.m_impl->itemExists(itemDescriptor))
        return Run(std::move(itemImpl));
    else return Run();
}

Matthieu Dorier's avatar
Matthieu Dorier committed
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
////////////////////////////////////////////////////////////////////////////////////////////
// Run::const_iterator implementation
////////////////////////////////////////////////////////////////////////////////////////////

Run::const_iterator::const_iterator()
: m_impl(std::make_unique<Impl>()) {}

Run::const_iterator::const_iterator(const SubRun& subrun)
: m_impl(std::make_unique<Impl>(subrun)) {}

Run::const_iterator::const_iterator(SubRun&& subrun)
: m_impl(std::make_unique<Impl>(std::move(subrun))) {}

Run::const_iterator::~const_iterator() {}

425 426 427 428
Run::const_iterator::const_iterator(const Run::const_iterator& other) {
    if(other.m_impl) 
        m_impl = std::make_unique<Impl>(*other.m_impl);
}
Matthieu Dorier's avatar
Matthieu Dorier committed
429 430 431 432 433 434

Run::const_iterator::const_iterator(Run::const_iterator&& other)
: m_impl(std::move(other.m_impl)) {}

Run::const_iterator& Run::const_iterator::operator=(const Run::const_iterator& other) {
    if(&other == this) return *this;
435 436 437 438
    if(other.m_impl)
        m_impl = std::make_unique<Impl>(*other.m_impl);
    else
        m_impl.reset();
Matthieu Dorier's avatar
Matthieu Dorier committed
439 440 441 442 443 444 445 446 447 448 449 450 451
    return *this;
}

Run::const_iterator& Run::const_iterator::operator=(Run::const_iterator&& other) {
    if(&other == this) return *this;
    m_impl = std::move(other.m_impl);
    return *this;
}

Run::const_iterator::self_type Run::const_iterator::operator++() {
    if(!m_impl) {
        throw Exception("Trying to increment an invalid iterator");
    }
452 453 454 455 456 457 458 459 460 461 462 463
    if(!m_impl->m_prefetcher) {
        m_impl->m_current_subrun = m_impl->m_current_subrun.next();
    } else {
        std::vector<std::shared_ptr<ItemImpl>> next_subruns;
        size_t s = m_impl->m_prefetcher->nextItems(ItemType::SUBRUN,
                ItemType::SUBRUN, m_impl->m_current_subrun.m_impl, next_subruns, 1);
        if(s == 1) {
            m_impl->m_current_subrun.m_impl = std::move(next_subruns[0]);
        } else {
            m_impl->m_current_subrun = SubRun();
        }
    }
Matthieu Dorier's avatar
Matthieu Dorier committed
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
    return *this;
}

Run::const_iterator::self_type Run::const_iterator::operator++(int) {
    const_iterator copy = *this;
    ++(*this);
    return copy;
}

const Run::const_iterator::reference Run::const_iterator::operator*() {
    if(!m_impl) {
        throw Exception("Trying to dereference an invalid iterator");
    }
    return m_impl->m_current_subrun;
}

const Run::const_iterator::pointer Run::const_iterator::operator->() {
    if(!m_impl) return nullptr;
    return &(m_impl->m_current_subrun);
}

bool Run::const_iterator::operator==(const self_type& rhs) const {
    if(!m_impl && !rhs.m_impl)  return true;
    if(m_impl  && !rhs.m_impl)  return false;
    if(!m_impl && rhs.m_impl)   return false;
    return *m_impl == *(rhs.m_impl);
}

bool Run::const_iterator::operator!=(const self_type& rhs) const {
493
    return !(*this == rhs);
Matthieu Dorier's avatar
Matthieu Dorier committed
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
}

////////////////////////////////////////////////////////////////////////////////////////////
// Run::iterator implementation
////////////////////////////////////////////////////////////////////////////////////////////

Run::iterator::iterator(const SubRun& current)
: const_iterator(current) {}

Run::iterator::iterator(SubRun&& current)
: const_iterator(std::move(current)) {}

Run::iterator::iterator()
: const_iterator() {}

Run::iterator::~iterator() {}

Run::iterator::iterator(const Run::iterator& other)
: const_iterator(other) {}

Run::iterator::iterator(Run::iterator&& other)
: const_iterator(std::move(other)) {}

Run::iterator& Run::iterator::operator=(const Run::iterator& other) {
    if(this == &other) return *this;
519 520 521 522
    if(other.m_impl) 
        m_impl = std::make_unique<Impl>(*other.m_impl);
    else
        m_impl.reset();
Matthieu Dorier's avatar
Matthieu Dorier committed
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
    return *this;
}

Run::iterator& Run::iterator::operator=(Run::iterator&& other) {
    if(this == &other) return *this;
    m_impl = std::move(other.m_impl);
    return *this;
}

Run::iterator::reference Run::iterator::operator*() {
    return const_cast<reference>(const_iterator::operator*());
}

Run::iterator::pointer Run::iterator::operator->() {
    return const_cast<pointer>(const_iterator::operator->());
}

540
}