/usr/include/ThePEG/Utilities/EnumIO.h is in libthepeg-dev 1.8.0-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 88 89 90 91 92 93 94 95 96 | // -*- C++ -*-
//
// EnumIO.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_EnumIO_H
#define ThePEG_EnumIO_H
// This is the declaration of the IEnum and OEnum classes and
// associated templated functions.
// #include "ThePEG/Config/ThePEG.h"
// #include "EnumIO.fh"
// #include "EnumIO.xh"
namespace ThePEG {
template <typename T>
/**
* The <code>OEnum</code> helper class is used to facilitate output of enums
* to persistent streams. An enum can hence be written like this:<BR>
* <code>os >> oenum(x);</code><BR>
*
* @see PersistentOStream
* @see PersistentIStream
*
*/
struct OEnum {
/** Constructor. */
OEnum(const T & t): theT(t) {}
/** Copy constructor. */
OEnum(const OEnum & oe): theT(oe.theT) {}
/** The variable to be written */
const T & theT;
};
/**
* The <code>IEnum</code> helper class is used to facilitate input of enums
* from persistent streams. An enum can hence be read like this:<BR>
* <code>is >> ienum(x);</code>
*
* @see PersistentOStream
* @see PersistentIStream
*
*/
template <typename T>
struct IEnum {
/** Constructor. */
IEnum(T & t): theT(t) {}
/** Copy constructor. */
IEnum(const IEnum & ie): theT(ie.theT) {}
/** The variable to be read */
T & theT;
};
/** Helper function to create an OEnum object for a given variable. */
template <typename T>
inline OEnum<T> oenum(const T & t) {
return OEnum<T>(t);
}
/** Helper function to create an IEnum object for a given variable. */
template <typename T>
inline IEnum<T> ienum(T & t) {
return IEnum<T>(t);
}
/** Overloading of operator<< for OEnum. */
template <typename OStream, typename T>
OStream & operator<<(OStream & os, const OEnum<T> & e) {
os << long(e.theT);
return os;
}
/** Overloading of operator<< for IEnum. */
template <typename IStream, typename T>
IStream & operator>>(IStream & is, const IEnum<T> & e) {
long l = 0;
is >> l;
e.theT = T(l);
return is;
}
}
#endif /* ThePEG_EnumIO_H */
|