# Hurricane VLSI Database

JsonReader.h
1 // -*- C++ -*-
2 //
3 // Copyright (c) BULL S.A. 2015-2018, All Rights Reserved
4 //
5 // This file is part of Hurricane.
6 //
7 // Hurricane is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
14 // TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the Lesser GNU General Public
18 // License along with Hurricane. If not, see
19 // <http://www.gnu.org/licenses/>.
20 //
21 // +-----------------------------------------------------------------+
22 // | H U R R I C A N E |
23 // | V L S I B a c k e n d D a t a - B a s e |
24 // | |
25 // | Author : Jean-Paul Chaput |
26 // | E-mail : Jean-Paul.Chaput@lip6.fr |
27 // | =============================================================== |
28 // | C++ Header : "./hurricane/JsonReader.h" |
29 // +-----------------------------------------------------------------+
30
31
32 #ifndef HURRICANE_JSON_READER_H
33 #define HURRICANE_JSON_READER_H
34
35 #include <stdio.h>
36 #include <string>
37 #include "rapidjson/filereadstream.h"
38 #include "rapidjson/reader.h"
39 #include "hurricane/Commons.h"
40 #include "hurricane/FileReadGzStream.h"
41
42
43 namespace Hurricane {
44
45 using rapidjson::Reader;
46 class HurricaneHandler;
47
48
49 // -------------------------------------------------------------------
50 // Class : "JsonReader".
51
52 class JsonReader {
53 public:
54 JsonReader ( unsigned long flags );
55 ~JsonReader ();
56 inline JsonReader* setFlags ( unsigned long mask );
57 inline JsonReader* resetFlags ( unsigned long mask );
58 inline bool issetFlags ( unsigned long mask ) const;
59 inline unsigned long getFlags () const;
60 inline JsonStack& getStack ();
61 void parse ( std::string fileName );
62 void close ();
63 private:
64 JsonReader ( const JsonReader& );
65 JsonReader& operator= ( const JsonReader& ) const;
66 private:
67 size_t _bufferSize;
68 char* _buffer;
69 FILE* _file;
70 FileReadGzStream* _stream;
71 JsonStack _stack;
72 Reader _reader;
73 HurricaneHandler* _handler;
74 };
75
76
77 inline JsonReader* JsonReader::setFlags ( unsigned long mask ) { _stack.setFlags(mask); return this; }
78 inline JsonReader* JsonReader::resetFlags ( unsigned long mask ) { _stack.resetFlags(mask); return this; }
79 inline bool JsonReader::issetFlags ( unsigned long mask ) const { return _stack.issetFlags(mask); }
80 inline unsigned long JsonReader::getFlags () const { return _stack.getFlags(); }
81 inline JsonStack& JsonReader::getStack () { return _stack; }
82
83
84 } // Hurricane namespace.
85
86 #endif // HURRICANE_JSON_READER_H
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5

Generated by doxygen 1.8.14 on Sun Mar 8 2020 | Return to top of page

Hurricane VLSI Database | Copyright © 2000-2016 Bull S.A. All rights reserved