#include "functionsignature.h" namespace domain { FunctionSignature add(std::string name, std::vector types, FunctionCallback callback) { return {name, types, callback}; } std::vector getSupportedFunctions() { std::vector s; s.push_back(add("divisible", std::vector{Value::INT, Value::INT},[](std::vector values) { long long first = values[0].asInt(); long long second = values[1].asInt(); return (first % second) == 0; })); s.push_back(add("less_then", std::vector{Value::INT, Value::INT}, [](std::vector values) { long long first = values[0].asInt(); long long second = values[1].asInt(); return first < second; })); s.push_back(add("greater_then", std::vector{Value::INT, Value::INT}, [](std::vector values) { long long first = values[0].asInt(); long long second = values[1].asInt(); return first > second; })); s.push_back(add("contains_address", std::vector{Value::ADDRESS_SPACE, Value::INT}, [](std::vector values) { AddressSpace space = values[0].asAddressSpace(); long long address = values[1].asInt(); return space.contains(address); })); s.push_back(add("contains", std::vector{Value::ADDRESS_SPACE, Value::INT, Value::INT}, [](std::vector values) { AddressSpace space = values[0].asAddressSpace(); long long start = values[1].asInt(); long long size = values[1].asInt(); return space.contains(start, start + size); })); s.push_back(add("unique", std::vector{Value::ADDRESS_SPACE, Value::INT, Value::INT}, [](std::vector values) { return true; })); return s; } } // namespace domain