/usr/include/trilinos/RTC_RegistrarRTC.hh is in libtrilinos-pamgen-dev 12.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | #ifndef _REGISTRAR_H
#define _REGISTRAR_H
#include "RTC_ValueRTC.hh"
#include "RTC_ObjectRTC.hh"
#include "RTC_LineRTC.hh"
#include <map>
#include <list>
#include <string>
#include <iostream>
#include <cassert>
namespace PG_RuntimeCompiler {
/**
* RTBoundFunc is the class all callable function classes must inherit from.
*/
class RTBoundFunc
{
public:
RTBoundFunc(const std::string& name_, int args, bool is_Optimizable = true,
bool variable_NumArgs = false) {
_name = name_;
_numArgs = args;
_isOptimizable = is_Optimizable;
_variableNumArgs = variable_NumArgs;
}
virtual ~RTBoundFunc() {}
virtual double execute(Value**) = 0;
bool isOptimizable() const {return _isOptimizable;}
bool variableNumArgs() const {return _variableNumArgs;}
std::string name() const {return _name;}
int numArgs() const {return _numArgs;}
void numArgs(int args) {
assert(_variableNumArgs);
_numArgs = args;
}
protected:
std::string _name;
int _numArgs; //! In the case of variableNumArgs, this is a minimum
bool _isOptimizable;
bool _variableNumArgs;
};
/**
* This class is the super class for all function calls.
*/
class FunctionCall : public Object
{
public:
FunctionCall() : Object(FunctionOT) {}
virtual ~FunctionCall() {}
virtual double execute() = 0;
virtual void fillArg(Line* l) = 0;
virtual bool canGoEarly() const = 0;
bool hasVariableArgs() const {return _func->variableNumArgs();}
unsigned getNumArgs() const { return _func->numArgs(); }
protected:
RTBoundFunc* _func;
};
/**
* The FixedArgFunctionCall class represents individual function calls in the
* user's code. This class is for functions with a fixed number of arguments.
*/
class FixedArgFunctionCall : public FunctionCall
{
public:
FixedArgFunctionCall(RTBoundFunc* rt);
~FixedArgFunctionCall();
std::ostream& operator<<(std::ostream& os) const;
double execute();
void fillArg(Line* l);
bool canGoEarly() const;
protected:
int _argIndex;
Line** _argExpressions;
Value** _argValues;
};
/**
* The VariableArgFunctionCall class represents individual function calls
* in the user's code. This class is for functions that can have a variable
* number of arguments, like printf.
*/
class VariableArgFunctionCall : public FunctionCall
{
public:
VariableArgFunctionCall(RTBoundFunc* rt);
~VariableArgFunctionCall();
std::ostream& operator<<(std::ostream& os) const;
double execute();
void fillArg(Line* l);
bool canGoEarly() const;
private:
std::list<Line*> _argExpressionList;
Value** _argValues;
};
/**
* Registrar is used to contain all the registered functions that can be called
* by users.
*/
class Registrar
{
private:
static std::map<std::string,RTBoundFunc*> FUNCTIONS;
static bool ISINIT;
public:
static void registerFunction(RTBoundFunc*);
static RTBoundFunc* findByName(const std::string& );
static void setupStandardFunctions();
static FunctionCall* generateCall(const std::string &);
};
class Fabs : public RTBoundFunc
{
public:
Fabs() : RTBoundFunc("fabs", 1) {}
double execute(Value**);
};
class Sin : public RTBoundFunc
{
public:
Sin() : RTBoundFunc("sin", 1) {}
double execute(Value**);
};
class Tan : public RTBoundFunc
{
public:
Tan() : RTBoundFunc("tan", 1) {}
double execute(Value**);
};
class Cos : public RTBoundFunc
{
public:
Cos() : RTBoundFunc("cos", 1) {}
double execute(Value**);
};
class Sqrt : public RTBoundFunc
{
public:
Sqrt() : RTBoundFunc("sqrt", 1) {}
double execute(Value**);
};
class Tanh : public RTBoundFunc
{
public:
Tanh() : RTBoundFunc("tanh", 1) {}
double execute(Value**);
};
class Sinh : public RTBoundFunc
{
public:
Sinh() : RTBoundFunc("sinh", 1) {}
double execute(Value**);
};
class Cosh : public RTBoundFunc
{
public:
Cosh() : RTBoundFunc("cosh", 1) {}
double execute(Value**);
};
class Log : public RTBoundFunc
{
public:
Log() : RTBoundFunc("log", 1) {}
double execute(Value**);
};
class Log10 : public RTBoundFunc
{
public:
Log10() : RTBoundFunc("log10", 1) {}
double execute(Value**);
};
class Exp : public RTBoundFunc
{
public:
Exp() : RTBoundFunc("exp", 1) {}
double execute(Value**);
};
class Atan : public RTBoundFunc
{
public:
Atan() : RTBoundFunc("atan", 1) {}
double execute(Value**);
};
class Atantwo : public RTBoundFunc
{
public:
Atantwo() : RTBoundFunc("atan2", 2) {}
double execute(Value**);
};
class Asin : public RTBoundFunc
{
public:
Asin() : RTBoundFunc("asin", 1) {}
double execute(Value**);
};
class Acos : public RTBoundFunc
{
public:
Acos() : RTBoundFunc("acos", 1) {}
double execute(Value**);
};
class Pow : public RTBoundFunc
{
public:
Pow() : RTBoundFunc("pow", 2) {}
double execute(Value**);
};
class Rand : public RTBoundFunc
{
public:
Rand() : RTBoundFunc("rand", 0, false) {}
double execute(Value**);
};
class DRand : public RTBoundFunc
{
public:
DRand() : RTBoundFunc("drand", 0, false) {}
double execute(Value**);
};
class Gamma : public RTBoundFunc
{
public:
Gamma() : RTBoundFunc("gamma", 1) {}
double execute(Value**);
};
class Print : public RTBoundFunc
{
public:
Print() : RTBoundFunc("print", 1, false) {}
double execute(Value**);
};
class Printf : public RTBoundFunc
{
public:
Printf() : RTBoundFunc("printf", 1, false, true) {}
double execute(Value**);
};
class Tester : public RTBoundFunc
{
public:
Tester() : RTBoundFunc("arrayFill", 2) {}
double execute(Value**);
};
class Bessel_J0 : public RTBoundFunc
{
public:
Bessel_J0() : RTBoundFunc("j0", 1) {}
double execute(Value**);
};
class Bessel_J1 : public RTBoundFunc
{
public:
Bessel_J1() : RTBoundFunc("j1", 1) {}
double execute(Value**);
};
class Bessel_I0 : public RTBoundFunc
{
public:
Bessel_I0() : RTBoundFunc("i0", 1) {}
double execute(Value**);
};
class Bessel_I1 : public RTBoundFunc
{
public:
Bessel_I1() : RTBoundFunc("i1", 1) {}
double execute(Value**);
};
class Erf : public RTBoundFunc
{
public:
Erf() : RTBoundFunc("erf", 1) {}
double execute(Value**);
};
class Erfc : public RTBoundFunc
{
public:
Erfc() : RTBoundFunc("erfc", 1) {}
double execute(Value**);
};
class GeneralizedCompleteEllipticIntegral : public RTBoundFunc
{
public:
GeneralizedCompleteEllipticIntegral () : RTBoundFunc("gcei", 4) {}
double execute(Value**);
};
}
#endif
|