1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2019 by Dimitri van Heesch.
4  *
5  * Permission to use, copy, modify, and distribute this software and its
6  * documentation under the terms of the GNU General Public License is hereby
7  * granted. No representations are made about the suitability of this software
8  * for any purpose. It is provided "as is" without express or implied warranty.
9  * See the GNU General Public License for more details.
10  *
11  * Documents produced by Doxygen are derivative works derived from the
12  * input used in their production; they are not affected by this license.
13  *
14  */
15 
16 #ifndef DOT_H
17 #define DOT_H
18 
19 #include <map>
20 
21 #include "qcstring.h"
22 #include "dotgraph.h" // only for GraphOutputFormat
23 #include "dotfilepatcher.h"
24 #include "dotrunner.h"
25 
26 class DotRunner;
27 class DotRunnerQueue;
28 class TextStream;
29 
30 /** Singleton that manages parallel dot invocations and patching files for embedding image maps */
31 class DotManager
32 {
33   public:
34     static DotManager *instance();
35     static void deleteInstance();
36     DotRunner*      createRunner(const QCString& absDotName, const QCString& md5Hash);
37     DotFilePatcher *createFilePatcher(const QCString &fileName);
38     bool run() const;
39 
40   private:
41     DotManager();
42     virtual ~DotManager();
43 
44     std::map<std::string, std::unique_ptr<DotRunner>>       m_runners;
45     std::map<std::string, DotFilePatcher>  m_filePatchers;
46     static DotManager     *m_theInstance;
47     DotRunnerQueue        *m_queue;
48     std::vector< std::unique_ptr<DotWorkerThread> > m_workers;
49 };
50 
51 void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir,
52                            const QCString &outFile,GraphOutputFormat format,
53                            const QCString &srcFile,int srcLine);
54 void writeDotImageMapFromFile(TextStream &t,
55                               const QCString &inFile, const QCString& outDir,
56                               const QCString &relPath,const QCString& baseName,
57                               const QCString &context,int graphId,
58                               const QCString &srcFile,int srcLine);
59 
60 #endif
61