/usr/include/CLHEP/GenericFunctions/Argument.hh is in libclhep-dev 2.1.4.1-1.1.
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 | // -*- C++ -*-
// $Id: Argument.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
#ifndef __ARGUMENT_H_
#define __ARGUMENT_H_
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
// Here is an argument
namespace Genfun {
/**
* @author
* @ingroup genfun
*/
class Argument {
public:
// Constructor
Argument(int ndim=0);
// Copy Constructor
Argument( const Argument &);
// Assignment operator
const Argument & operator=(const Argument &);
// Destructor:
~Argument();
// Set/Get Value
double & operator[] (int I);
const double & operator[] (int i) const;
// Get the dimensions
unsigned int dimension() const;
private:
std::vector<double> *_data;
friend std::ostream & operator << (std::ostream & o, const Argument & a);
};
inline Argument::Argument(const Argument & right):
_data(new std::vector<double>(*(right._data))){
}
inline const Argument & Argument::operator=( const Argument & right) {
if (this != &right) {
delete _data;
_data=NULL;
_data = new std::vector<double>(*(right._data));
}
return *this;
}
inline unsigned int Argument::dimension() const {
return _data->size();
}
inline double & Argument::operator[] (int i) {
return (*_data)[i];
}
inline const double & Argument::operator[] (int i) const {
return (*_data)[i];
}
inline Argument::Argument(int ndim): _data(new std::vector<double>(ndim)) {
}
inline Argument::~Argument() {
delete _data;
}
inline std::ostream & operator << (std::ostream & os, const Argument & a) {
std::ostream_iterator<double> oi(os,",");
std::copy (a._data->begin(),a._data->end(),oi);
return os;
}
} // namespace Genfun
#endif
|