-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTable.h
52 lines (40 loc) · 1.18 KB
/
Table.h
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
51
//========================================================================
// Table.h
//========================================================================
// Declarations for generic table.
#ifndef TABLE_H
#define TABLE_H
#include <cstddef>
template < typename T >
class Vector;
template < typename T >
class Table
{
public:
Table( unsigned int nbins = 1, T min = T(), T max = T() );
~Table();
Table( const Table<T>& table );
Table<T>& operator=(const Table<T>& table);
// Methods
size_t size() const;
void add( const T& value );
bool find( const T& value ) ;
const T& find_closest( const T& value ) ;
void print() const;
private:
//'''' ASSIGNMENT TASK '''''''''''''''''''''''''''''''''''''''''''''''''
// Declare private data members and member functions. Note that
// according to our naming convention, data member's name should starts
// with a `m_` prefix.
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
unsigned int m_nbins = 0;
T m_min;
T m_max;
size_t m_size;
Vector<T>* m_vecBins;
int m_range;
size_t get_bin(T value);
};
// Include inline definitions
#include "Table.inl"
#endif /* TABLE_H */