-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstantTable.cpp
More file actions
50 lines (41 loc) · 957 Bytes
/
Copy pathConstantTable.cpp
File metadata and controls
50 lines (41 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
#include <iostream>
#include "ConstantTable.h"
using namespace std;
ConstantTable::ConstantTable()
{
this->table = vector<shared_ptr<double>>(0);
}
void ConstantTable::reset()
{
this->table = vector<shared_ptr<double>>(0);
}
shared_ptr<double> ConstantTable::createEmptyElementAtEnd()
{
this->table.push_back(shared_ptr<double>(new double(0.0)));
return table.at(table.size() - 1);
}
void ConstantTable::debugPrint() const
{
cout << "Number of elements: " << this->table.size() << endl;
for (const auto& x : this->table) {
cout << *x << endl;
}
}
void ConstantTable::setTable(const vector<double>& arr)
{
for (int i = 0; i < this->table.size(); i++) {
*this->table.at(i) = arr[i];
}
}
int ConstantTable::getSize() const
{
return this->table.size();
}
vector<double> ConstantTable::getTable() const
{
vector<double> table(0);
for (int i = 0; i < this->table.size(); i++) {
table.push_back(*this->table.at(i));
}
return table;
}