CLHEP/GenericFunctions/Argument.hh
// -*- C++ -*-
// $Id: Argument.hh,v 1.2 2001/05/16 05:10:28 joeb Exp $
#ifndef __ARGUMENT_H_
#define __ARGUMENT_H_
#include "CLHEP/config/CLHEP.h"
#include "CLHEP/config/iostream.h"
#include <vector>
#include <iterator>
#include <algorithm>
// Here is an argument
HEP_BEGIN_NAMESPACE(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:
HepSTL::vector<double> *_data;
friend HepStd::ostream & operator << (HepStd::ostream & o, const Argument & a);
};
inline Argument::Argument(const Argument & right):
_data(new HepSTL::vector<double>(*(right._data))){
}
inline const Argument & Argument::operator=( const Argument & right) {
if (this != &right) {
delete _data;
_data=NULL;
_data = new HepSTL::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 HepSTL::vector<double>(ndim)) {
}
inline Argument::~Argument() {
delete _data;
}
inline HepStd::ostream & operator << (HepStd::ostream & os, const Argument & a) {
HepSTL::ostream_iterator<double> oi(os,",");
HepSTL::copy (a._data->begin(),a._data->end(),oi);
return os;
}
HEP_END_NAMESPACE(Genfun)
#endif
Generated by GNU enscript 1.6.1.