| 143 | } |
| 144 | |
| 145 | void CustomFunctionLibrary::RegisterMathFunctions() |
| 146 | { |
| 147 | auto & functionMgr = osiris_.GetCustomFunctionManager(); |
| 148 | |
| 149 | auto randomReal = std::make_unique<CustomQuery>( |
| 150 | "NRD_RandomReal", |
| 151 | std::vector<CustomFunctionParam>{ |
| 152 | { "Min", ValueType::Real, FunctionArgumentDirection::In }, |
| 153 | { "Max", ValueType::Real, FunctionArgumentDirection::In }, |
| 154 | { "Result", ValueType::Real, FunctionArgumentDirection::Out }, |
| 155 | }, |
| 156 | &func::RandomReal |
| 157 | ); |
| 158 | functionMgr.Register(std::move(randomReal)); |
| 159 | |
| 160 | auto factorial = std::make_unique<CustomQuery>( |
| 161 | "NRD_Factorial", |
| 162 | std::vector<CustomFunctionParam>{ |
| 163 | { "In", ValueType::Integer, FunctionArgumentDirection::In }, |
| 164 | { "Out", ValueType::Integer, FunctionArgumentDirection::Out }, |
| 165 | }, |
| 166 | &func::Factorial |
| 167 | ); |
| 168 | functionMgr.Register(std::move(factorial)); |
| 169 | |
| 170 | auto pow = std::make_unique<CustomQuery>( |
| 171 | "NRD_Pow", |
| 172 | std::vector<CustomFunctionParam>{ |
| 173 | { "Base", ValueType::Real, FunctionArgumentDirection::In }, |
| 174 | { "Exp", ValueType::Integer, FunctionArgumentDirection::In }, |
| 175 | { "Out", ValueType::Real, FunctionArgumentDirection::Out }, |
| 176 | }, |
| 177 | &func::Pow |
| 178 | ); |
| 179 | functionMgr.Register(std::move(pow)); |
| 180 | |
| 181 | MATH_QUERY1(Sin) |
| 182 | MATH_QUERY1(Cos) |
| 183 | MATH_QUERY1(Tan) |
| 184 | MATH_QUERY1(Round) |
| 185 | MATH_QUERY1(Ceil) |
| 186 | MATH_QUERY1(Floor) |
| 187 | MATH_QUERY1(Abs) |
| 188 | MATH_QUERY1(Sqrt) |
| 189 | MATH_QUERY1(Exp) |
| 190 | MATH_QUERY1(Log) |
| 191 | |
| 192 | auto isDivisible = std::make_unique<CustomQuery>( |
| 193 | "NRD_IsDivisible", |
| 194 | std::vector<CustomFunctionParam>{ |
| 195 | { "Numerator", ValueType::Integer, FunctionArgumentDirection::In }, |
| 196 | { "Denominator", ValueType::Integer, FunctionArgumentDirection::In }, |
| 197 | { "Divisible", ValueType::Integer, FunctionArgumentDirection::Out }, |
| 198 | }, |
| 199 | &func::IsDivisible |
| 200 | ); |
| 201 | functionMgr.Register(std::move(isDivisible)); |
| 202 | } |