-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicArrayCython.h
More file actions
39 lines (30 loc) · 1.09 KB
/
Copy pathDynamicArrayCython.h
File metadata and controls
39 lines (30 loc) · 1.09 KB
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
#ifndef DYNAMIC_ARRAY_CYTHON_H
#define DYNAMIC_ARRAY_CYTHON_H
#include <algorithm> // For std::find_if
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
class DynamicArrayCython {
protected:
std::map<long, std::vector<double>> data; // 2D array for storing rows of data
size_t cols; // Number of columns, fixed
public:
DynamicArrayCython(size_t columns);
void deleteRow(long timestamp);
void removeFirstElement();
void deleteRange(long timestamp, int numberOfValues);
void deleteRowById(int index);
bool timestampExists(long timestamp) const;
size_t getNumRows() const;
void print() const;
long minKey() const;
long maxKey() const;
bool addOrUpdateRow(long timestamp, size_t column_index, double value);
std::vector<double> getRow(long timestamp);
std::vector<double> getRowByIndex(int index);
std::vector<std::vector<double>> getSlice(long timestamp, size_t numItems);
std::vector<long> getTimestamps() const;
std::vector<double> getFlattenedSlice(long timestamp, size_t numItems);
};
#endif // DYNAMIC_ARRAY_CYTHON_H