/usr/include/trilinos/RTC_ScalarVarRTC.hh is in libtrilinos-pamgen-dev 12.10.1-3.
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 | #ifndef _SCALARVAR_HH
#define _SCALARVAR_HH
#include "RTC_commonRTC.hh"
#include "RTC_ValueRTC.hh"
#include <cassert>
#include <string>
#include <iostream>
namespace PG_RuntimeCompiler {
/**
* ScalarVar object will represent plain, non-array variables
*/
template <class T>
class ScalarVar : public Variable
{
private:
T _value; //!< The value contained by the variable
public:
/**
* Constructor -> Trivial
*
* @param name - The name of the variable
* @param value - The initial value of the variable (optional)
*/
ScalarVar(const std::string& name, T value = 0)
: Variable(name, TypeToTypeT<T>::value, ScalarVarOT)
{
_value = value;
}
std::ostream& operator<<(std::ostream& os) const {
os << _value;
return os;
}
/**
* setValue -> Changes the value of a variable.
*
* @param value - The variable's new value
*/
void setValue(double value) {
_value = (T) value;
if (_address != NULL)
*((T*)_address) = _value;
}
/**
* setAddress -> Sets the addres of the variable. Used by varAddrFill method.
*
* @param addr - The variable's new address
*/
void setAddress(void* addr) {
_address = addr;
_value = *((T*)_address);
}
/**
* getValue -> Returns the value of the variable
*/
double getValue() {
//if we are dealing with a reference, it might need to refresh itself
if (_address != NULL)
_value = *((T*)_address);
return (double) _value;
}
};
}
#endif
|