summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dot.cpp37
-rw-r--r--src/dot.h4
-rw-r--r--src/dotgraph.cpp8
-rw-r--r--src/dotlegendgraph.cpp2
-rw-r--r--src/dotrunner.cpp1
5 files changed, 26 insertions, 26 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 2e07a78..acf4db9 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -83,9 +83,8 @@ DotManager *DotManager::instance()
return m_theInstance;
}
-DotManager::DotManager() : m_runners(), m_filePatchers(1009)
+DotManager::DotManager() : m_runners(), m_filePatchers()
{
- m_filePatchers.setAutoDelete(TRUE);
m_queue = new DotRunnerQueue;
int i;
int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
@@ -130,25 +129,27 @@ DotRunner* DotManager::createRunner(const std::string &absDotName, const std::st
{
err("md5 hash does not match for two different runs of %s !\n", absDotName.data());
}
+ rv = runit->second.get();
}
+ assert(rv);
return rv;
}
-DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName)
+DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName)
{
- DotFilePatcher *patcher = m_filePatchers.find(fileName);
- if (patcher==0)
- {
- patcher = new DotFilePatcher(fileName);
- m_filePatchers.append(fileName,patcher);
- }
- return patcher;
+ auto patcher = m_filePatchers.find(fileName);
+
+ if (patcher != m_filePatchers.end()) return &(patcher->second);
+
+ auto rv = m_filePatchers.emplace(fileName, fileName.c_str());
+ assert(rv.second);
+ return &(rv.first->second);
}
bool DotManager::run() const
{
uint numDotRuns = m_runners.size();
- uint numFilePatchers = m_filePatchers.count();
+ uint numFilePatchers = m_filePatchers.size();
if (numDotRuns+numFilePatchers>1)
{
if (m_workers.count()==0)
@@ -236,27 +237,25 @@ bool DotManager::run() const
// patch the output file and insert the maps and figures
i=1;
- SDict<DotFilePatcher>::Iterator di(m_filePatchers);
- const DotFilePatcher *fp;
// since patching the svg files may involve patching the header of the SVG
// (for zoomable SVGs), and patching the .html files requires reading that
// header after the SVG is patched, we first process the .svg files and
// then the other files.
- for (di.toFirst();(fp=di.current());++di)
+ for (auto & fp : m_filePatchers)
{
- if (fp->isSVGFile())
+ if (fp.second.isSVGFile())
{
msg("Patching output file %d/%d\n",i,numFilePatchers);
- if (!fp->run()) return FALSE;
+ if (!fp.second.run()) return FALSE;
i++;
}
}
- for (di.toFirst();(fp=di.current());++di)
+ for (auto& fp : m_filePatchers)
{
- if (!fp->isSVGFile())
+ if (!fp.second.isSVGFile())
{
msg("Patching output file %d/%d\n",i,numFilePatchers);
- if (!fp->run()) return FALSE;
+ if (!fp.second.run()) return FALSE;
i++;
}
}
diff --git a/src/dot.h b/src/dot.h
index 8f36f30..3c9af66 100644
--- a/src/dot.h
+++ b/src/dot.h
@@ -36,7 +36,7 @@ class DotManager
public:
static DotManager *instance();
DotRunner* createRunner(const std::string& absDotName, const std::string& md5Hash);
- DotFilePatcher *createFilePatcher(const QCString &fileName);
+ DotFilePatcher *createFilePatcher(const std::string &fileName);
bool run() const;
private:
@@ -44,7 +44,7 @@ class DotManager
virtual ~DotManager();
std::map<std::string, std::unique_ptr<DotRunner>> m_runners;
- SDict<DotFilePatcher> m_filePatchers;
+ std::map<std::string, DotFilePatcher> m_filePatchers;
static DotManager *m_theInstance;
DotRunnerQueue *m_queue;
QList<DotWorkerThread> m_workers;
diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp
index cdf4f6c..e622dd4 100644
--- a/src/dotgraph.cpp
+++ b/src/dotgraph.cpp
@@ -233,11 +233,11 @@ void DotGraph::generateCode(FTextStream &t)
if (m_regenerate)
{
DotManager::instance()->
- createFilePatcher(absImgName())->
+ createFilePatcher(absImgName().data())->
addSVGConversion(m_relPath,FALSE,QCString(),m_zoomable,m_graphId);
}
int mapId = DotManager::instance()->
- createFilePatcher(m_fileName)->
+ createFilePatcher(m_fileName.data())->
addSVGObject(m_baseName,absImgName(),m_relPath);
t << "<!-- SVG " << mapId << " -->" << endl;
}
@@ -252,7 +252,7 @@ void DotGraph::generateCode(FTextStream &t)
if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, getMapLabel()))
{
int mapId = DotManager::instance()->
- createFilePatcher(m_fileName)->
+ createFilePatcher(m_fileName.data())->
addMap(absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel());
t << "<!-- MAP " << mapId << " -->" << endl;
}
@@ -263,7 +263,7 @@ void DotGraph::generateCode(FTextStream &t)
if (m_regenerate || !DotFilePatcher::writeVecGfxFigure(t,m_baseName,absBaseName()))
{
int figId = DotManager::instance()->
- createFilePatcher(m_fileName)->
+ createFilePatcher(m_fileName.data())->
addFigure(m_baseName,absBaseName(),FALSE /*TRUE*/);
t << endl << "% FIG " << figId << endl;
}
diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp
index 98e1f88..b17a293 100644
--- a/src/dotlegendgraph.cpp
+++ b/src/dotlegendgraph.cpp
@@ -29,7 +29,7 @@ void DotLegendGraph::writeGraph(const char *path)
if (getDotImageExtension()=="svg")
{
DotManager::instance()->
- createFilePatcher(absBaseName()+Config_getString(HTML_FILE_EXTENSION))->
+ createFilePatcher((absBaseName()+Config_getString(HTML_FILE_EXTENSION)).data())->
addSVGObject("graph_legend", absImgName(),QCString());
}
}
diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp
index 90cc5eb..db69b30 100644
--- a/src/dotrunner.cpp
+++ b/src/dotrunner.cpp
@@ -151,6 +151,7 @@ DotRunner::DotRunner(const std::string& absDotName, const std::string& md5Hash)
, m_md5Hash(md5Hash.data())
, m_dotExe(Config_getString(DOT_PATH)+"dot")
, m_cleanUp(Config_getBool(DOT_CLEANUP))
+ , m_jobs()
{
}