// ----------------------------------------------------------------------- // duchamp.hh: Definitions for use with Duchamp // ----------------------------------------------------------------------- // Copyright (C) 2006, Matthew Whiting, ATNF // // This program 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. // // Duchamp 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 Duchamp; if not, write to the Free Software Foundation, // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA // // Correspondence concerning Duchamp may be directed to: // Internet email: Matthew.Whiting [at] atnf.csiro.au // Postal address: Dr. Matthew Whiting // Australia Telescope National Facility, CSIRO // PO Box 76 // Epping NSW 1710 // AUSTRALIA // ----------------------------------------------------------------------- #ifndef DUCHAMP_HH #define DUCHAMP_HH #include #include #include #include // need to undef these in case other packages have them defined. #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef HAVE_PGPLOT #include #ifdef HAVE_PGPLOT #include #endif /// The primary namespace for all functionality directly related to Duchamp namespace duchamp { /// @brief How to convey whether a function has worked enum OUTCOME {SUCCESS=0, FAILURE}; /// Usage message for command line help. const std::string ERR_USAGE_MSG = "Usage: Duchamp [OPTION] [FILE]\n\ Duchamp is an object finder for spectral-line FITS cubes.\n\ \n\ -p FILE Read in parameters from FILE, including FITS image location.\n\ -f FILE Use default parameters with imageFile=FILE\n\ -x Do not use X-windows PGPLOT output\n\ (equivalent to setting flagXOutput=false -- overrides the parameter file)\n\n\ -v Return version number and exit\n\ -h Display this help information and exit\n"; /// Usage message for command line help for Selavy. const std::string SELAVY_ERR_USAGE_MSG = "Usage: Selavy [OPTION] [FILE]\n\ Selavy re-analyses and re-plots objects found by Duchamp.\n\ \n\ -p FILE Read in parameters from FILE, including FITS image location.\n\ -f FILE Use default parameters with imageFile=FILE\n\ -x Do not use X-windows PGPLOT output\n\ (equivalent to setting flagXOutput=false -- overrides the parameter file)\n\n\ -v Return version number and exit\n\ -h Display this help information and exit\n"; /// Shorter Usage message for command line help. const std::string ERR_USAGE_MSG_SHORT="Usage: Duchamp -p [parameter file]\n"; /// The program name. (Duchamp) const std::string PROGNAME = PACKAGE_NAME; /// The program version const std::string VERSION = PACKAGE_VERSION; /// Define the duchamp exception class. class DuchampError: public std::runtime_error { public: /// Constructor taking a message explicit DuchampError(const std::string& message); /// empty destructor virtual ~DuchampError() throw(); }; // Macro to handle warnings, specifying the origin of the warning and taking a streamed input #define DUCHAMPWARN(origin,stream) \ { \ do { \ std::ostringstream oss; \ oss << stream; \ std::cerr << "WARNING <" << origin << "> : " << oss.str()<<"\n"; \ } while(0); \ } // Macro to handle errors, with origin and streamed input. No exception is thrown (use DUCHAMPTHROW instead) #define DUCHAMPERROR(origin,stream) \ { \ do { \ std::ostringstream oss; \ oss << stream; \ std::cerr << "ERROR <" << origin << "> : " << oss.str() << "\n"; \ } while(0); \ } #define DUCHAMPTHROW(origin,stream) \ { \ DUCHAMPERROR(origin,"\a"<