OILS / vendor / souffle / profile / Row.h View on Github | oilshell.org

46 lines, 17 significant
1/*
2 * Souffle - A Datalog Compiler
3 * Copyright (c) 2016, The Souffle Developers. All rights reserved
4 * Licensed under the Universal Permissive License v 1.0 as shown at:
5 * - https://opensource.org/licenses/UPL
6 * - <souffle root>/licenses/SOUFFLE-UPL.txt
7 */
8
9#pragma once
10
11#include "souffle/profile/CellInterface.h"
12
13#include <memory>
14#include <vector>
15
16namespace souffle {
17namespace profile {
18
19/*
20 * Row class for Tables, holds a vector of cells.
21 */
22class Row {
23public:
24 std::vector<std::shared_ptr<CellInterface>> cells;
25
26 Row(unsigned long size) : cells() {
27 for (unsigned long i = 0; i < size; i++) {
28 cells.emplace_back(std::shared_ptr<CellInterface>(nullptr));
29 }
30 }
31
32 std::shared_ptr<CellInterface>& operator[](unsigned long i) {
33 return cells.at(i);
34 }
35
36 // void addCell(int location, std::shared_ptr<CellInterface> cell) {
37 // cells[location] = cell;
38 // }
39
40 inline std::vector<std::shared_ptr<CellInterface>> getCells() {
41 return cells;
42 }
43};
44
45} // namespace profile
46} // namespace souffle