//**************************************************************************** //! \file ocoutput.hpp //! \date 12-07-2003 //! \class oc_eor //! \brief the WOCK end of range Error class //! \class ocOutput //! \brief The Output class of the WOCK //! \class ocTestOutput //! \brief the Test Output class simulating the OC //***************************************************************************** // This file is part of the WOCK. // // The WOCK is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // The WOCK is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with DataView; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //**************************************************************************** #ifndef OCOUTPUT_HPP #define OCOUTPUT_HPP #include #include #include #include #include #include #include using std::cerr; using std::endl; //*************************************************************************** class oc_eor : public std::range_error //---------------------------------------------------------------------------- //! It is intended for use in all ocOutput functions //*************************************************************************** { double ir; public: //! \brief Constructor //! \param description explains what range ist violated (x|y|z|theta|phi|focus) //! \param range shows how much and in which direction the range has been violated oc_eor( const std::string &description, const double range) : range_error( description), ir( range) {}; //! \brief returns the violation range const double range() { return ir;} }; //*************************************************************************** class ocOutput //---------------------------------------------------------------------------- //! Virtual Baseclass for all Input classes for the WOCK //! It does all necessary output communication like e.g. controlling the motors //! of the coupling device //*************************************************************************** { protected: std::map bound; //!< boundaries (symmetric) std::map apos; //!< actual position of the coupler //! \brief transmit the new data to the motors overwrite in your implementation virtual void Execute() = 0; public: ocOutput(); //!< Constructor ~ocOutput(){}; //!< Destructor //! \brief rotate the coupler theta and phi rad //! \param theta rotation angle around x axis //! \param phi rotation angle around y axis //! \warning this function throws an oc_eor exception if min/max angle is reached void rotate( const double theta, const double phi); //! \brief rotate the coupler theta and phi rad //! \param x translation on x axis //! \param y translation on y axis //! \warning this function throws an oc_eor exception if min/max tanslation is reached void translate( const double x, const double y); //! \brief rotate the coupler theta and phi rad //! \param foc the angle the focus nob shall be turned //! \warning this function throws an oc_eor exception if min/max angle is reached void focus( const double foc); }; //*************************************************************************** class ocTestOutput : public ocOutput //---------------------------------------------------------------------------- //! it calculates everything necessary and then sends its data to ocTestInput //*************************************************************************** { int rate; double rad; std::map mpos; //!< position of the photon maximum std::map::iterator posit; //!< iterator for convenient access //! \brief calculates the rate from the position parameters virtual void Execute(); public: ocTestOutput(); //!< Constructor ~ocTestOutput(){}; //!< Destructor const int getRate() const { return rate;}//!< returns the photon counting rate }; #endif