Ignore:
Timestamp:
Jan 16, 2018, 4:22:13 PM (15 months ago)
Author:
nmedfort
Message:

Added PabloBlock/Builder? createScope() methods + minor code changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/builder.hpp

    r5828 r5836  
    2323    };
    2424
    25     explicit PabloBuilder(PabloBlock * block)
     25    using iterator = PabloBlock::iterator;
     26
     27    using const_iterator = PabloBlock::const_iterator;
     28
     29    PabloBuilder(not_null<PabloBlock *> block)
    2630    : mPb(block), mParent(nullptr), mExprTable(nullptr) {
    2731
    2832    }
    2933
    30     PabloBuilder & operator=(PabloBuilder) = delete;
    31 
    32     PabloBuilder & operator=(PabloBuilder &) = delete;
    33 
    34     PabloBuilder(PabloBuilder && builder)
    35     : mPb(builder.mPb)
    36     , mParent(builder.mParent)
    37     , mExprTable(std::move(builder.mExprTable)) {
    38 
    39     }
    40 
    41     PabloBuilder & operator=(PabloBuilder && builder) {
    42         mPb = builder.mPb;
    43         mParent = builder.mParent;
    44         mExprTable = std::move(builder.mExprTable);
    45         return *this;
    46     }
    47 
    48     using iterator = PabloBlock::iterator;
    49 
    50     using const_iterator = PabloBlock::const_iterator;
    51 
    52     static PabloBuilder Create(PabloBlock * block) noexcept {
    53         return PabloBuilder(block);
    54     }
    55 
    56     static PabloBuilder Create(PabloBuilder & builder) noexcept {
    57         return PabloBuilder(PabloBlock::Create(builder.getPabloBlock()->getParent()), builder);
     34    PabloBuilder createScope() noexcept {
     35        return PabloBuilder(&mPb->createScope(), this);
    5836    }
    5937
     
    308286protected:
    309287
    310     explicit PabloBuilder(PabloBlock * block, PabloBuilder & parent)
    311     : mPb(block), mParent(&parent), mExprTable(&(parent.mExprTable)) {
     288    PabloBuilder(not_null<PabloBlock *> block, not_null<PabloBuilder *> parent)
     289    : mPb(block), mParent(parent), mExprTable(&(parent->mExprTable)) {
    312290
    313291    }
     
    315293private:
    316294
    317     PabloBlock *        mPb;
    318     PabloBuilder *      mParent;
    319     ExpressionTable     mExprTable;
     295    PabloBlock * const          mPb;
     296    PabloBuilder * const        mParent;
     297    ExpressionTable             mExprTable;
    320298};
    321299
Note: See TracChangeset for help on using the changeset viewer.