#ifndef ns_bler_h
#define ns_bler_h

#include <stdio.h>

class BlerTable {
public:
	BlerTable();
	double getbler(double ebno);

	static double table[2][20];	// 1 row: Eb/No
		// 2 row: BLER
};

double BlerTable::table[2][20] = {
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
		{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
	};

BlerTable::BlerTable() {
}

double BlerTable::getbler(double ebno) {
	int i;
	double bler;
	bler = 1e38;
	for (i=19; i>0; i--) {
		if (table[1][i] > ebno) {
			bler = table[2][i];
		} else {
			return bler;
		}
	}
	return bler;
}

#endif /* __bler_h__ */
