/usr/include/trilinos/RTC_ArrayNumberRTC.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 | #ifndef _ARRAYNUMBERRTC_H
#define _ARRAYNUMBERRTC_H
#include "RTC_ValueRTC.hh"
#include "RTC_commonRTC.hh"
#include <iostream>
#include <cassert>
namespace PG_RuntimeCompiler {
/**
* A Number object represnts the constants in the code the user gives us.
*/
template <class T>
class ArrayNumber: public Value
{
public:
/**
* Constructor -> Trivial
*
* @param type - The type of the number
* @param value - The value of the number
*/
ArrayNumber(Type type, const T* value, int size): Value(type, ArrayNumberOT)
{
assert(size > 0);
assert(value != NULL);
_size = size;
_value = new T[size];
for (int i = 0; i < size; ++i)
_value[i] = value[i];
}
~ArrayNumber() { delete[] _value; }
/**
* getValue -> Returns the value of the number
*/
double getArrayValue(int offset) const {
assert(offset >= 0 && offset < _size);
return (double) _value[offset];
}
/**
* setValue -> Changes the value of the number
*
* @param value - The new value for the number
*/
void setArrayValue(double value, int offset) {
assert(offset >= 0 && offset < _size);
_value[offset] = (T) value;
}
int getSize() const {return _size;}
std::ostream& operator<<(std::ostream& os) const {
os << "ArrayNumber:{";
for (int i = 0; i < _size; ++i)
os << _value[i] << ", ";
os << "}";
return os;
}
protected:
T* _value; //!< The value of this number
int _size;
};
}
#endif
|