2016-02-25 12:07:21 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: programs/Hadrons/Global.hpp
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Antonin Portelli <antonin.portelli@me.com>
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution
|
|
|
|
directory.
|
|
|
|
*******************************************************************************/
|
2015-10-27 17:33:18 +00:00
|
|
|
|
|
|
|
#ifndef Hadrons_Global_hpp_
|
|
|
|
#define Hadrons_Global_hpp_
|
|
|
|
|
|
|
|
#include <Grid.h>
|
2015-11-05 14:28:14 +00:00
|
|
|
#include <set>
|
2015-12-02 19:33:34 +00:00
|
|
|
#include <stack>
|
2015-10-27 17:33:18 +00:00
|
|
|
|
|
|
|
#define BEGIN_HADRONS_NAMESPACE \
|
|
|
|
namespace Hadrons {\
|
2016-01-14 04:23:51 +00:00
|
|
|
using namespace Grid;\
|
|
|
|
using namespace QCD;
|
2015-10-27 17:33:18 +00:00
|
|
|
#define END_HADRONS_NAMESPACE }
|
|
|
|
|
|
|
|
BEGIN_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
class HadronsLogger: public Logger
|
|
|
|
{
|
|
|
|
public:
|
2016-02-23 16:21:45 +00:00
|
|
|
HadronsLogger(int on, std::string nm): Logger("Hadrons", on, nm,
|
|
|
|
Logger::BLACK){};
|
2015-10-27 17:33:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LOG(channel) std::cout << HadronsLog##channel
|
2015-11-05 14:28:14 +00:00
|
|
|
#define HADRON_ERROR(msg)\
|
2016-04-30 08:17:04 +01:00
|
|
|
LOG(Error) << msg << " (" << __FUNCTION__ << " at " << __FILE__ << ":"\
|
|
|
|
<< __LINE__ << ")" << std::endl;\
|
2015-11-05 14:28:14 +00:00
|
|
|
abort();
|
|
|
|
|
|
|
|
#define DEBUG_VAR(var) LOG(Debug) << #var << "= " << (var) << std::endl;
|
2015-10-27 17:33:18 +00:00
|
|
|
|
|
|
|
extern HadronsLogger HadronsLogError;
|
|
|
|
extern HadronsLogger HadronsLogWarning;
|
|
|
|
extern HadronsLogger HadronsLogMessage;
|
|
|
|
extern HadronsLogger HadronsLogDebug;
|
|
|
|
|
2015-12-23 14:21:35 +00:00
|
|
|
// singleton pattern
|
|
|
|
#define SINGLETON(name)\
|
|
|
|
public:\
|
|
|
|
name(const name &e) = delete;\
|
|
|
|
void operator=(const name &e) = delete;\
|
|
|
|
static name & getInstance(void)\
|
|
|
|
{\
|
|
|
|
static name e;\
|
|
|
|
return e;\
|
|
|
|
}\
|
|
|
|
private:\
|
|
|
|
name(void);
|
|
|
|
|
2016-04-30 08:17:04 +01:00
|
|
|
#define SINGLETON_DEFCTOR(name)\
|
|
|
|
public:\
|
|
|
|
name(const name &e) = delete;\
|
|
|
|
void operator=(const name &e) = delete;\
|
|
|
|
static name & getInstance(void)\
|
|
|
|
{\
|
|
|
|
static name e;\
|
|
|
|
return e;\
|
|
|
|
}\
|
|
|
|
private:\
|
|
|
|
name(void) = default;
|
|
|
|
|
2015-10-27 17:33:18 +00:00
|
|
|
END_HADRONS_NAMESPACE
|
|
|
|
|
|
|
|
#endif // Hadrons_Global_hpp_
|