Horizon
pns_logger.h
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2014 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __PNS_LOGGER_H
23 #define __PNS_LOGGER_H
24 
25 #include <cstdio>
26 #include <vector>
27 #include <string>
28 #include <sstream>
29 
30 #include <math/vector2d.h>
31 
32 class SHAPE_LINE_CHAIN;
33 class SHAPE;
34 
35 namespace PNS {
36 
37 class ITEM;
38 
39 class LOGGER
40 {
41 public:
42  LOGGER();
43  ~LOGGER();
44 
45  void Save( const std::string& aFilename );
46  void Clear();
47 
48  void NewGroup( const std::string& aName, int aIter = 0 );
49  void EndGroup();
50 
51  void Log( const ITEM* aItem, int aKind = 0, const std::string& aName = std::string() );
52  void Log( const SHAPE_LINE_CHAIN *aL, int aKind = 0, const std::string& aName = std::string() );
53  void Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aKind = 0,
54  const std::string& aName = std::string() );
55 
56 private:
57  void dumpShape( const SHAPE* aSh );
58 
59  bool m_groupOpened;
60  std::stringstream m_theLog;
61 };
62 
63 }
64 
65 #endif
Class ITEM.
Definition: pns_item.h:55
Definition: pns_logger.h:40
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:50
Class SHAPE.
Definition: shape.h:59