GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GBase.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GBase.cpp - GammaLib base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2012-2013 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GBase.cpp
23  * @brief Implementation of interface for all GammaLib classes
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GBase.hpp"
32 #include "GLog.hpp"
33 
34 /* __ Method name definitions ____________________________________________ */
35 
36 /* __ Macros _____________________________________________________________ */
37 
38 /* __ Coding definitions _________________________________________________ */
39 
40 /* __ Debug definitions __________________________________________________ */
41 
42 
43 /*==========================================================================
44  = =
45  = Friends =
46  = =
47  ==========================================================================*/
48 
49 /***********************************************************************//**
50  * @brief Output operator
51  *
52  * @param[in] os Output stream.
53  * @param[in] base Object.
54  *
55  * Put @p base object into output stream.
56  ***************************************************************************/
57 std::ostream& operator<<(std::ostream& os, const GBase& base)
58 {
59  // Write class in output stream
60  os << base.print();
61 
62  // Return output stream
63  return os;
64 }
65 
66 
67 /***********************************************************************//**
68  * @brief Log operator
69  *
70  * @param[in] log Logger.
71  * @param[in] base Object.
72  *
73  * Put @p base object into logger. The chattiness of the @p base object is
74  * controlled by the chatter() attribute of the @p log logger.
75  ***************************************************************************/
76 GLog& operator<<(GLog& log, const GBase& base)
77 {
78  // Write class into logger
79  log << base.print(log.chatter());
80 
81  // Return logger
82  return log;
83 }
84 
void chatter(const GChatter &chatter)
Set chattiness.
Definition: GLog.hpp:366
Definition of interface for all GammaLib classes.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
Information logger interface definition.
Definition: GLog.hpp:62
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
Definition: GVector.cpp:1274
std::ostream & operator<<(std::ostream &os, const GBase &base)
Output operator.
Definition: GBase.cpp:57
Information logger class definition.