#ifndef __JDETECTOR__JMODULEADDRESS__ #define __JDETECTOR__JMODULEADDRESS__ #include #include #include "JLang/JEquals.hh" /** * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { using JLANG::JEquals; /** * Address of module in detector data structure. * * The address of a module consists of a single integer value JModuleAddress::first * which refers to the index of the module in the detector data structure. * * This class implements the JLANG::JEquals interface. */ class JModuleAddress : public JEquals { public: /** * Default constructor. */ JModuleAddress() : first(-1) {} /** * Constructor. * * \param index index */ explicit JModuleAddress(const int index) : first(index) {} /** * Equal method. * * \param address module address * \result true if this module address equal to given module address; else false */ inline bool equals(const JModuleAddress& address) const { return this->first == address.first; } /** * Read module address from input. * * \param in input stream * \param object module address * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JModuleAddress& object) { return in >> object.first; } /** * Write module address to output. * * \param out output stream * \param object module address * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JModuleAddress& object) { return out << object.first; } int first; //!< index of module in detector data structure }; } #endif