-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOperations.cpp
29 lines (25 loc) · 886 Bytes
/
Operations.cpp
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
#include "Operations.h"
int Operations::getPriority(const std::string& symbols)
{
if (operations.count(symbols) == 0)
throw std::runtime_error("Unavaliable operation: " + symbols);
return operations[symbols]->getPriority();
}
bool Operations::getAssociativity(const std::string& symbols)
{
if (operations.count(symbols) == 0)
throw std::runtime_error("Unavaliable operation: " + symbols);
return operations[symbols]->getAssociativity();
}
int Operations::getBinary(const std::string& symbols)
{
if (operations.count(symbols) == 0)
throw std::runtime_error("Unavaliable operation: " + symbols);
return operations[symbols]->getBinary();
}
double Operations::calculation(const std::string& symbols, double a, double b)
{
if (operations.count(symbols) == 0)
throw std::runtime_error("Unavaliable operation: " + symbols);
return operations[symbols]->calculation(a, b);
}