diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2024-05-01 18:51:41 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2024-05-01 18:51:41 -0400 |
| commit | 96faedaeb92776fd9cc2ed8d8b0878ebc9300cbe (patch) | |
| tree | a681788b4074b97dedd45778aa79749f6d4204be /include/framework/structure/InternalLevel.h | |
| parent | ef2ec17c21cb331c37f25501394b009282604fcf (diff) | |
| download | dynamic-extension-96faedaeb92776fd9cc2ed8d8b0878ebc9300cbe.tar.gz | |
Added a Bentley-Saxe layout policy
Diffstat (limited to 'include/framework/structure/InternalLevel.h')
| -rw-r--r-- | include/framework/structure/InternalLevel.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h index db38946..b962dcc 100644 --- a/include/framework/structure/InternalLevel.h +++ b/include/framework/structure/InternalLevel.h @@ -64,6 +64,21 @@ public: return std::shared_ptr<InternalLevel>(res); } + static std::shared_ptr<InternalLevel> reconstruction(std::vector<InternalLevel*> levels, size_t level_idx) { + std::vector<Shard *> shards; + for (auto level : levels) { + for (auto shard : level->m_shards) { + if (shard) shards.emplace_back(shard.get()); + } + } + + auto res = new InternalLevel(level_idx, 1); + res->m_shard_cnt = 1; + res->m_shards[0] = std::make_shared<S>(shards); + + return std::shared_ptr<InternalLevel>(res); + } + /* * Create a new shard combining the records from all of * the shards in level, and append this new shard into @@ -185,6 +200,10 @@ public: } Shard* get_shard(size_t idx) { + if (idx >= m_shard_cnt) { + return nullptr; + } + return m_shards[idx].get(); } |