32 lines
561 B
C
32 lines
561 B
C
|
#pragma once
|
||
|
|
||
|
#include <map>
|
||
|
#include <vector>
|
||
|
|
||
|
class TruthTable
|
||
|
{
|
||
|
public:
|
||
|
using TableData = std::map<std::vector<bool>, std::vector<bool> >;
|
||
|
|
||
|
TruthTable(std::size_t numInputColumns, std::size_t numOutputColumns)
|
||
|
: mNumInputColumns(numInputColumns),
|
||
|
mNumOutputColumns(numOutputColumns)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
void setTable(const TableData& data)
|
||
|
{
|
||
|
mTable = data;
|
||
|
}
|
||
|
|
||
|
static TruthTable getAndTruthTable();
|
||
|
|
||
|
static const TruthTable::TableData AND_TRUTH_TABLE;
|
||
|
|
||
|
private:
|
||
|
std::size_t mNumInputColumns{ 0 };
|
||
|
std::size_t mNumOutputColumns{ 0 };
|
||
|
|
||
|
TableData mTable;
|
||
|
};
|