summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-28 14:24:04 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-28 14:24:04 +0100
commit1a7b43c875227527bf180066354f6c3d6515d5cb (patch)
tree7d9364adb554b2bd5f1ea5701be82923e04e0793
parentFix throw in destructors (diff)
downloadproject2-1.3.0.tar.bz2
project2-1.3.0.tar.xz
project2-1.3.0.zip
C++17 and Ice 3.7project2-1.3.0
Updates all code to work with C++17 and Ice 3.7 and related updates in used libraries.
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules4
-rw-r--r--Jamroot.jam18
m---------ice0
-rw-r--r--project2/Jamfile.jam1
-rw-r--r--project2/basics/caches/memoryCache.cpp12
-rw-r--r--project2/basics/if.cpp6
-rw-r--r--project2/basics/options/showHelp.cpp4
-rw-r--r--project2/basics/options/showHelp.h2
-rw-r--r--project2/basics/tasks/iterate.cpp2
-rw-r--r--project2/basics/tasks/iterate.h2
-rw-r--r--project2/basics/tasks/structExceptHandling.cpp6
-rw-r--r--project2/basics/tests/compoundTest.cpp4
-rw-r--r--project2/basics/unittests/Jamfile.jam5
-rw-r--r--project2/basics/unittests/testLibraries.cpp7
-rw-r--r--project2/basics/unittests/testViews.cpp6
-rw-r--r--project2/basics/views/autotree.cpp2
-rw-r--r--project2/basics/views/autotree.h7
-rw-r--r--project2/basics/views/flatView.cpp2
-rw-r--r--project2/basics/views/flatView.h2
-rw-r--r--project2/basics/views/rowView.cpp6
-rw-r--r--project2/basics/views/singleton.cpp2
-rw-r--r--project2/basics/views/viewGroup.cpp2
-rw-r--r--project2/cgi/cgiAppEngine.cpp26
-rw-r--r--project2/cgi/cgiAppEngine.h13
-rw-r--r--project2/cgi/cgiContentNegotiate.cpp8
-rw-r--r--project2/cgi/cgiOutputOptions.cpp2
-rw-r--r--project2/cgi/cgiOutputOptions.h7
-rw-r--r--project2/cgi/cgiProgRouter.cpp18
-rw-r--r--project2/cgi/cgiRouter.h4
-rw-r--r--project2/cgi/cgiStageCacheHit.cpp4
-rw-r--r--project2/cgi/cgiStageDefaultError.cpp10
-rw-r--r--project2/cgi/cgiStageDefaultNotFound.cpp4
-rw-r--r--project2/cgi/cgiStageFail.cpp2
-rw-r--r--project2/cgi/cgiStageInitial.cpp4
-rw-r--r--project2/cgi/cgiStagePresent.cpp28
-rw-r--r--project2/cgi/cgiStageRedirect.cpp6
-rw-r--r--project2/cgi/cgiStageRequest.cpp12
-rw-r--r--project2/cgi/testCgi.cpp7
-rw-r--r--project2/common/aggregate.cpp4
-rw-r--r--project2/common/aggregate.h8
-rw-r--r--project2/common/check.cpp4
-rw-r--r--project2/common/check.h4
-rw-r--r--project2/common/checkHost.cpp2
-rw-r--r--project2/common/columns.cpp4
-rw-r--r--project2/common/columns.h6
-rw-r--r--project2/common/commonObjects.cpp2
-rw-r--r--project2/common/commonObjects.h4
-rw-r--r--project2/common/dataSource.cpp2
-rw-r--r--project2/common/dataSource.h4
-rw-r--r--project2/common/definedColumns.h2
-rw-r--r--project2/common/execContext.cpp2
-rw-r--r--project2/common/execContext.h5
-rw-r--r--project2/common/iHaveParameters.h2
-rw-r--r--project2/common/lifeCycle.cpp6
-rw-r--r--project2/common/logger.cpp6
-rw-r--r--project2/common/logger.h8
-rw-r--r--project2/common/loggerFactory.h7
-rw-r--r--project2/common/loggerFactory.impl.h6
-rw-r--r--project2/common/options.cpp4
-rw-r--r--project2/common/options.h19
-rw-r--r--project2/common/optionsSource.cpp2
-rw-r--r--project2/common/optionsSource.h1
-rw-r--r--project2/common/pch.hpp2
-rw-r--r--project2/common/presenter.cpp2
-rw-r--r--project2/common/presenter.h15
-rw-r--r--project2/common/presenterCache.cpp2
-rw-r--r--project2/common/presenterCache.h4
-rw-r--r--project2/common/rowProcessor.cpp4
-rw-r--r--project2/common/rowProcessor.h2
-rw-r--r--project2/common/rowSet.cpp2
-rw-r--r--project2/common/rowSet.h6
-rw-r--r--project2/common/rowSetCache.cpp2
-rw-r--r--project2/common/rowSetCache.h6
-rw-r--r--project2/common/scriptLoader.cpp14
-rw-r--r--project2/common/scriptLoader.h10
-rw-r--r--project2/common/scriptStorage.h63
-rw-r--r--project2/common/scripts.cpp6
-rw-r--r--project2/common/scripts.h16
-rw-r--r--project2/common/scripts_fwd.h5
-rw-r--r--project2/common/session.h6
-rw-r--r--project2/common/sessionContainer.cpp2
-rw-r--r--project2/common/sessionContainer.h5
-rw-r--r--project2/common/sourceObject.cpp7
-rw-r--r--project2/common/sourceObject.h11
-rw-r--r--project2/common/stream.cpp2
-rw-r--r--project2/common/stream.h4
-rw-r--r--project2/common/task.cpp2
-rw-r--r--project2/common/task.h2
-rw-r--r--project2/common/taskHost.cpp2
-rw-r--r--project2/common/test.cpp2
-rw-r--r--project2/common/test.h4
-rw-r--r--project2/common/transform.cpp12
-rw-r--r--project2/common/transform.h14
-rw-r--r--project2/common/unittests/testConfig.cpp2
-rw-r--r--project2/common/variables.cpp6
-rw-r--r--project2/common/variables.h12
-rw-r--r--project2/common/variables/config.cpp8
-rw-r--r--project2/common/variables/literal.cpp2
-rw-r--r--project2/common/variables/literal.h4
-rw-r--r--project2/common/variables/lookup.cpp2
-rw-r--r--project2/common/view.cpp4
-rw-r--r--project2/common/view.h2
-rw-r--r--project2/common/viewHost.cpp4
-rw-r--r--project2/common/viewHost.h2
-rw-r--r--project2/compression/decompressStream.cpp2
-rw-r--r--project2/compression/decompressor.h5
-rw-r--r--project2/compression/gzip.cpp1
-rw-r--r--project2/console/consoleAppEngine.cpp2
-rw-r--r--project2/console/p2consoleMain.cpp4
-rw-r--r--project2/daemon/lib/daemon.h5
-rw-r--r--project2/daemon/p2daemonAppEngine.cpp2
-rw-r--r--project2/daemon/p2daemonMain.cpp4
-rw-r--r--project2/files/fsRows.cpp6
-rw-r--r--project2/files/fsRows.h7
-rw-r--r--project2/files/optionsSource.cpp4
-rw-r--r--project2/files/optionsSource.h2
-rw-r--r--project2/files/presenterCache.cpp8
-rw-r--r--project2/files/writeStream.cpp2
-rw-r--r--project2/ice/Jamfile.jam22
-rw-r--r--project2/ice/buildComms.cpp11
-rw-r--r--project2/ice/iceBase.cpp2
-rw-r--r--project2/ice/iceClient.h2
-rw-r--r--project2/ice/iceCompile.cpp2
-rw-r--r--project2/ice/iceCompile.h4
-rw-r--r--project2/ice/iceConvert.h8
-rw-r--r--project2/ice/iceDaemon.cpp14
-rw-r--r--project2/ice/iceDaemon.h2
-rw-r--r--project2/ice/iceDataSource.cpp4
-rw-r--r--project2/ice/iceDataSource.h8
-rw-r--r--project2/ice/iceModule.cpp16
-rw-r--r--project2/ice/iceModule.h8
-rw-r--r--project2/ice/iceRows.cpp2
-rw-r--r--project2/ice/iceboxDaemon.cpp8
-rw-r--r--project2/ice/iceboxLogger.cpp8
-rw-r--r--project2/ice/iceboxLogger.h4
-rw-r--r--project2/ice/slice/Jamroot.jam22
-rw-r--r--project2/ice/slice2Common.cpp2
-rw-r--r--project2/ice/slice2Daemon.cpp7
-rw-r--r--project2/ice/slice2Rows.cpp2
-rw-r--r--project2/ice/sliceCompile.cpp5
-rw-r--r--project2/ice/unittests/Jamfile.jam21
-rw-r--r--project2/ice/unittests/conversions.cpp4
-rw-r--r--project2/ice/unittests/testClient.cpp35
-rw-r--r--project2/ice/unittests/testClientCompile.cpp5
-rw-r--r--project2/ice/unittests/testDaemon.cpp10
-rw-r--r--project2/ice/unittests/testDaemonCompile.cpp5
-rw-r--r--project2/json/presenter.cpp2
-rw-r--r--project2/mail/sendmailTask.cpp34
-rw-r--r--project2/mail/sendmailTask.h5
-rw-r--r--project2/sql/mockDatasource.cpp2
-rw-r--r--project2/sql/mockDatasource.h2
-rw-r--r--project2/sql/rdbmsDataSource.cpp9
-rw-r--r--project2/sql/rdbmsDataSource.h8
-rw-r--r--project2/sql/sqlBulkLoad.cpp2
-rw-r--r--project2/sql/sqlCache.cpp37
-rw-r--r--project2/sql/sqlMergeTask.cpp62
-rw-r--r--project2/sql/sqlMergeTask.h8
-rw-r--r--project2/sql/sqlRows.cpp4
-rw-r--r--project2/sql/sqlRows.h5
-rw-r--r--project2/sql/sqlTask.cpp4
-rw-r--r--project2/sql/sqlWriters.cpp10
-rw-r--r--project2/sql/sqlWriters.h6
-rw-r--r--project2/sql/unittests/Jamfile.jam9
-rw-r--r--project2/streams/streamNvpRows.cpp4
-rw-r--r--project2/streams/streamPresenter.cpp2
-rw-r--r--project2/streams/streamRows.cpp2
-rw-r--r--project2/streams/viewStream.cpp6
-rw-r--r--project2/url/curlHelper.cpp2
-rw-r--r--project2/ut/testAppInstance.cpp8
-rw-r--r--project2/ut/testAppInstance.h4
-rw-r--r--project2/ut/testScriptHost.cpp4
-rw-r--r--project2/ut/testScriptNode.cpp7
-rw-r--r--project2/ut/testScriptNode.h4
-rw-r--r--project2/xml/Jamfile.jam4
-rw-r--r--project2/xml/rawView.cpp2
-rw-r--r--project2/xml/sessionXml.cpp2
-rw-r--r--project2/xml/unittests/testxml.cpp6
-rw-r--r--project2/xml/xmlCache.cpp6
-rw-r--r--project2/xml/xmlPresenter.cpp4
-rw-r--r--project2/xml/xmlPresenter.h8
-rw-r--r--project2/xml/xmlRawRows.cpp2
-rw-r--r--project2/xml/xmlRows.cpp2
-rw-r--r--project2/xml/xmlScriptParser.cpp38
-rw-r--r--project2/xml/xmlScriptParser.h9
-rw-r--r--project2/xml/xpathRows.cpp6
-rw-r--r--project2/xml/xpathRows.h9
187 files changed, 641 insertions, 662 deletions
diff --git a/.gitignore b/.gitignore
index e6721ac..511425e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
bin
*.pyc
*.sw?
+tags
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e0e648c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "ice"]
+ path = ice
+ url = https://github.com/zeroc-ice/ice
+ branch = 3.7
diff --git a/Jamroot.jam b/Jamroot.jam
index 5f73725..d92540b 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -3,19 +3,19 @@ import slice ;
using gcc : : [ os.environ CXX ] ;
-variant component ;
variant coverage : debug ;
project
: requirements
- <variant>release:<cxxflags>"-std=c++1y -fvisibility=hidden"
- <variant>release:<linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
- <variant>debug:<cxxflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fvisibility=hidden"
- <variant>debug:<linkflags>"-Wl,-z,defs,--warn-once"
- <variant>coverage:<cxxflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y --coverage -fvisibility=hidden"
- <variant>coverage:<linkflags>"-Wl,-z,defs,--warn-once --coverage"
- <variant>component:<cxxflags>"-W -Wall -Werror -Wwrite-strings -std=c++1y -fPIC -fvisibility=hidden"
- <variant>component:<linkflags>"-Wl,-z,lazy,--warn-once,-fPIC"
+ <define>ICE_CPP11_MAPPING
+ <cxxflags>"-std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden"
+ <linkflags>"-Wl,--warn-once,--gc-sections"
+ <variant>release:<cxxflags>"-flto=2"
+ <variant>release:<linkflags>"-flto=2"
+ <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra"
+ <variant>debug:<linkflags>"-Wl,-z,defs"
+ <variant>coverage:<cxxflags>"--coverage"
+ <variant>coverage:<linkflags>"--coverage"
;
build-project project2 ;
diff --git a/ice b/ice
new file mode 160000
+Subproject 15eeeb77ac01c54548486d691774ab6dd63fdf1
diff --git a/project2/Jamfile.jam b/project2/Jamfile.jam
index 8de52d5..9a36ada 100644
--- a/project2/Jamfile.jam
+++ b/project2/Jamfile.jam
@@ -31,7 +31,6 @@ build-project ice ;
build-project common//unittests ;
build-project basics//unittests ;
build-project ice//unittests ;
-build-project sql//unittests ;
build-project xml//unittests ;
build-project files//unittests ;
diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp
index 3138760..04f5344 100644
--- a/project2/basics/caches/memoryCache.cpp
+++ b/project2/basics/caches/memoryCache.cpp
@@ -31,7 +31,7 @@ class MemoryCache : public RowSetCache {
const Columns * columns;
AttrMap attrs;
};
- typedef boost::shared_ptr<MemoryCacheRow> MemoryCacheRowPtr;
+ typedef std::shared_ptr<MemoryCacheRow> MemoryCacheRowPtr;
typedef std::list<MemoryCacheRowPtr> DataCache;
CachedRowSet(const std::vector<VariableType> & k) :
@@ -56,14 +56,14 @@ class MemoryCache : public RowSetCache {
void addNamedValue(const Glib::ustring & name, const VariableType & value) const {
if (cur->fields.size() <= col) {
cur->fields.resize(col + 1);
- columns.insert(new Column(col, name));
+ columns.insert(std::make_shared<Column>(col, name));
}
cur->fields[col++] = value;
}
void addNewRow(const Glib::ustring&) const {
col = 0;
- cur = MemoryCacheRowPtr(new MemoryCacheRow(&columns));
+ cur = std::make_shared<MemoryCacheRow>(&columns);
}
void finishRow() const {
@@ -81,8 +81,8 @@ class MemoryCache : public RowSetCache {
mutable MemoryCacheRowPtr cur;
};
- typedef boost::intrusive_ptr<CachedRowSet> CachedRowSetPtr;
- typedef boost::intrusive_ptr<const CachedRowSet> CachedRowSetCPtr;
+ typedef std::shared_ptr<CachedRowSet> CachedRowSetPtr;
+ typedef std::shared_ptr<const CachedRowSet> CachedRowSetCPtr;
struct IndexByKey { };
struct IndexByTime { };
@@ -115,7 +115,7 @@ class MemoryCache : public RowSetCache {
}
RowSetPresenterPtr openFor(ExecContext * ec, const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) {
- return (cur = new CachedRowSet(makeKey(ec, n, f, ps)));
+ return (cur = std::make_shared<CachedRowSet>(makeKey(ec, n, f, ps)));
}
void save(ExecContext *, const Glib::ustring & , const Glib::ustring & , const IHaveParameters * ) {
diff --git a/project2/basics/if.cpp b/project2/basics/if.cpp
index d860b55..4500335 100644
--- a/project2/basics/if.cpp
+++ b/project2/basics/if.cpp
@@ -15,9 +15,9 @@ If::If(ScriptNodePtr e) :
IHaveSubTasks(e),
View(e)
{
- e->script->loader.addLoadTarget(e, Storer::into<TaskFactory>(&normal));
- e->script->loader.addLoadTarget(e, Storer::into<ViewFactory>(&subViews));
- e->script->loader.addLoadTarget(e, Storer::into<TestFactory>(&test));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<TaskFactory>(&normal));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<ViewFactory>(&subViews));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<TestFactory>(&test));
}
bool
diff --git a/project2/basics/options/showHelp.cpp b/project2/basics/options/showHelp.cpp
index 395baed..0b32043 100644
--- a/project2/basics/options/showHelp.cpp
+++ b/project2/basics/options/showHelp.cpp
@@ -14,7 +14,7 @@ void ShowHelpComponent::onConfigLoad()
exit(1);
}
-void ShowHelpComponent::outputOptions(const Options * options) const
+void ShowHelpComponent::outputOptions(std::shared_ptr<const Options> options) const
{
fprintf(stdout, " * %s\n", options->name.c_str());
for (const auto & option : options->allOptions()) {
@@ -25,7 +25,7 @@ void ShowHelpComponent::outputOptions(const Options * options) const
Options::TargetPtr
ShowHelpComponent::Option()
{
- return new OptionFlagSet(&showHelp);
+ return std::make_shared<OptionFlagSet>(&showHelp);
}
bool ShowHelpComponent::showHelp;
diff --git a/project2/basics/options/showHelp.h b/project2/basics/options/showHelp.h
index eb94155..a0878fe 100644
--- a/project2/basics/options/showHelp.h
+++ b/project2/basics/options/showHelp.h
@@ -11,7 +11,7 @@ class DLL_PUBLIC ShowHelpComponent : public LifeCycle {
static Options::TargetPtr Option();
private:
- void outputOptions(const Options * options) const;
+ void outputOptions(std::shared_ptr<const Options> options) const;
static bool showHelp;
};
diff --git a/project2/basics/tasks/iterate.cpp b/project2/basics/tasks/iterate.cpp
index 16224f6..6ab1260 100644
--- a/project2/basics/tasks/iterate.cpp
+++ b/project2/basics/tasks/iterate.cpp
@@ -11,7 +11,7 @@ Iterate::Iterate(ScriptNodePtr p) :
IHaveSubTasks(p),
RowProcessor(p)
{
- p->script->loader.addLoadTarget(p, Storer::into<TaskFactory>(&normal));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<TaskFactory>(&normal));
}
Iterate::~Iterate()
diff --git a/project2/basics/tasks/iterate.h b/project2/basics/tasks/iterate.h
index 807c8c3..ca3a7ba 100644
--- a/project2/basics/tasks/iterate.h
+++ b/project2/basics/tasks/iterate.h
@@ -6,7 +6,7 @@
#include "scriptStorage.h"
class Iterate;
-typedef boost::intrusive_ptr<Iterate> IteratePtr;
+typedef std::shared_ptr<Iterate> IteratePtr;
/// Project2 component to iterate over a row set, executing its children for each record
class DLL_PUBLIC Iterate : public IHaveSubTasks, public RowProcessor {
diff --git a/project2/basics/tasks/structExceptHandling.cpp b/project2/basics/tasks/structExceptHandling.cpp
index 4e46466..b77a4a8 100644
--- a/project2/basics/tasks/structExceptHandling.cpp
+++ b/project2/basics/tasks/structExceptHandling.cpp
@@ -11,9 +11,9 @@ StructuredExceptionHandler::StructuredExceptionHandler(ScriptNodePtr e) :
SourceObject(e),
IHaveSubTasks(e)
{
- e->script->loader.addLoadTargetSub(e, "try", true, Storer::into<TaskFactory>(&normal));
- e->script->loader.addLoadTargetSub(e, "catch", false, Storer::into<TaskFactory>(&catches));
- e->script->loader.addLoadTargetSub(e, "finally", false, Storer::into<TaskFactory>(&finallies));
+ e->script.lock()->loader.addLoadTargetSub(e, "try", true, Storer::into<TaskFactory>(&normal));
+ e->script.lock()->loader.addLoadTargetSub(e, "catch", false, Storer::into<TaskFactory>(&catches));
+ e->script.lock()->loader.addLoadTargetSub(e, "finally", false, Storer::into<TaskFactory>(&finallies));
}
void
diff --git a/project2/basics/tests/compoundTest.cpp b/project2/basics/tests/compoundTest.cpp
index 88cff62..2b9d1d7 100644
--- a/project2/basics/tests/compoundTest.cpp
+++ b/project2/basics/tests/compoundTest.cpp
@@ -10,7 +10,7 @@ CompoundTest::CompoundTest(ScriptNodePtr s) :
SourceObject(s),
Test(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<TestFactory>(&tests));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<TestFactory>(&tests));
}
class All : public CompoundTest {
@@ -64,7 +64,7 @@ class Not : public Test {
SourceObject(s),
Test(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<TestFactory>(&test));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<TestFactory>(&test));
}
bool passes(ExecContext * ec) const {
if (!test) {
diff --git a/project2/basics/unittests/Jamfile.jam b/project2/basics/unittests/Jamfile.jam
index 4fef202..c5b14c6 100644
--- a/project2/basics/unittests/Jamfile.jam
+++ b/project2/basics/unittests/Jamfile.jam
@@ -10,9 +10,7 @@ path-constant me : . ;
run
testLibraries.cpp
- : : :
- <define>ROOT=\"$(me)\"
- <dependency>dummylib
+ : : dummylib :
<library>../../common//p2common
<library>..//p2basics
<library>../../ut//p2ut
@@ -29,6 +27,7 @@ run
<library>..//p2basics
<library>../../ut//p2ut
<library>../../xml//p2xml
+ <library>../../url//p2url
<library>..//boost_filesystem
:
standardTests :
diff --git a/project2/basics/unittests/testLibraries.cpp b/project2/basics/unittests/testLibraries.cpp
index 7797694..a1aef90 100644
--- a/project2/basics/unittests/testLibraries.cpp
+++ b/project2/basics/unittests/testLibraries.cpp
@@ -25,11 +25,16 @@ BOOST_AUTO_TEST_CASE( load_missing_library )
BOOST_AUTO_TEST_CASE( load_and_unload_library )
{
+ // Path to test lib needs passing in
+ BOOST_REQUIRE_EQUAL(2, args.size());
+ auto libraryPath = args[1];
+ BOOST_REQUIRE(boost::filesystem::exists(libraryPath));
+
BOOST_REQUIRE_THROW(TaskFactory::get("DummyTask"), AdHoc::NoSuchPluginException);
BOOST_TEST_CHECKPOINT("Configure (load)");
TestOptionsSource::LoadTestOptions({
- { "library", (root / "bin" / self.parent_path().parent_path().leaf() / self.parent_path().leaf() / "libdummylib.so").string() }
+ { "library", libraryPath }
});
BOOST_TEST_CHECKPOINT("Verify");
BOOST_REQUIRE(TaskFactory::get("DummyTask"));
diff --git a/project2/basics/unittests/testViews.cpp b/project2/basics/unittests/testViews.cpp
index 0a05c69..2303f1c 100644
--- a/project2/basics/unittests/testViews.cpp
+++ b/project2/basics/unittests/testViews.cpp
@@ -7,7 +7,7 @@
#include <definedDirs.h>
#include <testAppInstance.h>
-boost::intrusive_ptr<TestScriptHost>
+std::shared_ptr<TestScriptHost>
executeRowViewTest(ExecContext * ec, const boost::filesystem::path & script, const boost::filesystem::path & expected)
{
TestOptionsSource::LoadTestOptions({
@@ -15,8 +15,8 @@ executeRowViewTest(ExecContext * ec, const boost::filesystem::path & script, con
{ "application.dataroot", ("file://" / rootDir / "data").string() },
});
BOOST_TEST_CHECKPOINT("Load");
- ScriptReaderPtr r = new XmlScriptParser(script);
- boost::intrusive_ptr<TestScriptHost> sr = new TestScriptHost(r);
+ ScriptReaderPtr r = std::make_shared<XmlScriptParser>(script);
+ std::shared_ptr<TestScriptHost> sr = std::make_shared<TestScriptHost>(r);
BOOST_TEST_CHECKPOINT("Execute");
sr->process(ec);
BOOST_TEST_CHECKPOINT("Compare");
diff --git a/project2/basics/views/autotree.cpp b/project2/basics/views/autotree.cpp
index bfeabee..f96888e 100644
--- a/project2/basics/views/autotree.cpp
+++ b/project2/basics/views/autotree.cpp
@@ -55,7 +55,7 @@ AutoTreeNode::AutoTreeNode(ScriptNodePtr sn, unsigned int p, unsigned int d) :
includes.insert({n->value("name", NULL).as<Glib::ustring>(), Variable::fromScriptNode(n)} );
}
if (sn->valueExists("tree")) {
- tree = new AutoTreeNode(sn->child("tree"), pos + keys.size(), depth + 1);
+ tree = std::make_shared<AutoTreeNode>(sn->child("tree"), pos + keys.size(), depth + 1);
}
}
diff --git a/project2/basics/views/autotree.h b/project2/basics/views/autotree.h
index ace3d8d..9276bab 100644
--- a/project2/basics/views/autotree.h
+++ b/project2/basics/views/autotree.h
@@ -1,13 +1,12 @@
#ifndef AUTOTREE_H
#define AUTOTREE_H
-#include <boost/intrusive_ptr.hpp>
#include "rowProcessor.h"
#include "view.h"
#include "aggregate.h"
class AutoTreeNode;
-typedef boost::intrusive_ptr<const AutoTreeNode> AutoTreeNodePtr;
+typedef std::shared_ptr<const AutoTreeNode> AutoTreeNodePtr;
class DLL_PUBLIC AutoTreeState {
public:
@@ -17,7 +16,7 @@ class DLL_PUBLIC AutoTreeState {
std::vector<VariableType> values;
};
-class DLL_PUBLIC AutoTreeNode : public IntrusivePtrBase {
+class DLL_PUBLIC AutoTreeNode {
public:
typedef std::map<Glib::ustring, Variable> Values;
@@ -29,7 +28,7 @@ class DLL_PUBLIC AutoTreeNode : public IntrusivePtrBase {
void closeArray(const MultiRowSetPresenter * p, ExecContext *, AutoTreeState & state) const;
void closeObject(const MultiRowSetPresenter * p, ExecContext *, AutoTreeState & state) const;
AutoTreeNodePtr child() const;
-
+
protected:
private:
diff --git a/project2/basics/views/flatView.cpp b/project2/basics/views/flatView.cpp
index aba684f..36c0427 100644
--- a/project2/basics/views/flatView.cpp
+++ b/project2/basics/views/flatView.cpp
@@ -6,7 +6,7 @@
#include <factory.impl.h>
NAMEDFACTORY("flatview", FlatView, FlatViewFactory);
-INSTANTIATEFACTORY(FlatView, const ScriptNode *);
+INSTANTIATEFACTORY(FlatView, std::shared_ptr<const ScriptNode>);
FlatView::FlatView(ScriptNodePtr p) :
SourceObject(p),
diff --git a/project2/basics/views/flatView.h b/project2/basics/views/flatView.h
index b79162b..72acabc 100644
--- a/project2/basics/views/flatView.h
+++ b/project2/basics/views/flatView.h
@@ -24,7 +24,7 @@ class DLL_PUBLIC FlatView : public SourceObject, public RowProcessor {
typedef std::map<Glib::ustring, Variable> Columns;
Columns viewColumns;
};
-typedef AdHoc::Factory<FlatView, const ScriptNode *> FlatViewFactory;
+typedef AdHoc::Factory<FlatView, std::shared_ptr<const ScriptNode>> FlatViewFactory;
#endif
diff --git a/project2/basics/views/rowView.cpp b/project2/basics/views/rowView.cpp
index a798688..f5e108b 100644
--- a/project2/basics/views/rowView.cpp
+++ b/project2/basics/views/rowView.cpp
@@ -23,9 +23,9 @@ RowView::RowView(ScriptNodePtr p) :
viewColumns->insert(Columns::value_type(node->get_name(), Variable(node)));
}
}
- p->script->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews));
- p->script->loader.addLoadTarget(p, Storer::into<ValueAggregateFactory>(&valueAggregates));
- p->script->loader.addLoadTarget(p, Storer::into<SetAggregateFactory>(&setAggregates));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<ValueAggregateFactory>(&valueAggregates));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<SetAggregateFactory>(&setAggregates));
}
RowView::~RowView()
diff --git a/project2/basics/views/singleton.cpp b/project2/basics/views/singleton.cpp
index 15f2908..913776a 100644
--- a/project2/basics/views/singleton.cpp
+++ b/project2/basics/views/singleton.cpp
@@ -14,7 +14,7 @@ class Singleton : public View {
for (ScriptNodePtr node : p->childrenIn("columns")) {
viewColumns.insert(Columns::value_type(node->get_name(), Variable(node)));
}
- p->script->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<ViewFactory>(&subViews));
}
void execute(const MultiRowSetPresenter * p, ExecContext * ec) const
{
diff --git a/project2/basics/views/viewGroup.cpp b/project2/basics/views/viewGroup.cpp
index 8237e86..591babd 100644
--- a/project2/basics/views/viewGroup.cpp
+++ b/project2/basics/views/viewGroup.cpp
@@ -7,7 +7,7 @@ class ViewGroup : public View {
SourceObject(s),
View(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<ViewFactory>(&subViews));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<ViewFactory>(&subViews));
}
void execute(const MultiRowSetPresenter * presenter, ExecContext * ec) const
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp
index a69fa9e..7f5195b 100644
--- a/project2/cgi/cgiAppEngine.cpp
+++ b/project2/cgi/cgiAppEngine.cpp
@@ -36,7 +36,7 @@ std::string CgiApplicationEngine::onErrorPresent;
std::string CgiApplicationEngine::defaultPresenter;
SessionContainerPtr CgiApplicationEngine::sessionsContainer;
std::string CgiApplicationEngine::sessionCookie;
-const RouterFactory * CgiApplicationEngine::router;
+std::shared_ptr<const RouterFactory> CgiApplicationEngine::router;
CgiApplicationEngine::PlatformHostnameList CgiApplicationEngine::platHosts;
class PlatformHostnameTarget : public Options::Target {
@@ -90,7 +90,7 @@ DECLARE_OPTIONS(CgiApplicationEngine, "Project2 CGI options")
"The module with which to implement session management")
("cgi.sessionCookie", Options::value(&sessionCookie, "sessionID"),
"The name of the cookie for storing session IDs")
-("cgi.hostRegex", new PlatformHostnameTarget(),
+("cgi.hostRegex", std::make_shared<PlatformHostnameTarget>(),
"Regular expression used to define a hostname -> platform association")
("cgi.router", Options::function([](const VariableType & r) { router = RouterFactory::get(r); }, "simple"),
"Implemenation of router model to map request paths to scripts")
@@ -111,7 +111,7 @@ finalTransformSource(TransformSourcePtr ts)
return ts;
}
for (const Targets::value_type & t : ts->getTargets()) {
- if (TransformSource * tr = dynamic_cast<TransformSource *>(t.first.get())) {
+ if (auto tr = std::dynamic_pointer_cast<TransformSource>(t.first)) {
if (TransformSourcePtr f = finalTransformSource(tr)) {
return f;
}
@@ -128,22 +128,22 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const
crc->startTime = boost::date_time::microsec_clock<boost::posix_time::ptime>::universal_time();
bool triedNotFound = false;
bool triedOnError = false;
- NextStage currentStage = NextStage(new InitialStage());
+ NextStage currentStage = NextStage(std::make_shared<InitialStage>());
do {
try {
currentStage = currentStage.get<0>()->run(crc);
}
catch (const CheckHost::CheckFailure & cf) {
- currentStage = NextStage(new PresentStage(ScriptReader::resolveScript(presentRoot, cf.failedCheck->present(crc), false), crc));
+ currentStage = NextStage(std::make_shared<PresentStage>(ScriptReader::resolveScript(presentRoot, cf.failedCheck->present(crc), false), crc));
}
catch (const ScriptNotFound & nf) {
Logger()->messagebf(LOG_ERR, "%s: Resource not found: %s", __FUNCTION__, nf.what());
if (notFoundPresent.empty() || triedNotFound) {
- currentStage = NextStage(new DefaultNotFoundStage(nf));
+ currentStage = NextStage(std::make_shared<DefaultNotFoundStage>(nf));
}
else {
triedNotFound = true;
- currentStage = NextStage(new CustomNotFoundStage(nf, ScriptReader::resolveScript(errorPresentRoot, notFoundPresent, false), crc));
+ currentStage = NextStage(std::make_shared<CustomNotFoundStage>(nf, ScriptReader::resolveScript(errorPresentRoot, notFoundPresent, false), crc));
}
}
catch (const std::exception & ex) {
@@ -151,11 +151,11 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const
Logger()->messagebf(LOG_WARNING, "%s: Error processing stage: %s (what: %s)", __FUNCTION__, buf, ex.what());
free(buf);
if (onErrorPresent.empty() || triedOnError) {
- currentStage = NextStage(new DefaultErrorStage(ex, crc));
+ currentStage = NextStage(std::make_shared<DefaultErrorStage>(ex, crc));
}
else {
triedNotFound = true;
- currentStage = NextStage(new CustomErrorStage(ex, ScriptReader::resolveScript(errorPresentRoot, onErrorPresent, false), crc));
+ currentStage = NextStage(std::make_shared<CustomErrorStage>(ex, ScriptReader::resolveScript(errorPresentRoot, onErrorPresent, false), crc));
}
}
} while (currentStage.get<0>());
@@ -176,12 +176,12 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const
TransformSourcePtr final = finalTransformSource(ts);
AdHoc::ScopeExit emptyFinal([final] { final->clearTargets(); });
boost::shared_ptr<std::fstream> ddd;
- ostreamWrapper * osw = NULL;
+ std::shared_ptr<ostreamWrapper> osw;
AdHoc::ScopeExit removeDdd([ts, &osw] { if (osw) { ts->removeTarget(osw); } });
if (!dumpdatadoc.empty()) {
ddd = boost::shared_ptr<std::fstream>(new std::fstream(dumpdatadoc.c_str(), std::fstream::trunc | std::fstream::out));
if (ddd->good()) {
- ts->addTarget(osw = new ostreamWrapper(*ddd), crc, NULL);
+ ts->addTarget(osw = std::make_shared<ostreamWrapper>(*ddd), crc, NULL);
}
else {
ddd.reset();
@@ -197,13 +197,13 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const
}
if (rs->caches.front()->check(0, crc)) {
AdHoc::ScopeExit emptyFinal([rs] { rs->caches.front()->clearTargets(); });
- rs->caches.front()->addTarget(new CgiResult(header, IO,
+ rs->caches.front()->addTarget(std::make_shared<CgiResult>(header, IO,
rs && rs->outputOptions ? rs->outputOptions->Encoding(crc).as<std::string>() : OutputOptions::encoding), crc, NULL);
rs->caches.front()->doTransforms(crc);
return;
}
}
- final->addTarget(new CgiResult(header, IO,
+ final->addTarget(std::make_shared<CgiResult>(header, IO,
rs && rs->outputOptions ? rs->outputOptions->Encoding(crc).as<std::string>() : OutputOptions::encoding), crc, NULL);
ts->doTransforms(crc);
}
diff --git a/project2/cgi/cgiAppEngine.h b/project2/cgi/cgiAppEngine.h
index b9a30d9..3c9ba13 100644
--- a/project2/cgi/cgiAppEngine.h
+++ b/project2/cgi/cgiAppEngine.h
@@ -10,7 +10,6 @@
#include "xmlPresenter.h"
#include "presenterCache.h"
#include "sessionContainer.h"
-#include <boost/intrusive_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include "cgiOutputOptions.h"
#include "cgiHttpHeader.h"
@@ -27,7 +26,7 @@ namespace cgicc {
class DLL_PUBLIC CgiApplicationEngine : AppInstance {
public:
- typedef boost::shared_ptr<Project2HttpHeader> HttpHeaderPtr;
+ typedef std::shared_ptr<Project2HttpHeader> HttpHeaderPtr;
typedef std::pair<Glib::ustring, Glib::RefPtr<Glib::Regex>> PlatformHostname;
typedef std::vector<PlatformHostname> PlatformHostnameList;
@@ -53,18 +52,18 @@ class DLL_PUBLIC CgiApplicationEngine : AppInstance {
public:
class Stage;
class ResponseStage;
- typedef boost::intrusive_ptr<Stage> StagePtr;
- typedef boost::intrusive_ptr<ResponseStage> ResponseStagePtr;
+ typedef std::shared_ptr<Stage> StagePtr;
+ typedef std::shared_ptr<ResponseStage> ResponseStagePtr;
typedef boost::tuple<StagePtr, ResponseStagePtr, TransformSourcePtr, MultiRowSetPresenterPtr> NextStage;
/// Base class for a stage iteration that should eventually produce a response for the client
- class Stage : public virtual IntrusivePtrBase {
+ class Stage {
public:
virtual ~Stage() = 0;
virtual NextStage run(CgiRequestContext *) = 0;
};
/// Base class for a stage that can be a response to the client
- class ResponseStage : public Stage {
+ class ResponseStage : public Stage, public std::enable_shared_from_this<ResponseStage> {
public:
typedef ANONORDEREDSTORAGEOF(PresenterCache) PresenterCaches;
@@ -162,7 +161,7 @@ class DLL_PUBLIC CgiApplicationEngine : AppInstance {
INITOPTIONS;
static PlatformHostnameList platHosts;
- static const RouterFactory * router;
+ static std::shared_ptr<const RouterFactory> router;
static SessionContainerPtr sessionsContainer;
static std::string sessionCookie;
private:
diff --git a/project2/cgi/cgiContentNegotiate.cpp b/project2/cgi/cgiContentNegotiate.cpp
index beff91c..d72967a 100644
--- a/project2/cgi/cgiContentNegotiate.cpp
+++ b/project2/cgi/cgiContentNegotiate.cpp
@@ -5,7 +5,7 @@
class ContentNegotiateFactory : public PresenterFactory {
public:
- MultiRowSetPresenter * create(const ScriptNode * const & s, const ObjectSource & os, ExecContext * const & ec) const override
+ MultiRowSetPresenterPtr create(std::shared_ptr<const ScriptNode> const & s, const ObjectSource & os, ExecContext * const & ec) const override
{
auto accept = static_cast<const CgiRequestContext *>(ec)->getAccept();
typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
@@ -22,7 +22,7 @@ class ContentNegotiateFactory : public PresenterFactory {
}
INITOPTIONS;
- class MappedType : public IntrusivePtrBase {
+ class MappedType {
public:
MappedType(const std::string & val) :
accept(val.substr(0, val.find('='))),
@@ -38,7 +38,7 @@ class ContentNegotiateFactory : public PresenterFactory {
const std::string accept;
const std::string present;
};
- typedef boost::intrusive_ptr<MappedType> MappedTypePtr;
+ typedef std::shared_ptr<MappedType> MappedTypePtr;
typedef std::vector<MappedTypePtr> MappedTypes;
static MappedTypes mappedTypes;
@@ -50,7 +50,7 @@ NAMEDPLUGIN("contentnegotiate", ContentNegotiateFactory, PresenterFactory);
DECLARE_OPTIONS(ContentNegotiateFactory, "Content negotiation options")
("cgi.contentnegotiation.mappedtype", Options::functions(
- [](const VariableType & v) { mappedTypes.push_back(new MappedType(v)); },
+ [](const VariableType & v) { mappedTypes.push_back(std::make_shared<MappedType>(v)); },
boost::bind(&MappedTypes::clear, &mappedTypes)),
"mimetype=presenter list of types to negotiate")
END_OPTIONS(ContentNegotiateFactory)
diff --git a/project2/cgi/cgiOutputOptions.cpp b/project2/cgi/cgiOutputOptions.cpp
index 56590ff..a199701 100644
--- a/project2/cgi/cgiOutputOptions.cpp
+++ b/project2/cgi/cgiOutputOptions.cpp
@@ -32,5 +32,5 @@ DECLARE_OPTIONS(OutputOptions, "CGI default output options")
END_OPTIONS(OutputOptions)
NAMEDFACTORY("outputoptions", OutputOptions, OutputOptionsFactory)
-INSTANTIATEFACTORY(OutputOptions, const ScriptNode *);
+INSTANTIATEFACTORY(OutputOptions, std::shared_ptr<const ScriptNode>);
diff --git a/project2/cgi/cgiOutputOptions.h b/project2/cgi/cgiOutputOptions.h
index 75a19b0..55d75c7 100644
--- a/project2/cgi/cgiOutputOptions.h
+++ b/project2/cgi/cgiOutputOptions.h
@@ -1,11 +1,10 @@
#ifndef OUTPUTOPTIONS_H
#define OUTPUTOPTIONS_H
-#include "intrusivePtrBase.h"
#include "options.h"
#include "variables.h"
-class DLL_PUBLIC OutputOptions : public IntrusivePtrBase {
+class DLL_PUBLIC OutputOptions : public Something {
public:
OutputOptions(ScriptNodePtr);
@@ -29,7 +28,7 @@ class DLL_PUBLIC OutputOptions : public IntrusivePtrBase {
static bool url;
static bool parameters;
};
-typedef boost::intrusive_ptr<OutputOptions> OutputOptionsPtr;
-typedef AdHoc::Factory<OutputOptions, const ScriptNode *> OutputOptionsFactory;
+typedef std::shared_ptr<OutputOptions> OutputOptionsPtr;
+typedef AdHoc::Factory<OutputOptions, std::shared_ptr<const ScriptNode>> OutputOptionsFactory;
#endif
diff --git a/project2/cgi/cgiProgRouter.cpp b/project2/cgi/cgiProgRouter.cpp
index 9993441..983e8cd 100644
--- a/project2/cgi/cgiProgRouter.cpp
+++ b/project2/cgi/cgiProgRouter.cpp
@@ -16,7 +16,7 @@ typedef std::map<std::string, std::string> VarMap;
class RoutingTable {
public:
class Route;
- typedef AdHoc::Factory<RoutingTable::Route, const ScriptNode *> RouteFactory;
+ typedef AdHoc::Factory<RoutingTable::Route, std::shared_ptr<const ScriptNode>> RouteFactory;
void loadRoutesFromFile(const std::string & routeFile) {
routeScriptPath = routeFile;
@@ -59,11 +59,11 @@ class RoutingTable {
throw ScriptNotFound("routed", path);
}
- class RouteElem : public IntrusivePtrBase {
+ class RouteElem {
public:
virtual bool matches(const std::string &, VarMap & vars) const = 0;
};
- typedef boost::intrusive_ptr<RouteElem> RouteElemPtr;
+ typedef std::shared_ptr<RouteElem> RouteElemPtr;
class RouteLiteral : public RouteElem {
public:
@@ -97,10 +97,10 @@ class RoutingTable {
while(p != fspath.end() && p->string() != ".") {
switch (p->string().front()) {
case '{':
- routeElems.push_back(new RouteVar(p->string()));
+ routeElems.push_back(std::make_shared<RouteVar>(p->string()));
break;
default:
- routeElems.push_back(new RouteLiteral(p->string()));
+ routeElems.push_back(std::make_shared<RouteLiteral>(p->string()));
break;
}
p++;
@@ -122,7 +122,7 @@ class RoutingTable {
const std::string present;
const std::string path;
};
- typedef boost::intrusive_ptr<Route> RoutePtr;
+ typedef std::shared_ptr<Route> RoutePtr;
std::list<RoutePtr> routes;
};
@@ -202,8 +202,8 @@ class Routes : public RowSet {
class RouteRowState : public RowState {
public:
RouteRowState() {
- columns.insert(new Column(0, "present"));
- columns.insert(new Column(1, "path"));
+ columns.insert(std::make_shared<Column>(0, "present"));
+ columns.insert(std::make_shared<Column>(1, "path"));
fields.resize(2);
}
const Columns & getColumns() const { return columns; }
@@ -224,5 +224,5 @@ class Routes : public RowSet {
};
NAMEDFACTORY("routes", Routes, RowSetFactory);
-INSTANTIATEFACTORY(RoutingTable::Route, const ScriptNode *);
+INSTANTIATEFACTORY(RoutingTable::Route, std::shared_ptr<const ScriptNode>);
diff --git a/project2/cgi/cgiRouter.h b/project2/cgi/cgiRouter.h
index 5417bce..7c9137e 100644
--- a/project2/cgi/cgiRouter.h
+++ b/project2/cgi/cgiRouter.h
@@ -7,7 +7,7 @@
class MultiRowSetPresenter;
-class DLL_PUBLIC Router : public IntrusivePtrBase {
+class DLL_PUBLIC Router {
public:
virtual bool isDefault() const = 0;
virtual std::string route() const = 0;
@@ -15,7 +15,7 @@ class DLL_PUBLIC Router : public IntrusivePtrBase {
virtual unsigned int parameterCount() const = 0;
virtual void present(const MultiRowSetPresenter * p) const = 0;
};
-typedef boost::intrusive_ptr<Router> RouterPtr;
+typedef std::shared_ptr<Router> RouterPtr;
typedef AdHoc::Factory<Router, const std::string &> RouterFactory;
#endif
diff --git a/project2/cgi/cgiStageCacheHit.cpp b/project2/cgi/cgiStageCacheHit.cpp
index 3a6a665..a069dc8 100644
--- a/project2/cgi/cgiStageCacheHit.cpp
+++ b/project2/cgi/cgiStageCacheHit.cpp
@@ -13,12 +13,12 @@ CgiApplicationEngine::CacheHitStage::CacheHitStage(ScriptNodePtr s, PresenterCac
CgiApplicationEngine::NextStage
CgiApplicationEngine::CacheHitStage::run(CgiRequestContext *)
{
- return NextStage(NULL, this, pc, NULL);
+ return NextStage(NULL, shared_from_this(), pc, NULL);
}
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::CacheHitStage::getHeader(CgiRequestContext *) const
{
- return HttpHeaderPtr(new Project2HttpHeader("200 OK"));
+ return std::make_shared<Project2HttpHeader>("200 OK");
}
diff --git a/project2/cgi/cgiStageDefaultError.cpp b/project2/cgi/cgiStageDefaultError.cpp
index f932f78..f4c1df9 100644
--- a/project2/cgi/cgiStageDefaultError.cpp
+++ b/project2/cgi/cgiStageDefaultError.cpp
@@ -11,12 +11,12 @@ CgiApplicationEngine::DefaultErrorStage::DefaultErrorStage(const std::exception
CgiApplicationEngine::ResponseStage(NULL),
buf(__cxxabiv1::__cxa_demangle(typeid(ex).name(), NULL, NULL, NULL)),
what(ex.what()),
- pres(new XmlPresenter(DefaultErrorStageResp, CgiApplicationEngine::errorTransformStyle, CgiApplicationEngine::errorContentType))
+ pres(std::make_shared<XmlPresenter>(DefaultErrorStageResp, CgiApplicationEngine::errorTransformStyle, CgiApplicationEngine::errorContentType))
{
- auto xp = dynamic_cast<TransformSource *>(pres.get());
- auto cp = dynamic_cast<ContentPresenter *>(pres.get());
+ auto xp = std::dynamic_pointer_cast<TransformSource>(pres);
+ auto cp = std::dynamic_pointer_cast<ContentPresenter>(pres);
if (xp && cp && cp->contentType == CgiApplicationEngine::transformContentType) {
- auto h = TransformTargetFactory::createNew(CgiApplicationEngine::transformTargetType, root.get(), Default);
+ auto h = TransformTargetFactory::createNew(CgiApplicationEngine::transformTargetType, root, Default);
xp->addTarget(h, crc, root);
}
}
@@ -38,6 +38,6 @@ CgiApplicationEngine::DefaultErrorStage::run(CgiRequestContext * crc)
pres->init(crc);
pres->addNamedValue("error-type", Scripts::scriptNamespacePrefix, buf);
pres->addNamedValue("error-what", Scripts::scriptNamespacePrefix, what.c_str());
- return NextStage(NULL, this, pres.get(), pres.get());
+ return NextStage(NULL, shared_from_this(), pres, pres);
}
diff --git a/project2/cgi/cgiStageDefaultNotFound.cpp b/project2/cgi/cgiStageDefaultNotFound.cpp
index ad4c697..c6b6f1e 100644
--- a/project2/cgi/cgiStageDefaultNotFound.cpp
+++ b/project2/cgi/cgiStageDefaultNotFound.cpp
@@ -16,7 +16,7 @@ CgiApplicationEngine::DefaultNotFoundStage::DefaultNotFoundStage(const ScriptNot
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::DefaultNotFoundStage::getHeader(CgiRequestContext *) const
{
- return HttpHeaderPtr(new Project2HttpHeader("404 Not found"));
+ return std::make_shared<Project2HttpHeader>("404 Not found");
}
CgiApplicationEngine::NextStage
@@ -24,6 +24,6 @@ CgiApplicationEngine::DefaultNotFoundStage::run(CgiRequestContext * crc)
{
pres->init(crc);
pres->addNamedValue("missing-resource", Scripts::scriptNamespacePrefix, nf.what());
- return NextStage(NULL, this, pres.get(), pres.get());
+ return NextStage(NULL, shared_from_this(), pres, pres);
}
diff --git a/project2/cgi/cgiStageFail.cpp b/project2/cgi/cgiStageFail.cpp
index e96f14f..a111a96 100644
--- a/project2/cgi/cgiStageFail.cpp
+++ b/project2/cgi/cgiStageFail.cpp
@@ -22,7 +22,7 @@ namespace CgiApplicationExtras {
CgiApplicationEngine::NextStage run(CgiRequestContext *)
{
- return CgiApplicationEngine::NextStage(NULL, this, NULL, NULL);
+ return CgiApplicationEngine::NextStage(NULL, shared_from_this(), NULL, NULL);
}
private:
const int code;
diff --git a/project2/cgi/cgiStageInitial.cpp b/project2/cgi/cgiStageInitial.cpp
index 1326af8..dbc58fd 100644
--- a/project2/cgi/cgiStageInitial.cpp
+++ b/project2/cgi/cgiStageInitial.cpp
@@ -7,11 +7,11 @@ CgiApplicationEngine::NextStage
CgiApplicationEngine::InitialStage::run(CgiRequestContext * crc)
{
if (crc->getRequestMethod() == "POST") {
- return NextStage(new RequestStage(ScriptReader::resolveScript(CgiApplicationEngine::requestRoot,
+ return NextStage(std::make_shared<RequestStage>(ScriptReader::resolveScript(CgiApplicationEngine::requestRoot,
crc->router->route(), false)));
}
else {
- return NextStage(new PresentStage(ScriptReader::resolveScript(CgiApplicationEngine::presentRoot,
+ return NextStage(std::make_shared<PresentStage>(ScriptReader::resolveScript(CgiApplicationEngine::presentRoot,
crc->router->isDefault() ? CgiApplicationEngine::defaultPresent : crc->router->route(), false), crc));
}
}
diff --git a/project2/cgi/cgiStagePresent.cpp b/project2/cgi/cgiStagePresent.cpp
index 04fae92..33f0298 100644
--- a/project2/cgi/cgiStagePresent.cpp
+++ b/project2/cgi/cgiStagePresent.cpp
@@ -11,11 +11,11 @@ CgiApplicationEngine::PresentStage::PresentStage(ScriptReaderPtr s, CgiRequestCo
CheckHost(s->root()),
ViewHost(s->root()),
presenter([this, crc] {
- auto p = PresenterFactory::createNew(CgiApplicationEngine::defaultPresenter, root.get(), Default, crc);
- auto xp = dynamic_cast<TransformSource *>(p);
- auto cp = dynamic_cast<ContentPresenter *>(p);
+ auto p = PresenterFactory::createNew(CgiApplicationEngine::defaultPresenter, root, Default, crc);
+ auto xp = std::dynamic_pointer_cast<TransformSource>(p);
+ auto cp = std::dynamic_pointer_cast<ContentPresenter>(p);
if (xp && cp && cp->contentType == CgiApplicationEngine::transformContentType) {
- auto h = TransformTargetFactory::createNew(CgiApplicationEngine::transformTargetType, root.get(), Default);
+ auto h = TransformTargetFactory::createNew(CgiApplicationEngine::transformTargetType, root, Default);
xp->addTarget(h, crc, root);
}
return p;
@@ -34,12 +34,12 @@ CgiApplicationEngine::PresentStage::run(CgiRequestContext * crc)
time_t reqMS = crc->getRequestModifiedSince();
CgiRequestContext::ETags etags = crc->getRequestETags();
for (const PresenterCachePtr & pc : caches) {
- if (pc->check(root->script->modifiedTime(), crc)) {
+ if (pc->check(root->script.lock()->modifiedTime(), crc)) {
if (reqMS >= pc->getModifiedTime() && (etags.empty() || AdHoc::containerContains(etags, pc->getSHA1()))) {
- header = HttpHeaderPtr(new Project2HttpHeader("304 Not Modified"));
- return NextStage(NULL, this, NULL, NULL);
+ header = std::make_shared<Project2HttpHeader>("304 Not Modified");
+ return NextStage(NULL, shared_from_this(), NULL, NULL);
}
- CacheHitStage * chs = new CacheHitStage(root, pc);
+ auto chs = std::make_shared<CacheHitStage>(root, pc);
chs->caches = backFill;
return NextStage(NULL, chs, pc, NULL);
}
@@ -49,18 +49,18 @@ CgiApplicationEngine::PresentStage::run(CgiRequestContext * crc)
}
try {
executeViews(crc);
- header = HttpHeaderPtr(new Project2HttpHeader("200 OK"));
- return NextStage(NULL, this, boost::dynamic_pointer_cast<TransformSource>(presenter), presenter);
+ header = std::make_shared<Project2HttpHeader>("200 OK");
+ return NextStage(NULL, shared_from_this(), std::dynamic_pointer_cast<TransformSource>(presenter.deref()), presenter);
}
catch (EmptyRequiredRows) {
- header = HttpHeaderPtr(new Project2HttpHeader("404 Not found"));
- return NextStage(NULL, this, boost::dynamic_pointer_cast<TransformSource>(presenter), presenter);
+ header = std::make_shared<Project2HttpHeader>("404 Not found");
+ return NextStage(NULL, shared_from_this(), std::dynamic_pointer_cast<TransformSource>(presenter.deref()), presenter);
}
catch (ResponseStagePtr & p) {
- return NextStage(NULL, p, boost::dynamic_pointer_cast<TransformSource>(p), boost::dynamic_pointer_cast<Presenter>(p));
+ return NextStage(NULL, p, std::dynamic_pointer_cast<TransformSource>(p), std::dynamic_pointer_cast<Presenter>(p));
}
catch (StagePtr & p) {
- return NextStage(p, NULL, boost::dynamic_pointer_cast<TransformSource>(p), boost::dynamic_pointer_cast<Presenter>(p));
+ return NextStage(p, NULL, std::dynamic_pointer_cast<TransformSource>(p), std::dynamic_pointer_cast<Presenter>(p));
}
}
diff --git a/project2/cgi/cgiStageRedirect.cpp b/project2/cgi/cgiStageRedirect.cpp
index 18de9f9..ba9e37d 100644
--- a/project2/cgi/cgiStageRedirect.cpp
+++ b/project2/cgi/cgiStageRedirect.cpp
@@ -14,14 +14,14 @@ namespace CgiApplicationExtras {
CgiApplicationEngine::HttpHeaderPtr getHeader(CgiRequestContext *) const
{
- Project2HttpHeader * header = new Project2HttpHeader("301 Moved Permanently");
+ auto header = std::make_shared<Project2HttpHeader>("301 Moved Permanently");
header->addHeader("Location", url);
return CgiApplicationEngine::HttpHeaderPtr(header);
}
CgiApplicationEngine::NextStage run(CgiRequestContext *)
{
- return CgiApplicationEngine::NextStage(NULL, this, NULL, NULL);
+ return CgiApplicationEngine::NextStage(NULL, shared_from_this(), NULL, NULL);
}
private:
const std::string url;
@@ -35,7 +35,7 @@ namespace CgiApplicationExtras {
url(e, "url") {
}
void execute(const MultiRowSetPresenter *, ExecContext * ec) const {
- throw CgiApplicationEngine::ResponseStagePtr(new RedirectStage(url(ec)));
+ throw std::make_shared<RedirectStage>(url(ec));
}
private:
Variable url;
diff --git a/project2/cgi/cgiStageRequest.cpp b/project2/cgi/cgiStageRequest.cpp
index 1cf03c9..d58cf38 100644
--- a/project2/cgi/cgiStageRequest.cpp
+++ b/project2/cgi/cgiStageRequest.cpp
@@ -21,23 +21,23 @@ CgiApplicationEngine::RequestStage::run(CgiRequestContext * ec)
runChecks(ec);
execute(ec);
if (!present(ec).isNull()) {
- return NextStage(new PresentStage(ScriptReader::resolveScript(CgiApplicationEngine::presentRoot, present(ec), false), ec), this);
+ return NextStage(std::make_shared<PresentStage>(ScriptReader::resolveScript(CgiApplicationEngine::presentRoot, present(ec), false), ec), shared_from_this());
}
- return NextStage(NULL, this);
+ return NextStage(NULL, shared_from_this());
}
CgiApplicationEngine::HttpHeaderPtr
CgiApplicationEngine::RequestStage::getHeader(CgiRequestContext * ec) const
{
- Project2HttpHeader * header;
+ HttpHeaderPtr header;
if (redirect(ec).isNull()) {
- header = new Project2HttpHeader("200 OK");
+ header = std::make_shared<Project2HttpHeader>("200 OK");
}
else {
- header = new Project2HttpHeader("301 Moved Permanently");
+ header = std::make_shared<Project2HttpHeader>("301 Moved Permanently");
header->addHeader("Location", redirect(ec));
}
header->addHeader("Cache-control", "no-cache");
- return HttpHeaderPtr(header);
+ return header;
}
diff --git a/project2/cgi/testCgi.cpp b/project2/cgi/testCgi.cpp
index 7f9df28..b1a5a3b 100644
--- a/project2/cgi/testCgi.cpp
+++ b/project2/cgi/testCgi.cpp
@@ -29,9 +29,10 @@ class TestInput : public cgicc::CgiInput, public CgiEnvInput {
typedef std::map<std::string, StrPtr> OptStore;
TestInput(int argc, char ** argv)
{
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(new FileOptions(".testCgi.settings"), "_1", __FILE__, __LINE__);
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(
- new CommandLineArguments(argc, argv, [](const char * url) { urls.push_back(url); }), "_2", __FILE__, __LINE__);
+ AdHoc::PluginManager::getDefault()->create<OptionsSource, FileOptions>(
+ "_1", __FILE__, __LINE__, ".testCgi.settings");
+ AdHoc::PluginManager::getDefault()->create<OptionsSource, CommandLineArguments>(
+ "_2", __FILE__, __LINE__, argc, argv, [](const char * url) { urls.push_back(url); });
}
~TestInput()
{
diff --git a/project2/common/aggregate.cpp b/project2/common/aggregate.cpp
index 07d6902..42e1a42 100644
--- a/project2/common/aggregate.cpp
+++ b/project2/common/aggregate.cpp
@@ -23,6 +23,6 @@ Aggregate::pushValue(ExecContext * ec) const
pushValue(value(ec), ec);
}
-INSTANTIATEFACTORY(ValueAggregate, const ScriptNode *);
-INSTANTIATEFACTORY(SetAggregate, const ScriptNode *);
+INSTANTIATEFACTORY(ValueAggregate, std::shared_ptr<const ScriptNode>);
+INSTANTIATEFACTORY(SetAggregate, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/aggregate.h b/project2/common/aggregate.h
index 90d8248..222cf09 100644
--- a/project2/common/aggregate.h
+++ b/project2/common/aggregate.h
@@ -24,8 +24,8 @@ class DLL_PUBLIC ValueAggregate : public Aggregate {
virtual VariableType resultValue() const = 0;
};
-typedef boost::intrusive_ptr<const ValueAggregate> ValueAggregateCPtr;
-typedef AdHoc::Factory<ValueAggregate, const ScriptNode *> ValueAggregateFactory;
+typedef std::shared_ptr<const ValueAggregate> ValueAggregateCPtr;
+typedef AdHoc::Factory<ValueAggregate, std::shared_ptr<const ScriptNode>> ValueAggregateFactory;
class DLL_PUBLIC SetAggregate : public Aggregate {
public:
@@ -34,7 +34,7 @@ class DLL_PUBLIC SetAggregate : public Aggregate {
virtual void onResultValues(const UseAgg &) const = 0;
};
-typedef boost::intrusive_ptr<const SetAggregate> SetAggregateCPtr;
-typedef AdHoc::Factory<SetAggregate, const ScriptNode *> SetAggregateFactory;
+typedef std::shared_ptr<const SetAggregate> SetAggregateCPtr;
+typedef AdHoc::Factory<SetAggregate, std::shared_ptr<const ScriptNode>> SetAggregateFactory;
#endif
diff --git a/project2/common/check.cpp b/project2/common/check.cpp
index 37879e2..3a29a9b 100644
--- a/project2/common/check.cpp
+++ b/project2/common/check.cpp
@@ -13,7 +13,7 @@ Check::Check(ScriptNodePtr p) :
group(p, "group", "default"),
present(p, "present", "")
{
- p->script->loader.addLoadTarget(p, Storer::into<TestFactory>(&test));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<TestFactory>(&test));
}
Check::~Check()
@@ -29,5 +29,5 @@ Check::performCheck(ExecContext * ec) const
return test->passes(ec);
}
-INSTANTIATEFACTORY(Check, const ScriptNode *);
+INSTANTIATEFACTORY(Check, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/check.h b/project2/common/check.h
index 8b9ce14..73dbacb 100644
--- a/project2/common/check.h
+++ b/project2/common/check.h
@@ -21,8 +21,8 @@ class DLL_PUBLIC Check : public SourceObject {
const Variable present;
TestPtr test;
};
-typedef boost::intrusive_ptr<const Check> CheckCPtr;
-typedef AdHoc::Factory<Check, const ScriptNode *> CheckFactory;
+typedef std::shared_ptr<const Check> CheckCPtr;
+typedef AdHoc::Factory<Check, std::shared_ptr<const ScriptNode>> CheckFactory;
#endif
diff --git a/project2/common/checkHost.cpp b/project2/common/checkHost.cpp
index eb2bae7..8784ad9 100644
--- a/project2/common/checkHost.cpp
+++ b/project2/common/checkHost.cpp
@@ -5,7 +5,7 @@
CheckHost::CheckHost(ScriptNodePtr s) :
CommonObjects(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<CheckFactory>(&checks));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<CheckFactory>(&checks));
}
CheckHost::~CheckHost()
diff --git a/project2/common/columns.cpp b/project2/common/columns.cpp
index f98c4e5..bcb3655 100644
--- a/project2/common/columns.cpp
+++ b/project2/common/columns.cpp
@@ -18,9 +18,9 @@ Column::Column(unsigned int i, const Glib::ustring & n, const Variable & v) :
{
}
-Column *
+std::shared_ptr<Column>
Column::make(unsigned int idx, ScriptNodePtr p)
{
- return new Column(idx, p);
+ return std::make_shared<Column>(idx, p);
}
diff --git a/project2/common/columns.h b/project2/common/columns.h
index 72fd40b..5845c72 100644
--- a/project2/common/columns.h
+++ b/project2/common/columns.h
@@ -7,13 +7,13 @@
#include <boost/multi_index/ordered_index.hpp>
#include <visibility.h>
-class DLL_PUBLIC Column : public IntrusivePtrBase {
+class DLL_PUBLIC Column {
public:
Column(unsigned int idx, ScriptNodePtr p);
Column(unsigned int i, const Glib::ustring & n, const Variable & v = Variable(Null()));
virtual ~Column() = default;
- static Column * make(unsigned int idx, ScriptNodePtr p);
+ static std::shared_ptr<Column> make(unsigned int idx, ScriptNodePtr p);
const unsigned int idx;
const Glib::ustring name;
@@ -23,7 +23,7 @@ class DLL_PUBLIC Column : public IntrusivePtrBase {
struct byColIdx {};
struct byColName {};
-typedef boost::intrusive_ptr<Column> ColumnPtr;
+typedef std::shared_ptr<Column> ColumnPtr;
typedef boost::multi_index::multi_index_container<ColumnPtr,
boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<
diff --git a/project2/common/commonObjects.cpp b/project2/common/commonObjects.cpp
index a2f7d0f..4cf0d9a 100644
--- a/project2/common/commonObjects.cpp
+++ b/project2/common/commonObjects.cpp
@@ -19,7 +19,7 @@ CommonObjects::CommonObjects(ScriptNodePtr s) :
script(s->script),
scriptLoaded(false)
{
- s->script->loader.addLoadTarget(s, Storer::into<RowSetFactory>(&rowSets));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<RowSetFactory>(&rowSets));
}
CommonObjects::~CommonObjects()
diff --git a/project2/common/commonObjects.h b/project2/common/commonObjects.h
index 474e7e4..7ea914d 100644
--- a/project2/common/commonObjects.h
+++ b/project2/common/commonObjects.h
@@ -7,7 +7,7 @@
#include "options.h"
#include <visibility.h>
-class DLL_PUBLIC CommonObjects : public virtual IntrusivePtrBase {
+class DLL_PUBLIC CommonObjects {
public:
typedef STORAGEOF(RowSet) RowSets;
typedef STORAGEOF(DataSource) DataSources;
@@ -27,7 +27,7 @@ class DLL_PUBLIC CommonObjects : public virtual IntrusivePtrBase {
if (i == datasources.end()) {
i = loadDataSource(name);
}
- DataSourceType * s = boost::dynamic_pointer_cast<DataSourceType>(i->second).get();
+ DataSourceType * s = std::dynamic_pointer_cast<DataSourceType>(i->second).get();
if (!s) {
throw DataSourceNotCompatible(name);
}
diff --git a/project2/common/dataSource.cpp b/project2/common/dataSource.cpp
index da1ab52..1c20056 100644
--- a/project2/common/dataSource.cpp
+++ b/project2/common/dataSource.cpp
@@ -8,5 +8,5 @@ DataSource::DataSource(ScriptNodePtr p) :
{
}
-INSTANTIATEFACTORY(DataSource, const ScriptNode *);
+INSTANTIATEFACTORY(DataSource, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/dataSource.h b/project2/common/dataSource.h
index baaaac7..c5326e5 100644
--- a/project2/common/dataSource.h
+++ b/project2/common/dataSource.h
@@ -6,7 +6,7 @@
#include <visibility.h>
class DataSource;
-typedef boost::intrusive_ptr<DataSource> DataSourcePtr;
+typedef std::shared_ptr<DataSource> DataSourcePtr;
/// Base class for data sources providing transaction support
class DLL_PUBLIC DataSource : public SourceObject {
@@ -18,7 +18,7 @@ class DLL_PUBLIC DataSource : public SourceObject {
virtual void commit() { };
virtual void rollback() { };
};
-typedef AdHoc::Factory<DataSource, const ScriptNode *> DataSourceFactory;
+typedef AdHoc::Factory<DataSource, std::shared_ptr<const ScriptNode>> DataSourceFactory;
#endif
diff --git a/project2/common/definedColumns.h b/project2/common/definedColumns.h
index 2459872..1afb305 100644
--- a/project2/common/definedColumns.h
+++ b/project2/common/definedColumns.h
@@ -8,7 +8,7 @@
class DLL_PUBLIC DefinedColumns {
public:
- typedef boost::function2<Column *, unsigned int, ScriptNodePtr> ColCreator;
+ typedef boost::function2<std::shared_ptr<Column>, unsigned int, ScriptNodePtr> ColCreator;
DefinedColumns(ScriptNodePtr p, const Glib::ustring & colPath, const ColCreator & func);
Columns columns;
};
diff --git a/project2/common/execContext.cpp b/project2/common/execContext.cpp
index bbec92a..aaf725e 100644
--- a/project2/common/execContext.cpp
+++ b/project2/common/execContext.cpp
@@ -10,7 +10,7 @@ ExecContext::logMessage(bool writeLog, const Glib::ustring & g, const Glib::ustr
if (writeLog) {
Logger()->messagebf(LOG_NOTICE, "%s: %s: %s", __PRETTY_FUNCTION__, g, m);
}
- messages.push_back(new Message(g, m));
+ messages.push_back(std::make_shared<Message>(g, m));
}
void
diff --git a/project2/common/execContext.h b/project2/common/execContext.h
index 4fcf36c..30e2e0e 100644
--- a/project2/common/execContext.h
+++ b/project2/common/execContext.h
@@ -2,7 +2,6 @@
#define EXECCONTEXT_H
#include <glibmm/ustring.h>
-#include <boost/intrusive_ptr.hpp>
#include <list>
#include "variableType.h"
#include "session.h"
@@ -14,14 +13,14 @@ class IHaveParameters;
class DLL_PUBLIC ExecContext {
public:
- class Message : public IntrusivePtrBase {
+ class Message {
public:
Message(const Glib::ustring & g, const Glib::ustring & m);
const Glib::ustring group;
const Glib::ustring message;
};
- typedef boost::intrusive_ptr<Message> MessagePtr;
+ typedef std::shared_ptr<Message> MessagePtr;
typedef std::list<MessagePtr> Messages;
typedef std::vector<const RowState *> RowValuesStack;
typedef std::vector<const IHaveParameters *> ParameterStack;
diff --git a/project2/common/iHaveParameters.h b/project2/common/iHaveParameters.h
index e8d7519..e76de52 100644
--- a/project2/common/iHaveParameters.h
+++ b/project2/common/iHaveParameters.h
@@ -1,10 +1,8 @@
#ifndef IHAVEPARAMETERS
#define IHAVEPARAMETERS
-#include <boost/intrusive_ptr.hpp>
#include <vector>
#include "variables.h"
-#include "intrusivePtrBase.h"
#include <visibility.h>
/// Mix-in base class to store parameters for component execution
diff --git a/project2/common/lifeCycle.cpp b/project2/common/lifeCycle.cpp
index 60ed172..420632c 100644
--- a/project2/common/lifeCycle.cpp
+++ b/project2/common/lifeCycle.cpp
@@ -1,5 +1,5 @@
#include "lifeCycle.h"
-#include <boost/function/function_fwd.hpp>
+#include <boost/function.hpp>
#include <plugins.impl.h>
LifeCycle::~LifeCycle()
@@ -40,8 +40,8 @@ void
LifeCycle::onAllComponents(const boost::function<void(LifeCycle *)> & func)
{
for(auto p : AdHoc::PluginManager::getDefault()->getAll()) {
- if (auto c = dynamic_cast<LifeCycle *>(p->implementation())) {
- func(c);
+ if (auto c = std::dynamic_pointer_cast<LifeCycle>(p->instance())) {
+ func(c.get());
}
}
}
diff --git a/project2/common/logger.cpp b/project2/common/logger.cpp
index f21bd40..40a72b0 100644
--- a/project2/common/logger.cpp
+++ b/project2/common/logger.cpp
@@ -82,12 +82,6 @@ Log::vmessagef(int priority, const char * msgfmt, va_list va) const
}
-boost::shared_ptr<boost::format>
-Log::getFormat(const std::string & msgfmt)
-{
- return AdHoc::Buffer::getFormat(msgfmt);
-}
-
Log *
Logger::operator->() const
{
diff --git a/project2/common/logger.h b/project2/common/logger.h
index c6c1be0..d5c3c01 100644
--- a/project2/common/logger.h
+++ b/project2/common/logger.h
@@ -4,9 +4,7 @@
#include <map>
#include <stdarg.h>
#include <syslog.h> // Pulled in for easy client lookups of LOG_* priorties
-#include <boost/intrusive_ptr.hpp>
#include <boost/format/format_fwd.hpp>
-#include "intrusivePtrBase.h"
#include <buffer.h>
#include <visibility.h>
#include "lifeCycle.h"
@@ -15,7 +13,7 @@ class LogDriverBase;
class LogDriverFactory;
class DLL_PUBLIC Log {
public:
- typedef boost::intrusive_ptr<LogDriverBase> LogDriverBasePtr;
+ typedef std::shared_ptr<LogDriverBase> LogDriverBasePtr;
typedef std::map<LogDriverFactory *, LogDriverBasePtr> LogDrivers;
Log();
@@ -28,8 +26,8 @@ class DLL_PUBLIC Log {
template <typename... Args>
void messagebf(int priority, const char * msgfmt, const Args & ... args) const {
if (priority > lowestLevel) return;
- boost::shared_ptr<boost::format> fmt = getFormat(msgfmt);
- messagebf(priority, *fmt, args...);
+ boost::format fmt = AdHoc::Buffer::getFormat(msgfmt);
+ messagebf(priority, fmt, args...);
}
void vmessagef(int priority, const char * msgfmt, va_list) const;
diff --git a/project2/common/loggerFactory.h b/project2/common/loggerFactory.h
index 1c6033b..780cbcc 100644
--- a/project2/common/loggerFactory.h
+++ b/project2/common/loggerFactory.h
@@ -3,12 +3,11 @@
#include <factory.h>
#include "lifeCycle.h"
-#include "intrusivePtrBase.h"
#include "logger.h"
#include <visibility.h>
/// Base class for classes providing a logging facility
-class DLL_PUBLIC LogDriverBase : public virtual IntrusivePtrBase {
+class DLL_PUBLIC LogDriverBase {
public:
LogDriverBase();
virtual ~LogDriverBase();
@@ -27,13 +26,13 @@ class LogDriverFactoryImpl : public LogDriverFactory, public LifeCycle {
LogDriverFactoryImpl();
virtual void onConfigLoad() override;
- inline LoggerType * create() const override;
+ inline std::shared_ptr<LogDriverBase> create() const override;
int loggerLevel() const override;
const int & level;
protected:
- mutable boost::intrusive_ptr<LoggerType> instance;
+ mutable std::shared_ptr<LoggerType> instance;
};
#endif
diff --git a/project2/common/loggerFactory.impl.h b/project2/common/loggerFactory.impl.h
index 61711fd..2488c6e 100644
--- a/project2/common/loggerFactory.impl.h
+++ b/project2/common/loggerFactory.impl.h
@@ -20,13 +20,13 @@ LogDriverFactoryImpl<T>::onConfigLoad()
}
template<typename T>
-T *
+std::shared_ptr<LogDriverBase>
LogDriverFactoryImpl<T>::create() const
{
if (!instance) {
- instance = new T();
+ instance = std::make_shared<T>();
}
- return instance.get();
+ return instance;
}
template<typename T>
diff --git a/project2/common/options.cpp b/project2/common/options.cpp
index 7819bd9..20577eb 100644
--- a/project2/common/options.cpp
+++ b/project2/common/options.cpp
@@ -75,7 +75,7 @@ Options::Options(Glib::ustring const & n) :
Options &
Options::operator()(const Glib::ustring & n, TargetPtr t, const Glib::ustring & d)
{
- options.push_back(new NamedOption(n, t, d));
+ options.push_back(std::make_shared<NamedOption>(n, t, d));
return *this;
}
@@ -84,7 +84,7 @@ Options::operator()(const Glib::ustring & a)
{
for (OptionList::const_reverse_iterator i = options.rbegin(); i != options.rend(); ++i) {
if (const NamedOption * no = dynamic_cast<const NamedOption *>(i->get())) {
- options.push_back(new OptionAlias(a, no));
+ options.push_back(std::make_shared<OptionAlias>(a, no));
break;
}
}
diff --git a/project2/common/options.h b/project2/common/options.h
index 4c52649..0d61d2f 100644
--- a/project2/common/options.h
+++ b/project2/common/options.h
@@ -2,7 +2,6 @@
#define OPTIONS_H
#include <glibmm/ustring.h>
-#include <intrusivePtrBase.h>
#include <vector>
#include <list>
#include <boost/bind.hpp>
@@ -19,13 +18,13 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
enum TargetState { Default = 1, Global = 2, Platform = 3 };
typedef boost::function<const Glib::ustring &()> CurrentPlatform;
- class Target : public IntrusivePtrBase {
+ class Target {
public:
virtual void reset() const = 0;
virtual bool paramRequired() const = 0;
virtual void consume(const Glib::ustring & platform, const VariableType & value, const CurrentPlatform & currentPlatform) const = 0;
};
- typedef boost::intrusive_ptr<Target> TargetPtr;
+ typedef std::shared_ptr<Target> TargetPtr;
typedef boost::function<void(const VariableType &)> Assigner;
typedef boost::function<void()> Resetter;
@@ -42,7 +41,7 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
Resetter resetter;
};
- class Option : public IntrusivePtrBase {
+ class Option {
public:
virtual void reset() const = 0;
virtual bool paramRequired() const = 0;
@@ -51,7 +50,7 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
virtual bool accepts(const Glib::ustring & name) const = 0;
virtual void consume(const Glib::ustring & name, const Glib::ustring & platform, const VariableType & value, const CurrentPlatform & currentPlatform) const = 0;
};
- typedef boost::intrusive_ptr<Option> OptionPtr;
+ typedef std::shared_ptr<Option> OptionPtr;
typedef std::list<OptionPtr> OptionList;
Options(const Glib::ustring & name);
@@ -64,7 +63,7 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
static
TargetPtr value(T * t, const D & d = D(),
typename boost::enable_if<std::is_convertible<VariableType, T>, dummy>::type = 0) {
- return new InstanceTarget(
+ return std::make_shared<InstanceTarget>(
[t](const VariableType & v) { *t = v.as<T>(); },
[t, d]() { *t = d; });
}
@@ -73,7 +72,7 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
static
TargetPtr value(T * t, const D & d = D(),
typename boost::disable_if<std::is_convertible<VariableType, T>, dummy>::type = 0) {
- return new InstanceTarget(
+ return std::make_shared<InstanceTarget>(
[t](const VariableType & v) { *t = v.as<std::string>(); },
[t, d]() { *t = d; });
}
@@ -81,12 +80,12 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
template <typename D>
static
TargetPtr function(const Assigner & assigner, const D & d) {
- return new InstanceTarget(assigner, boost::bind(assigner, d));
+ return std::make_shared<InstanceTarget>(assigner, boost::bind(assigner, d));
}
static
TargetPtr functions(const Assigner & assigner, const Resetter & resetter) {
- return new InstanceTarget(assigner, resetter);
+ return std::make_shared<InstanceTarget>(assigner, resetter);
}
void reset() const;
@@ -103,7 +102,7 @@ class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
#define DECLARE_OPTIONS(Type, Label) \
static void init_options_##Type() __attribute__ ((constructor(200))); \
static void init_options_##Type() { \
- Options * o = new Options(Label); \
+ auto o = std::make_shared<Options>(Label); \
Type::InitOptions(*o); \
AdHoc::PluginManager::getDefault()->add<Options>(o, #Type, __FILE__, __LINE__); } \
void Type::InitOptions(Options & o) { o
diff --git a/project2/common/optionsSource.cpp b/project2/common/optionsSource.cpp
index d37a6c6..8f94e3b 100644
--- a/project2/common/optionsSource.cpp
+++ b/project2/common/optionsSource.cpp
@@ -25,7 +25,7 @@ boost::posix_time::ptime OptionsSource::loadedTime = boost::posix_time::special_
template <typename X>
std::set<X *>
-raw(const std::set<boost::shared_ptr<X>> & xs)
+raw(const std::set<std::shared_ptr<X>> & xs)
{
std::set<X *> y;
for (const auto & x : xs) {
diff --git a/project2/common/optionsSource.h b/project2/common/optionsSource.h
index 35905aa..86ebbe9 100644
--- a/project2/common/optionsSource.h
+++ b/project2/common/optionsSource.h
@@ -4,7 +4,6 @@
#include <boost/function.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <glibmm/ustring.h>
-#include <intrusivePtrBase.h>
#include <visibility.h>
#include "scriptLoader.h"
#include "options.h"
diff --git a/project2/common/pch.hpp b/project2/common/pch.hpp
index 2feca3c..757f7ea 100644
--- a/project2/common/pch.hpp
+++ b/project2/common/pch.hpp
@@ -6,11 +6,9 @@
#include <boost/any.hpp>
#include <boost/bind.hpp>
#include <boost/function/function_fwd.hpp>
-#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <glibmm/ustring.h>
-#include <intrusivePtrBase.h>
#include <iostream>
#include <list>
#include <map>
diff --git a/project2/common/presenter.cpp b/project2/common/presenter.cpp
index b4b7379..5636452 100644
--- a/project2/common/presenter.cpp
+++ b/project2/common/presenter.cpp
@@ -121,5 +121,5 @@ MultiRowSetPresenter::finalizeContent() const
{
}
-INSTANTIATEFACTORY(MultiRowSetPresenter, const ScriptNode *, const ObjectSource &, ExecContext *);
+INSTANTIATEFACTORY(MultiRowSetPresenter, std::shared_ptr<const ScriptNode>, const ObjectSource &, ExecContext *);
diff --git a/project2/common/presenter.h b/project2/common/presenter.h
index 6efb6e4..1a0e718 100644
--- a/project2/common/presenter.h
+++ b/project2/common/presenter.h
@@ -1,7 +1,6 @@
#ifndef PRESENTER_H
#define PRESENTER_H
-#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <glibmm/ustring.h>
@@ -9,7 +8,7 @@
#include "scriptLoader.h"
#include <visibility.h>
-class DLL_PUBLIC NameValuePairPresenter : public virtual IntrusivePtrBase {
+class DLL_PUBLIC NameValuePairPresenter : public virtual Something {
public:
NameValuePairPresenter();
virtual ~NameValuePairPresenter();
@@ -72,13 +71,13 @@ class DLL_PUBLIC ContentPresenter {
const Glib::ustring contentType;
};
-typedef boost::intrusive_ptr<const Presenter> PresenterCPtr;
-typedef boost::intrusive_ptr<Presenter> PresenterPtr;
-typedef boost::intrusive_ptr<RowSetPresenter> RowSetPresenterPtr;
-typedef boost::intrusive_ptr<MultiRowSetPresenter> MultiRowSetPresenterPtr;
-typedef boost::intrusive_ptr<NameValuePairPresenter> NameValuePairPresenterPtr;
+typedef std::shared_ptr<const Presenter> PresenterCPtr;
+typedef std::shared_ptr<Presenter> PresenterPtr;
+typedef std::shared_ptr<RowSetPresenter> RowSetPresenterPtr;
+typedef std::shared_ptr<MultiRowSetPresenter> MultiRowSetPresenterPtr;
+typedef std::shared_ptr<NameValuePairPresenter> NameValuePairPresenterPtr;
-typedef AdHoc::Factory<MultiRowSetPresenter, const ScriptNode *, const ObjectSource &, ExecContext *> PresenterFactory;
+typedef AdHoc::Factory<MultiRowSetPresenter, std::shared_ptr<const ScriptNode>, const ObjectSource &, ExecContext *> PresenterFactory;
#endif
diff --git a/project2/common/presenterCache.cpp b/project2/common/presenterCache.cpp
index db597d9..b1b2c94 100644
--- a/project2/common/presenterCache.cpp
+++ b/project2/common/presenterCache.cpp
@@ -13,7 +13,7 @@ PresenterCache::flushCache()
{
}
-INSTANTIATEFACTORY(PresenterCache, const ScriptNode *);
+INSTANTIATEFACTORY(PresenterCache, std::shared_ptr<const ScriptNode>);
class WriteToCache : public TransformImpl<WritableContent, PresenterCache> {
public:
diff --git a/project2/common/presenterCache.h b/project2/common/presenterCache.h
index 48967d6..dba90d0 100644
--- a/project2/common/presenterCache.h
+++ b/project2/common/presenterCache.h
@@ -15,7 +15,7 @@ class DLL_PUBLIC PresenterCache : public SourceObject, public virtual TransformS
virtual void flushCache();
const std::string encoding;
};
-typedef boost::intrusive_ptr<PresenterCache> PresenterCachePtr;
-typedef AdHoc::Factory<PresenterCache, const ScriptNode *> PresenterCacheFactory;
+typedef std::shared_ptr<PresenterCache> PresenterCachePtr;
+typedef AdHoc::Factory<PresenterCache, std::shared_ptr<const ScriptNode>> PresenterCacheFactory;
#endif
diff --git a/project2/common/rowProcessor.cpp b/project2/common/rowProcessor.cpp
index a83fe00..c6a1042 100644
--- a/project2/common/rowProcessor.cpp
+++ b/project2/common/rowProcessor.cpp
@@ -13,8 +13,8 @@ RowProcessor::RowProcessor(ScriptNodePtr p) :
CROE(p->value("cacheRowsOnError", false, NULL)),
IRSE(p->value("ignoreRowSourceError", false, NULL))
{
- p->script->loader.addLoadTarget(p, Storer::into<RowSetCacheFactory>(&caches));
- p->script->loader.addLoadTarget(p, Storer::into<TestFactory>(&tests));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<RowSetCacheFactory>(&caches));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<TestFactory>(&tests));
}
void
diff --git a/project2/common/rowProcessor.h b/project2/common/rowProcessor.h
index 66f99ec..990b228 100644
--- a/project2/common/rowProcessor.h
+++ b/project2/common/rowProcessor.h
@@ -26,7 +26,7 @@ class DLL_PUBLIC RowProcessor : public IHaveParameters {
const bool IRSE;
protected:
- boost::intrusive_ptr<RowSet> source;
+ std::shared_ptr<RowSet> source;
void execute(ExecContext *, const RowProcessorCallback &) const;
private:
diff --git a/project2/common/rowSet.cpp b/project2/common/rowSet.cpp
index cd0b097..8b99586 100644
--- a/project2/common/rowSet.cpp
+++ b/project2/common/rowSet.cpp
@@ -88,5 +88,5 @@ RowState::foreachAttr(const AttrAction &) const
// rowNum is magic, so it doesn't count :)
}
-INSTANTIATEFACTORY(RowSet, const ScriptNode *);
+INSTANTIATEFACTORY(RowSet, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/rowSet.h b/project2/common/rowSet.h
index 30a8c37..eef887a 100644
--- a/project2/common/rowSet.h
+++ b/project2/common/rowSet.h
@@ -13,8 +13,8 @@ class RowSet;
class VariableType;
class RowState;
-typedef boost::intrusive_ptr<RowSet> RowSetPtr;
-typedef boost::intrusive_ptr<const RowSet> ConstRowSetPtr;
+typedef std::shared_ptr<RowSet> RowSetPtr;
+typedef std::shared_ptr<const RowSet> ConstRowSetPtr;
typedef boost::function<void(const RowState *)> RowProcessorCallback;
/// Base class for Project2 components that provide a row set representation of data
@@ -56,7 +56,7 @@ class DLL_PUBLIC RowState {
private:
unsigned int rowNum;
};
-typedef AdHoc::Factory<RowSet, const ScriptNode *> RowSetFactory;
+typedef AdHoc::Factory<RowSet, std::shared_ptr<const ScriptNode>> RowSetFactory;
#endif
diff --git a/project2/common/rowSetCache.cpp b/project2/common/rowSetCache.cpp
index 0380a5d..a4df9b1 100644
--- a/project2/common/rowSetCache.cpp
+++ b/project2/common/rowSetCache.cpp
@@ -48,5 +48,5 @@ RowSetCache::applyKeys(ExecContext * ec, const KeyApplier & f, const IHaveParame
}
}
-INSTANTIATEFACTORY(RowSetCache, const ScriptNode *);
+INSTANTIATEFACTORY(RowSetCache, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/rowSetCache.h b/project2/common/rowSetCache.h
index c8501c9..c600a15 100644
--- a/project2/common/rowSetCache.h
+++ b/project2/common/rowSetCache.h
@@ -9,7 +9,7 @@
class RowSet;
class RowState;
-typedef boost::intrusive_ptr<const RowSet> RowSetCPtr;
+typedef std::shared_ptr<const RowSet> RowSetCPtr;
class DLL_PUBLIC RowSetCache : public IHaveParameters, public virtual SourceObject {
public:
@@ -26,8 +26,8 @@ class DLL_PUBLIC RowSetCache : public IHaveParameters, public virtual SourceObje
void applyKeys(ExecContext * ec, const KeyApplier & f, const IHaveParameters * ps) const;
const bool inherit;
};
-typedef boost::intrusive_ptr<RowSetCache> RowSetCachePtr;
-typedef AdHoc::Factory<RowSetCache, const ScriptNode *> RowSetCacheFactory;
+typedef std::shared_ptr<RowSetCache> RowSetCachePtr;
+typedef AdHoc::Factory<RowSetCache, std::shared_ptr<const ScriptNode>> RowSetCacheFactory;
#endif
diff --git a/project2/common/scriptLoader.cpp b/project2/common/scriptLoader.cpp
index 1d2bc53..e7eb41b 100644
--- a/project2/common/scriptLoader.cpp
+++ b/project2/common/scriptLoader.cpp
@@ -18,15 +18,15 @@ LoaderBase::~LoaderBase()
}
void
-LoaderBase::addLoadTarget(ScriptNodePtr src, boost::intrusive_ptr<Storer> target) {
+LoaderBase::addLoadTarget(ScriptNodePtr src, std::shared_ptr<Storer> target) {
targets[src].push_back(target);
}
void
-LoaderBase::addLoadTargetSub(ScriptNodePtr src, const Glib::ustring & name, bool required, boost::intrusive_ptr<Storer> target)
+LoaderBase::addLoadTargetSub(ScriptNodePtr src, const Glib::ustring & name, bool required, std::shared_ptr<Storer> target)
{
if (ScriptNodePtr c = getSub(src, name, required)) {
- src->script->loader.addLoadTarget(c, target);
+ src->script.lock()->loader.addLoadTarget(c, target);
}
}
@@ -62,7 +62,7 @@ LoaderBase::collectAll(ScriptNodePtr node, LoadedObjects & loadedObjects, bool c
if (!node->obj) {
for (const StorerPtr & s : sts) {
try {
- node->obj = s->create(node.get());
+ node->obj = s->create(node);
break;
}
catch (const AdHoc::NoSuchPluginException &) {
@@ -72,13 +72,13 @@ LoaderBase::collectAll(ScriptNodePtr node, LoadedObjects & loadedObjects, bool c
throw NotSupported(node->get_name());
}
}
- if (SourceObjectPtr p = boost::dynamic_pointer_cast<SourceObject>(node->obj)) {
+ if (SourceObjectPtr p = std::dynamic_pointer_cast<SourceObject>(node->obj)) {
loadedObjects.insert(p.get());
}
for (const StorerPtr & s : sts) {
- if (s->save(node->obj, node.get())) {
+ if (s->save(node->obj, node)) {
stored += 1;
- if (!s->cacheable(node.get())) {
+ if (!s->cacheable(node)) {
node->obj.reset();
}
break;
diff --git a/project2/common/scriptLoader.h b/project2/common/scriptLoader.h
index c5cf853..c9c48b5 100644
--- a/project2/common/scriptLoader.h
+++ b/project2/common/scriptLoader.h
@@ -3,8 +3,6 @@
#include <set>
#include <string>
-#include <boost/intrusive_ptr.hpp>
-#include "intrusivePtrBase.h"
#include "sourceObject.h"
#include <factory.h>
#include "scripts_fwd.h"
@@ -17,11 +15,11 @@ class CommonObjects;
class Storer;
class ScriptReader;
class SourceObject;
-typedef boost::intrusive_ptr<SourceObject> SourceObjectPtr;
+typedef std::shared_ptr<SourceObject> SourceObjectPtr;
class DLL_PUBLIC LoaderBase {
public:
- typedef boost::intrusive_ptr<Storer> StorerPtr;
+ typedef std::shared_ptr<Storer> StorerPtr;
typedef std::vector<StorerPtr> StorerPtrs;
typedef std::map<ScriptNodePtr, StorerPtrs> Targets;
typedef std::set<SourceObject *> LoadedObjects;
@@ -30,8 +28,8 @@ class DLL_PUBLIC LoaderBase {
virtual ~LoaderBase();
void collectAll(const CommonObjects * co, bool childrenOnly);
- void addLoadTarget(ScriptNodePtr src, boost::intrusive_ptr<Storer> target);
- void addLoadTargetSub(ScriptNodePtr src, const Glib::ustring & name, bool required, boost::intrusive_ptr<Storer> target);
+ void addLoadTarget(ScriptNodePtr src, std::shared_ptr<Storer> target);
+ void addLoadTargetSub(ScriptNodePtr src, const Glib::ustring & name, bool required, std::shared_ptr<Storer> target);
void discardLoadTargets();
private:
diff --git a/project2/common/scriptStorage.h b/project2/common/scriptStorage.h
index 4d7cbf4..dd9da8b 100644
--- a/project2/common/scriptStorage.h
+++ b/project2/common/scriptStorage.h
@@ -9,59 +9,58 @@
#include <set>
#include <list>
#include <map>
-#include <boost/intrusive_ptr.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
SimpleMessageException(StoreFailed);
#define STORAGEOF(X) \
- std::map<std::string, boost::intrusive_ptr<X> >
+ std::map<std::string, std::shared_ptr<X> >
#define ANONORDEREDSTORAGEOF(X) \
- std::list<boost::intrusive_ptr<X> >
+ std::list<std::shared_ptr<X> >
#define ANONSTORAGEOF(X) \
- std::set<boost::intrusive_ptr<X> >
+ std::set<std::shared_ptr<X> >
class Storer;
template <class X, class L>
class StorerBase;
-typedef boost::intrusive_ptr<Storer> StorerPtr;
-class Storer : public virtual IntrusivePtrBase {
+typedef std::shared_ptr<Storer> StorerPtr;
+class Storer {
public:
template <class L, typename PtrOfX, typename... C>
- static boost::intrusive_ptr<StorerBase<typename PtrOfX::element_type, L> > into(PtrOfX * obj, const C & ... c);
+ static std::shared_ptr<StorerBase<typename PtrOfX::element_type, L> > into(PtrOfX * obj, const C & ... c);
template <class L, class X, typename... C>
- static boost::intrusive_ptr<StorerBase<X, L> > into(STORAGEOF(X) * map, const C & ... c);
+ static std::shared_ptr<StorerBase<X, L> > into(STORAGEOF(X) * map, const C & ... c);
template <class L, class X, typename... C>
- static boost::intrusive_ptr<StorerBase<X, L> > into(ANONSTORAGEOF(X) * set, const C & ... c);
+ static std::shared_ptr<StorerBase<X, L> > into(ANONSTORAGEOF(X) * set, const C & ... c);
template <class L, class X, typename... C>
- static boost::intrusive_ptr<StorerBase<X, L> > into(ANONORDEREDSTORAGEOF(X) * list, const C & ... c);
+ static std::shared_ptr<StorerBase<X, L> > into(ANONORDEREDSTORAGEOF(X) * list, const C & ... c);
- virtual boost::intrusive_ptr<IntrusivePtrBase> create(const ScriptNode *) const = 0;
- virtual bool save(boost::intrusive_ptr<IntrusivePtrBase>, const ScriptNode *) = 0;
- virtual bool cacheable(const ScriptNode *) const { return true; }
+ virtual std::shared_ptr<Something> create(std::shared_ptr<const ScriptNode>) const = 0;
+ virtual bool save(std::shared_ptr<Something>, std::shared_ptr<const ScriptNode>) = 0;
+ virtual bool cacheable(std::shared_ptr<const ScriptNode>) const { return true; }
};
template <class X, class L>
class StorerBase : public Storer {
public:
- typedef boost::function2<boost::intrusive_ptr<IntrusivePtrBase>, const L *, const ScriptNode *> Creator;
+ typedef boost::function2<std::shared_ptr<Something>, std::shared_ptr<const L>, std::shared_ptr<const ScriptNode>> Creator;
StorerBase(const Creator & c) :
creator(c)
{
}
- boost::intrusive_ptr<IntrusivePtrBase> create(const ScriptNode * p) const {
+ std::shared_ptr<Something> create(std::shared_ptr<const ScriptNode> p) const {
return creator(L::get(p->get_name()), p);
}
- bool cacheable(const ScriptNode * p) const {
+ bool cacheable(std::shared_ptr<const ScriptNode> p) const {
auto f = AdHoc::PluginManager::getDefault()->get<L>(p->get_name());
- if (auto c = dynamic_cast<const LifeCycle *>(f->implementation())) {
+ if (auto c = std::dynamic_pointer_cast<const LifeCycle>(f->implementation())) {
return c->cacheable();
}
return true;
}
- bool save(boost::intrusive_ptr<IntrusivePtrBase> o, const ScriptNode * name) {
- boost::intrusive_ptr<X> O = boost::dynamic_pointer_cast<X>(o);
+ bool save(std::shared_ptr<Something> o, std::shared_ptr<const ScriptNode> name) {
+ std::shared_ptr<X> O = std::dynamic_pointer_cast<X>(o);
if (O) {
if (!insert(O)) {
throw StoreFailed(name->get_name());
@@ -69,7 +68,7 @@ class StorerBase : public Storer {
}
return (O != NULL);
}
- virtual bool insert(boost::intrusive_ptr<X>) = 0;
+ virtual bool insert(std::shared_ptr<X>) = 0;
private:
Creator creator;
};
@@ -81,7 +80,7 @@ class StorerImpl : public StorerBase<X, L> {
StorerImpl(M * o, const typename StorerBase<X, L>::Creator & c) : StorerBase<X, L>(c), obj(o)
{
}
- bool insert(boost::intrusive_ptr<X> O)
+ bool insert(std::shared_ptr<X> O)
{
*obj = O;
return true;
@@ -95,7 +94,7 @@ class StorerImpl<X, STORAGEOF(X), L> : public StorerBase<X, L> {
StorerImpl(STORAGEOF(X) * m, const typename StorerBase<X, L>::Creator & c) : StorerBase<X, L>(c), map(m)
{
}
- bool insert(boost::intrusive_ptr<X> O)
+ bool insert(std::shared_ptr<X> O)
{
return map->insert(typename Map::value_type(O->name, O)).second;
}
@@ -108,7 +107,7 @@ class StorerImpl<X, ANONSTORAGEOF(X), L> : public StorerBase<X, L> {
StorerImpl(ANONSTORAGEOF(X) * m, const typename StorerBase<X, L>::Creator & c) : StorerBase<X, L>(c), map(m)
{
}
- bool insert(boost::intrusive_ptr<X> O)
+ bool insert(std::shared_ptr<X> O)
{
map->insert(O);
return true;
@@ -122,7 +121,7 @@ class StorerImpl<X, ANONORDEREDSTORAGEOF(X), L> : public StorerBase<X, L> {
StorerImpl(ANONORDEREDSTORAGEOF(X) * m, const typename StorerBase<X, L>::Creator & c) : StorerBase<X, L>(c), map(m)
{
}
- bool insert(boost::intrusive_ptr<X> O)
+ bool insert(std::shared_ptr<X> O)
{
map->push_back(O);
return true;
@@ -131,27 +130,27 @@ class StorerImpl<X, ANONORDEREDSTORAGEOF(X), L> : public StorerBase<X, L> {
};
template <class L, class PtrOfX, typename... C>
-boost::intrusive_ptr<StorerBase<typename PtrOfX::element_type, L> >
+std::shared_ptr<StorerBase<typename PtrOfX::element_type, L> >
Storer::into(PtrOfX * obj, const C & ... c) {
- return new StorerImpl<typename PtrOfX::element_type, PtrOfX, L>(obj, boost::bind(&L::create, _1, _2, c...));
+ return std::make_shared<StorerImpl<typename PtrOfX::element_type, PtrOfX, L>>(obj, boost::bind(&L::create, _1, _2, c...));
}
template <class L, class X, typename... C>
-boost::intrusive_ptr<StorerBase<X, L> >
+std::shared_ptr<StorerBase<X, L> >
Storer::into(STORAGEOF(X) * map, const C & ... c) {
- return new StorerImpl<X, STORAGEOF(X), L>(map, boost::bind(&L::create, _1, _2, c...));
+ return std::make_shared<StorerImpl<X, STORAGEOF(X), L>>(map, boost::bind(&L::create, _1, _2, c...));
}
template <class L, class X, typename... C>
-boost::intrusive_ptr<StorerBase<X, L> >
+std::shared_ptr<StorerBase<X, L> >
Storer::into(ANONSTORAGEOF(X) * set, const C & ... c) {
- return new StorerImpl<X, ANONSTORAGEOF(X), L>(set, boost::bind(&L::create, _1, _2, c...));
+ return std::make_shared<StorerImpl<X, ANONSTORAGEOF(X), L>>(set, boost::bind(&L::create, _1, _2, c...));
}
template <class L, class X, typename... C>
-boost::intrusive_ptr<StorerBase<X, L> >
+std::shared_ptr<StorerBase<X, L> >
Storer::into(ANONORDEREDSTORAGEOF(X) * list, const C & ... c) {
- return new StorerImpl<X, ANONORDEREDSTORAGEOF(X), L>(list, boost::bind(&L::create, _1, _2, c...));
+ return std::make_shared<StorerImpl<X, ANONORDEREDSTORAGEOF(X), L>>(list, boost::bind(&L::create, _1, _2, c...));
}
#endif
diff --git a/project2/common/scripts.cpp b/project2/common/scripts.cpp
index 3714d37..0f8bce1 100644
--- a/project2/common/scripts.cpp
+++ b/project2/common/scripts.cpp
@@ -17,18 +17,18 @@ std::string Scripts::scriptNamespacePrefix;
std::string Scripts::scriptNamespace;
ScriptNode::ScriptNode(ScriptReaderPtr s) :
- script(s.get())
+ script(s)
{
}
-VariableImpl *
+Variable::VariableImplPtr
ScriptNode::variable(const Glib::ustring & n, const VariableType & def) const
{
try {
return variable(n);
}
catch (const ValueNotFound &) {
- return new VariableFixed(def);
+ return std::make_shared<VariableFixed>(def);
}
}
diff --git a/project2/common/scripts.h b/project2/common/scripts.h
index d72e567..2d1dcc4 100644
--- a/project2/common/scripts.h
+++ b/project2/common/scripts.h
@@ -1,8 +1,6 @@
#ifndef SCRIPTS_H
#define SCRIPTS_H
-#include "intrusivePtrBase.h"
-#include <boost/intrusive_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/function.hpp>
#include <boost/optional.hpp>
@@ -28,7 +26,7 @@ class DLL_PUBLIC Scripts {
static std::string scriptNamespacePrefix;
};
-class DLL_PUBLIC ScriptNode : public IntrusivePtrBase {
+class DLL_PUBLIC ScriptNode {
public:
ScriptNode(ScriptReaderPtr);
virtual ~ScriptNode() { }
@@ -50,20 +48,20 @@ class DLL_PUBLIC ScriptNode : public IntrusivePtrBase {
virtual bool valueExists(const Glib::ustring & name) const = 0;
virtual bool applyValue(const Glib::ustring & name, VariableType & target, ExecContext *) const = 0;
- virtual VariableImpl * variable(const boost::optional<Glib::ustring> & defaultSource = boost::optional<Glib::ustring>()) const = 0;
- virtual VariableImpl * variable(const Glib::ustring & name) const = 0;
- VariableImpl * variable(const Glib::ustring & name, const VariableType & def) const;
+ virtual std::shared_ptr<VariableImpl> variable(const boost::optional<Glib::ustring> & defaultSource = boost::optional<Glib::ustring>()) const = 0;
+ virtual std::shared_ptr<VariableImpl> variable(const Glib::ustring & name) const = 0;
+ std::shared_ptr<VariableImpl> variable(const Glib::ustring & name, const VariableType & def) const;
VariableType value(const Glib::ustring & name, ExecContext *) const;
VariableType value(const Glib::ustring & name, const VariableType & def, ExecContext *) const;
virtual void composeWithCallbacks(const LiteralCallback &, const NodeCallback &) const = 0;
- const ScriptReader * script;
+ std::weak_ptr<const ScriptReader> script;
private:
friend class LoaderBase;
- mutable boost::intrusive_ptr<IntrusivePtrBase> obj;
+ mutable std::shared_ptr<Something> obj;
};
-class DLL_PUBLIC ScriptReader : public virtual IntrusivePtrBase {
+class DLL_PUBLIC ScriptReader {
public:
typedef boost::tuple<const std::string, const std::string> ScriptKey;
diff --git a/project2/common/scripts_fwd.h b/project2/common/scripts_fwd.h
index 30ed674..92f8e31 100644
--- a/project2/common/scripts_fwd.h
+++ b/project2/common/scripts_fwd.h
@@ -4,9 +4,10 @@
#include <boost/intrusive_ptr.hpp>
#include <visibility.h>
+class DLL_PUBLIC Something;
class DLL_PUBLIC ScriptNode;
class DLL_PUBLIC ScriptReader;
-typedef boost::intrusive_ptr<const ScriptNode> ScriptNodePtr;
-typedef boost::intrusive_ptr<const ScriptReader> ScriptReaderPtr;
+typedef std::shared_ptr<const ScriptNode> ScriptNodePtr;
+typedef std::shared_ptr<const ScriptReader> ScriptReaderPtr;
#endif
diff --git a/project2/common/session.h b/project2/common/session.h
index 1a77a88..4e9f277 100644
--- a/project2/common/session.h
+++ b/project2/common/session.h
@@ -4,15 +4,13 @@
#include <boost/uuid/uuid.hpp>
#include <map>
#include <glibmm/ustring.h>
-#include <boost/intrusive_ptr.hpp>
#include <boost/function.hpp>
-#include "intrusivePtrBase.h"
#include "variables.h"
#include "exceptions.h"
#include <visibility.h>
/// Base class for classes implementing session variable storage
-class DLL_PUBLIC Session : public virtual IntrusivePtrBase {
+class DLL_PUBLIC Session {
public:
SimpleMessageException(VariableNotFound);
typedef std::map<Glib::ustring, VariableType> Values;
@@ -40,7 +38,7 @@ class DLL_PUBLIC Session : public virtual IntrusivePtrBase {
private:
mutable boost::uuids::uuid id;
};
-typedef boost::intrusive_ptr<Session> SessionPtr;
+typedef std::shared_ptr<Session> SessionPtr;
#endif
diff --git a/project2/common/sessionContainer.cpp b/project2/common/sessionContainer.cpp
index 1db2d36..debc216 100644
--- a/project2/common/sessionContainer.cpp
+++ b/project2/common/sessionContainer.cpp
@@ -22,7 +22,7 @@ SessionContainer::GetSession(const boost::uuids::uuid & id) const
{
SessionPtr s;
if (id.is_nil() || !(s = getSession(id))) {
- s = new Session();
+ s = std::make_shared<Session>();
}
s->ExpiryTime(time(NULL) + sessionTimeOut);
return s;
diff --git a/project2/common/sessionContainer.h b/project2/common/sessionContainer.h
index 9d9e173..e7df250 100644
--- a/project2/common/sessionContainer.h
+++ b/project2/common/sessionContainer.h
@@ -2,13 +2,12 @@
#define SESSIONCONTAINER_H
#include <boost/uuid/uuid.hpp>
-#include <intrusivePtrBase.h>
#include "session.h"
#include "options.h"
#include <factory.h>
#include <visibility.h>
-class DLL_PUBLIC SessionContainer : public IntrusivePtrBase {
+class DLL_PUBLIC SessionContainer {
public:
SessionContainer();
virtual ~SessionContainer() = 0;
@@ -22,7 +21,7 @@ class DLL_PUBLIC SessionContainer : public IntrusivePtrBase {
protected:
virtual SessionPtr getSession(const boost::uuids::uuid & sid) const = 0;
};
-typedef boost::intrusive_ptr<SessionContainer> SessionContainerPtr;
+typedef std::shared_ptr<SessionContainer> SessionContainerPtr;
typedef AdHoc::Factory<SessionContainer> SessionContainerFactory;
#endif
diff --git a/project2/common/sourceObject.cpp b/project2/common/sourceObject.cpp
index 09fe94e..2c4845d 100644
--- a/project2/common/sourceObject.cpp
+++ b/project2/common/sourceObject.cpp
@@ -12,13 +12,12 @@ SourceObject::SourceObject(ScriptNodePtr p) :
order(loadOrder++),
script(p->script)
{
- script->namedComponents[name] = this;
+ script.lock()->namedComponents[name] = this;
}
SourceObject::SourceObject(const std::string & n) :
name(n),
- order(loadOrder++),
- script(NULL)
+ order(loadOrder++)
{
}
@@ -44,6 +43,6 @@ SourceObject::registerFor(int eventID, const Event & event) const
SourceObject *
SourceObject::findComponent(const std::string & name) const
{
- return AdHoc::safeMapLookup<ComponentNotFound>(script->namedComponents, name);
+ return AdHoc::safeMapLookup<ComponentNotFound>(script.lock()->namedComponents, name);
}
diff --git a/project2/common/sourceObject.h b/project2/common/sourceObject.h
index 5e3499c..e5244f0 100644
--- a/project2/common/sourceObject.h
+++ b/project2/common/sourceObject.h
@@ -1,12 +1,10 @@
#ifndef SOURCEOBJECT_H
#define SOURCEOBJECT_H
-#include <boost/intrusive_ptr.hpp>
#include <boost/function.hpp>
#include <string>
#include <map>
#include <visibility.h>
-#include <intrusivePtrBase.h>
#include "scriptLoader.h"
#include "scripts_fwd.h"
@@ -15,8 +13,13 @@ enum DLL_PUBLIC ObjectSource {
Scripted
};
class CommonObjects;
+class DLL_PUBLIC Something {
+ public:
+ virtual ~Something() = default;
+};
+
/// Base class for all Project2 components that can be placed in a Project2 script
-class DLL_PUBLIC SourceObject : public virtual IntrusivePtrBase {
+class DLL_PUBLIC SourceObject : public virtual Something {
public:
typedef int EventID;
typedef boost::function<void()> Event;
@@ -41,7 +44,7 @@ class DLL_PUBLIC SourceObject : public virtual IntrusivePtrBase {
static unsigned int loadOrder;
mutable Events events;
- const ScriptReader * const script;
+ std::weak_ptr<const ScriptReader> const script;
};
#endif
diff --git a/project2/common/stream.cpp b/project2/common/stream.cpp
index 98180d8..05bf0ea 100644
--- a/project2/common/stream.cpp
+++ b/project2/common/stream.cpp
@@ -21,5 +21,5 @@ Stream::writeTo(std::ostream & os, const std::string &, ExecContext * ec) const
runStream(boost::bind(&Stream::write, &os, _1, _2), ec);
}
-INSTANTIATEFACTORY(Stream, const ScriptNode *);
+INSTANTIATEFACTORY(Stream, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/stream.h b/project2/common/stream.h
index bffee9b..7b4c25d 100644
--- a/project2/common/stream.h
+++ b/project2/common/stream.h
@@ -21,8 +21,8 @@ class DLL_PUBLIC Stream : public SourceObject, public WritableContent {
protected:
static size_t write(std::ostream * os, const char * data, size_t len);
};
-typedef boost::intrusive_ptr<Stream> StreamPtr;
-typedef AdHoc::Factory<Stream, const ScriptNode *> StreamFactory;
+typedef std::shared_ptr<Stream> StreamPtr;
+typedef AdHoc::Factory<Stream, std::shared_ptr<const ScriptNode>> StreamFactory;
#endif
diff --git a/project2/common/task.cpp b/project2/common/task.cpp
index 54291f2..263304e 100644
--- a/project2/common/task.cpp
+++ b/project2/common/task.cpp
@@ -16,5 +16,5 @@ Task::~Task()
{
}
-INSTANTIATEFACTORY(Task, const ScriptNode *);
+INSTANTIATEFACTORY(Task, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/task.h b/project2/common/task.h
index 4b31809..6db6fd6 100644
--- a/project2/common/task.h
+++ b/project2/common/task.h
@@ -13,7 +13,7 @@ class DLL_PUBLIC Task : public virtual SourceObject {
virtual ~Task();
virtual void execute(ExecContext *) const = 0;
};
-typedef AdHoc::Factory<Task, const ScriptNode *> TaskFactory;
+typedef AdHoc::Factory<Task, std::shared_ptr<const ScriptNode>> TaskFactory;
#endif
diff --git a/project2/common/taskHost.cpp b/project2/common/taskHost.cpp
index 136f481..8dd3fdb 100644
--- a/project2/common/taskHost.cpp
+++ b/project2/common/taskHost.cpp
@@ -12,7 +12,7 @@ TaskHost::TaskHost(ScriptNodePtr s) :
CheckHost(s),
IHaveSubTasks(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<TaskFactory>(&tasks));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<TaskFactory>(&tasks));
}
TaskHost::~TaskHost()
diff --git a/project2/common/test.cpp b/project2/common/test.cpp
index e0e731e..aa500d6 100644
--- a/project2/common/test.cpp
+++ b/project2/common/test.cpp
@@ -11,5 +11,5 @@ Test::reset() const
{
}
-INSTANTIATEFACTORY(Test, const ScriptNode *);
+INSTANTIATEFACTORY(Test, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/test.h b/project2/common/test.h
index edeb22f..73ce61a 100644
--- a/project2/common/test.h
+++ b/project2/common/test.h
@@ -13,7 +13,7 @@ class DLL_PUBLIC Test : public virtual SourceObject {
virtual bool passes(ExecContext *) const = 0;
virtual void reset() const;
};
-typedef boost::intrusive_ptr<const Test> TestPtr;
-typedef AdHoc::Factory<Test, const ScriptNode *> TestFactory;
+typedef std::shared_ptr<const Test> TestPtr;
+typedef AdHoc::Factory<Test, std::shared_ptr<const ScriptNode>> TestFactory;
#endif
diff --git a/project2/common/transform.cpp b/project2/common/transform.cpp
index 7be475f..cf32ead 100644
--- a/project2/common/transform.cpp
+++ b/project2/common/transform.cpp
@@ -11,13 +11,13 @@ class TransformTargetStorer : public Storer {
transformSource(ts)
{
}
- boost::intrusive_ptr<IntrusivePtrBase> create(const ScriptNode * p) const
+ std::shared_ptr<Something> create(std::shared_ptr<const ScriptNode> p) const
{
return TransformTargetFactory::createNew(p->get_name(), p, Scripted);
}
- bool save(boost::intrusive_ptr<IntrusivePtrBase> o, const ScriptNode * s)
+ bool save(std::shared_ptr<Something> o, std::shared_ptr<const ScriptNode> s)
{
- TransformChainLinkPtr O = boost::dynamic_pointer_cast<TransformChainLink>(o);
+ TransformChainLinkPtr O = std::dynamic_pointer_cast<TransformChainLink>(o);
if (O) {
transformSource->addTarget(O, NULL, s);
}
@@ -34,7 +34,7 @@ TransformSource::TransformSource()
TransformSource::TransformSource(ScriptNodePtr s, ObjectSource os)
{
if (os == Scripted) {
- s->script->loader.addLoadTarget(s, new TransformTargetStorer(this));
+ s->script.lock()->loader.addLoadTarget(s, std::make_shared<TransformTargetStorer>(this));
}
}
@@ -42,7 +42,7 @@ TransformChainLink::~TransformChainLink()
{
}
-typedef std::map<std::string, boost::shared_ptr<TransformFactory> > TransformFactoryMap;
+typedef std::map<std::string, std::shared_ptr<TransformFactory> > TransformFactoryMap;
void
TransformSource::addTarget(TransformChainLinkPtr tcl, ExecContext * ec, ScriptNodePtr e)
{
@@ -107,5 +107,5 @@ class TransformStaticContentToStdStream : public TransformImpl<StaticContent, os
DECLARE_TRANSFORM(TransformStaticContentToStdStream);
INSTANTIATEVOIDFACTORY(Transform);
-INSTANTIATEFACTORY(TransformChainLink, const ScriptNode *, ObjectSource);
+INSTANTIATEFACTORY(TransformChainLink, std::shared_ptr<const ScriptNode>, ObjectSource);
diff --git a/project2/common/transform.h b/project2/common/transform.h
index ea9d2f4..86bc275 100644
--- a/project2/common/transform.h
+++ b/project2/common/transform.h
@@ -1,8 +1,6 @@
#ifndef TRANSFORM_H
#define TRANSFORM_H
-#include <boost/intrusive_ptr.hpp>
-#include "intrusivePtrBase.h"
#include "scriptLoader.h"
#include <map>
#include <factory.h>
@@ -11,14 +9,14 @@
class ExecContext;
-class DLL_PUBLIC TransformChainLink : public virtual IntrusivePtrBase {
+class DLL_PUBLIC TransformChainLink : public virtual Something {
public:
virtual ~TransformChainLink() = 0;
};
-typedef boost::intrusive_ptr<TransformChainLink> TransformChainLinkPtr;
+typedef std::shared_ptr<TransformChainLink> TransformChainLinkPtr;
class Transform;
-typedef boost::intrusive_ptr<Transform> TransformPtr;
+typedef std::shared_ptr<Transform> TransformPtr;
typedef std::map<TransformChainLinkPtr, TransformPtr> Targets;
class DLL_PUBLIC TransformSource : public TransformChainLink {
@@ -34,7 +32,7 @@ class DLL_PUBLIC TransformSource : public TransformChainLink {
virtual const TransformChainLink * object() const { return this; }
Targets targets;
};
-typedef boost::intrusive_ptr<TransformSource> TransformSourcePtr;
+typedef std::shared_ptr<TransformSource> TransformSourcePtr;
template <class X>
class SourceOf : public virtual TransformSource {
@@ -44,7 +42,7 @@ class SourceOf : public virtual TransformSource {
virtual operator const X * () const = 0;
};
-class DLL_PUBLIC Transform : public virtual IntrusivePtrBase {
+class DLL_PUBLIC Transform {
public:
virtual void transform(const TransformSource * src, TransformChainLink * dest, ExecContext *) const = 0;
virtual bool canTransform(const TransformSource * src, TransformChainLink * dest) const = 0;
@@ -54,7 +52,7 @@ class DLL_PUBLIC Transform : public virtual IntrusivePtrBase {
typedef AdHoc::Factory<Transform> TransformFactory;
#define DECLARE_TRANSFORM(T) NAMEDFACTORY(#T, T, TransformFactory)
-typedef AdHoc::Factory<TransformChainLink, const ScriptNode *, ObjectSource> TransformTargetFactory;
+typedef AdHoc::Factory<TransformChainLink, std::shared_ptr<const ScriptNode>, ObjectSource> TransformTargetFactory;
#define DECLARE_TRANSFORMTARGET(N, T) NAMEDFACTORY(N, T, TransformTargetFactory)
template <class Source, class Destination>
diff --git a/project2/common/unittests/testConfig.cpp b/project2/common/unittests/testConfig.cpp
index 10e2a04..664fe16 100644
--- a/project2/common/unittests/testConfig.cpp
+++ b/project2/common/unittests/testConfig.cpp
@@ -9,7 +9,7 @@ BOOST_AUTO_TEST_CASE( config_application_value )
TestOptionsSource::LoadTestOptions({
{ "application.data", "testvalue" }
});
- Variable::VariableImplPtr c = VariableFactory::createNew("config", new TestScriptNode({
+ Variable::VariableImplPtr c = VariableFactory::createNew("config", std::make_shared<TestScriptNode, TestScriptNode::Vars>({
{ "name", VariableType("data") }
}));
BOOST_REQUIRE(c);
diff --git a/project2/common/variables.cpp b/project2/common/variables.cpp
index a71ca85..2b789c0 100644
--- a/project2/common/variables.cpp
+++ b/project2/common/variables.cpp
@@ -93,7 +93,7 @@ Variable::Variable(ScriptNodePtr s, const Glib::ustring & n, const VariableType
{
}
-Variable::Variable(VariableImpl * v) :
+Variable::Variable(std::shared_ptr<VariableImpl> v) :
var(v)
{
}
@@ -101,7 +101,7 @@ Variable::Variable(VariableImpl * v) :
Variable &
Variable::operator=(const VariableType & vt)
{
- var = new VariableFixed(vt);
+ var = std::make_shared<VariableFixed>(vt);
return *this;
}
@@ -116,5 +116,5 @@ Variable::fromScriptNode(ScriptNodePtr p)
return p->variable();
}
-INSTANTIATEFACTORY(VariableImpl, const ScriptNode *);
+INSTANTIATEFACTORY(VariableImpl, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/variables.h b/project2/common/variables.h
index c17269a..9073bd8 100644
--- a/project2/common/variables.h
+++ b/project2/common/variables.h
@@ -1,10 +1,8 @@
#ifndef VARIABLES_H
#define VARIABLES_H
-#include <boost/intrusive_ptr.hpp>
#include <boost/optional.hpp>
#include <stdint.h>
-#include "intrusivePtrBase.h"
#include <factory.h>
#include "scripts.h"
#include "variableType.h"
@@ -14,17 +12,15 @@
class ExecContext;
/// Base class for Project2 variable accessors
-class DLL_PUBLIC VariableImpl : public IntrusivePtrBase {
+class DLL_PUBLIC VariableImpl {
public:
virtual VariableType value(ExecContext *) const = 0;
-
- protected:
virtual ~VariableImpl() = default;
};
class DLL_PUBLIC Variable {
public:
- typedef boost::intrusive_ptr<VariableImpl> VariableImplPtr;
+ typedef std::shared_ptr<VariableImpl> VariableImplPtr;
Variable(ScriptNodePtr, const boost::optional<Glib::ustring> & = boost::optional<Glib::ustring>());
Variable(ScriptNodePtr, const Glib::ustring & n);
@@ -38,7 +34,7 @@ class DLL_PUBLIC Variable {
Variable & operator=(const VariableType &);
private:
- Variable(VariableImpl *);
+ Variable(std::shared_ptr<VariableImpl>);
friend class VariableParse;
VariableImplPtr var;
};
@@ -54,7 +50,7 @@ class DLL_PUBLIC VariableImplDyn : public VariableImpl {
};
/// Base class to create variables
-typedef AdHoc::Factory<VariableImpl, const ScriptNode *> VariableFactory;
+typedef AdHoc::Factory<VariableImpl, std::shared_ptr<const ScriptNode>> VariableFactory;
#endif
diff --git a/project2/common/variables/config.cpp b/project2/common/variables/config.cpp
index 9ac3dd0..ebb184d 100644
--- a/project2/common/variables/config.cpp
+++ b/project2/common/variables/config.cpp
@@ -69,9 +69,9 @@ class VariableConfigFactory : public VariableFactory::For<VariableConfig> {
}
};
VariableConfigFactory() :
- opts(new Options("Variables - ModConfig options"))
+ opts(std::make_shared<Options>("Variables - ModConfig options"))
{
- (*opts)(new AppSettings());
+ (*opts)(std::make_shared<AppSettings>());
AdHoc::PluginManager::getDefault()->add<Options>(opts, typeid(AppSettings).name(), __FILE__, __LINE__);
}
@@ -80,12 +80,12 @@ class VariableConfigFactory : public VariableFactory::For<VariableConfig> {
AdHoc::PluginManager::getDefault()->remove<Options>(typeid(AppSettings).name());
}
- const Options * options() const {
+ std::shared_ptr<const Options> options() const {
return opts;
}
private:
- Options * opts;
+ std::shared_ptr<Options> opts;
};
NAMEDPLUGIN("config", VariableConfigFactory, VariableFactory);
diff --git a/project2/common/variables/literal.cpp b/project2/common/variables/literal.cpp
index 4f8e029..06e01cf 100644
--- a/project2/common/variables/literal.cpp
+++ b/project2/common/variables/literal.cpp
@@ -13,7 +13,7 @@ static
void
append(VariableLiteral::Vals * vals, const Y & y)
{
- vals->push_back(new X(y));
+ vals->push_back(std::make_shared<X>(y));
}
VariableLiteral::VariableLiteral(ScriptNodePtr s) {
diff --git a/project2/common/variables/literal.h b/project2/common/variables/literal.h
index 0f743e8..a70ee7b 100644
--- a/project2/common/variables/literal.h
+++ b/project2/common/variables/literal.h
@@ -11,10 +11,10 @@ class DLL_PUBLIC VariableLiteral : public VariableImpl {
VariableLiteral(ScriptNodePtr);
virtual VariableType value(ExecContext * ec) const;
class Part;
- typedef boost::intrusive_ptr<Part> PartCPtr;
+ typedef std::shared_ptr<Part> PartCPtr;
typedef std::list<PartCPtr> Vals;
- class Part : public IntrusivePtrBase {
+ class Part {
public:
virtual void appendTo(ExecContext *, Glib::ustring & str) const = 0;
virtual VariableType value(ExecContext *) const = 0;
diff --git a/project2/common/variables/lookup.cpp b/project2/common/variables/lookup.cpp
index 6c6ca55..7aa1328 100644
--- a/project2/common/variables/lookup.cpp
+++ b/project2/common/variables/lookup.cpp
@@ -34,7 +34,7 @@ class VariableLookup : public VariableImplDyn, public RowProcessor {
RowProcessor(e),
name(e->value("name", NULL).as<Glib::ustring>())
{
- e->script->loader.addLoadTarget(e, Storer::into<RowSetFactory>(&rowSets));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<RowSetFactory>(&rowSets));
}
VariableType value(ExecContext * ec) const
{
diff --git a/project2/common/view.cpp b/project2/common/view.cpp
index d5bd00f..96d2434 100644
--- a/project2/common/view.cpp
+++ b/project2/common/view.cpp
@@ -3,7 +3,7 @@
#include <factory.impl.h>
View::View(ScriptNodePtr p) :
- SourceObject(p.get())
+ SourceObject(p)
{
}
@@ -11,5 +11,5 @@ View::~View()
{
}
-INSTANTIATEFACTORY(View, const ScriptNode *);
+INSTANTIATEFACTORY(View, std::shared_ptr<const ScriptNode>);
diff --git a/project2/common/view.h b/project2/common/view.h
index 1225f11..4ad3c2e 100644
--- a/project2/common/view.h
+++ b/project2/common/view.h
@@ -17,7 +17,7 @@ class DLL_PUBLIC View : public virtual SourceObject {
virtual void execute(const MultiRowSetPresenter *, ExecContext *) const = 0;
};
-typedef AdHoc::Factory<View, const ScriptNode *> ViewFactory;
+typedef AdHoc::Factory<View, std::shared_ptr<const ScriptNode>> ViewFactory;
#endif
diff --git a/project2/common/viewHost.cpp b/project2/common/viewHost.cpp
index a276e99..7a8a7fe 100644
--- a/project2/common/viewHost.cpp
+++ b/project2/common/viewHost.cpp
@@ -8,7 +8,7 @@ ViewHost::ViewHost(ScriptNodePtr s) :
CommonObjects(s),
CheckHost(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<ViewFactory>(&views));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<ViewFactory>(&views));
}
ViewHost::~ViewHost()
@@ -36,7 +36,7 @@ void
ViewHost::doTransforms(ExecContext * ec) const
{
MultiRowSetPresenterPtr presenter = getPresenter(ec);
- TransformSourcePtr ts = boost::dynamic_pointer_cast<TransformSource>(presenter);
+ TransformSourcePtr ts = std::dynamic_pointer_cast<TransformSource>(presenter);
if (ts) {
ts->doTransforms(ec);
}
diff --git a/project2/common/viewHost.h b/project2/common/viewHost.h
index 4405a1a..d4d4c69 100644
--- a/project2/common/viewHost.h
+++ b/project2/common/viewHost.h
@@ -23,7 +23,7 @@ class DLL_PUBLIC ViewHost : virtual public CheckHost, virtual public CommonObjec
typedef ANONORDEREDSTORAGEOF(View) Views;
Views views;
};
-typedef boost::intrusive_ptr<ViewHost> ViewHostPtr;
+typedef std::shared_ptr<ViewHost> ViewHostPtr;
#endif
diff --git a/project2/compression/decompressStream.cpp b/project2/compression/decompressStream.cpp
index 7d4023b..3af4a45 100644
--- a/project2/compression/decompressStream.cpp
+++ b/project2/compression/decompressStream.cpp
@@ -10,7 +10,7 @@ class DecompressStream : public Stream {
Stream(p),
method(p, "method")
{
- p->script->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
}
void runStream(const Sink & sink, ExecContext * ec) const
diff --git a/project2/compression/decompressor.h b/project2/compression/decompressor.h
index 0f3a434..4d9f386 100644
--- a/project2/compression/decompressor.h
+++ b/project2/compression/decompressor.h
@@ -2,16 +2,15 @@
#define DECOMPRESSOR
#include "stream.h"
-#include "intrusivePtrBase.h"
#include <factory.h>
-class DLL_PUBLIC Decompressor : public IntrusivePtrBase {
+class DLL_PUBLIC Decompressor {
public:
virtual ~Decompressor();
virtual void decompress(const char * dataIn, size_t lengthIn, const Stream::Sink &) = 0;
};
-typedef boost::intrusive_ptr<Decompressor> DecompressorPtr;
+typedef std::shared_ptr<Decompressor> DecompressorPtr;
typedef AdHoc::Factory<Decompressor> DecompressorFactory;
#endif
diff --git a/project2/compression/gzip.cpp b/project2/compression/gzip.cpp
index cbccf40..973e4d6 100644
--- a/project2/compression/gzip.cpp
+++ b/project2/compression/gzip.cpp
@@ -34,6 +34,7 @@ class GZip : public Decompressor {
switch (status) {
case Z_NEED_DICT:
status = Z_DATA_ERROR;
+ // fall-through
case Z_DATA_ERROR:
case Z_MEM_ERROR:
throw std::runtime_error("inflate failed");
diff --git a/project2/console/consoleAppEngine.cpp b/project2/console/consoleAppEngine.cpp
index df7010f..a02b34b 100644
--- a/project2/console/consoleAppEngine.cpp
+++ b/project2/console/consoleAppEngine.cpp
@@ -75,7 +75,7 @@ void
ConsoleApplicationEngine::process(ScriptReaderPtr s)
{
try {
- boost::intrusive_ptr<ScriptRunner> sr = new ScriptRunner(s, presenter);
+ auto sr = std::make_shared<ScriptRunner>(s, presenter);
sr->process(this);
}
catch (const std::exception & e) {
diff --git a/project2/console/p2consoleMain.cpp b/project2/console/p2consoleMain.cpp
index 3c86600..3fddc11 100644
--- a/project2/console/p2consoleMain.cpp
+++ b/project2/console/p2consoleMain.cpp
@@ -6,8 +6,8 @@
int
main(int argc, char ** argv)
{
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(
- new CommandLineArguments(argc, argv, &ConsoleApplicationEngine::appendScript), "", __FILE__, __LINE__);
+ AdHoc::PluginManager::getDefault()->create<OptionsSource,
+ CommandLineArguments>("", __FILE__, __LINE__, argc, argv, &ConsoleApplicationEngine::appendScript);
LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1));
ConsoleApplicationEngine app;
diff --git a/project2/daemon/lib/daemon.h b/project2/daemon/lib/daemon.h
index fb850b7..1b33957 100644
--- a/project2/daemon/lib/daemon.h
+++ b/project2/daemon/lib/daemon.h
@@ -3,10 +3,9 @@
#include <glibmm/ustring.h>
#include <factory.h>
-#include <intrusivePtrBase.h>
#include <visibility.h>
-class DLL_PUBLIC Daemon : public IntrusivePtrBase {
+class DLL_PUBLIC Daemon {
public:
Daemon();
virtual ~Daemon();
@@ -17,7 +16,7 @@ class DLL_PUBLIC Daemon : public IntrusivePtrBase {
virtual void shutdown() const = 0;
};
-typedef boost::intrusive_ptr<Daemon> DaemonPtr;
+typedef std::shared_ptr<Daemon> DaemonPtr;
typedef AdHoc::Factory<Daemon, int &, char **> DaemonFactory;
#endif
diff --git a/project2/daemon/p2daemonAppEngine.cpp b/project2/daemon/p2daemonAppEngine.cpp
index 9634ec8..98f6b90 100644
--- a/project2/daemon/p2daemonAppEngine.cpp
+++ b/project2/daemon/p2daemonAppEngine.cpp
@@ -47,7 +47,7 @@ DECLARE_OPTIONS(DaemonAppEngine, "Project2 Daemon options")
"Switch to this group on start up")
("daemon.pidfile", Options::functions([](const VariableType & p) { pidPath = p.as<std::string>(); }, []{ pidPath.reset(); }),
"Write a pid file to this path")
-("daemon.daemonize", new OptionFlagSet(&daemonize),
+("daemon.daemonize", std::make_shared<OptionFlagSet>(&daemonize),
"Detach and run as daemon")
END_OPTIONS(DaemonAppEngine);
diff --git a/project2/daemon/p2daemonMain.cpp b/project2/daemon/p2daemonMain.cpp
index 21eb748..b9f96f3 100644
--- a/project2/daemon/p2daemonMain.cpp
+++ b/project2/daemon/p2daemonMain.cpp
@@ -45,8 +45,8 @@ int
main(int argc, char ** argv)
{
LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1));
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(
- new CommandLineArguments(argc, argv, [](const char * a) { throw UnsupportedArguments(a); }), "_2", __FILE__, __LINE__);
+ AdHoc::PluginManager::getDefault()->create<OptionsSource,
+ CommandLineArguments>("_2", __FILE__, __LINE__, argc, argv, [](const char * a) { throw UnsupportedArguments(a); });
DaemonAppEngine dae(argc, argv);
OptionsSource::loadSources([] { return DaemonAppEngine::reqPlatform;} );
diff --git a/project2/files/fsRows.cpp b/project2/files/fsRows.cpp
index 445f073..47c4d4a 100644
--- a/project2/files/fsRows.cpp
+++ b/project2/files/fsRows.cpp
@@ -32,7 +32,7 @@ const Glib::ustring field_type("type");
static
Columns defCols() {
Columns rtn;
- rtn.insert(new Column(0, "absPath"));
+ rtn.insert(std::make_shared<Column>(0, "absPath"));
return rtn;
}
const Columns FsRows::SearchState::col(defCols());
@@ -51,7 +51,7 @@ FsRows::FsRows(ScriptNodePtr p) :
spec(p, "spec", ""),
ignoreErrors(p, "ignoreerrors", true)
{
- p->script->loader.addLoadTarget(p, Storer::into<SpecBaseFactory>(&specs));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<SpecBaseFactory>(&specs));
}
FsRows::~FsRows()
@@ -238,6 +238,6 @@ FsRows::SearchState::fileType() const
throw NotSupported(__PRETTY_FUNCTION__);
}
-INSTANTIATEFACTORY(FsRows::SpecBase, const ScriptNode *);
+INSTANTIATEFACTORY(FsRows::SpecBase, std::shared_ptr<const ScriptNode>);
INSTANTIATEFACTORY(FsRows::SpecBase, const Glib::ustring &);
diff --git a/project2/files/fsRows.h b/project2/files/fsRows.h
index 773fd75..6e8ff5b 100644
--- a/project2/files/fsRows.h
+++ b/project2/files/fsRows.h
@@ -1,7 +1,6 @@
#ifndef FSROWS_H
#define FSROWS_H
-#include <boost/intrusive_ptr.hpp>
#include <boost/filesystem/path.hpp>
#include <sys/stat.h>
#include "variables.h"
@@ -16,7 +15,7 @@ class CommonObjects;
class DLL_PUBLIC FsRows : public RowSet {
public:
class SearchState;
- class SpecBase : public virtual IntrusivePtrBase {
+ class SpecBase : public virtual Something {
public:
virtual bool recurse(const SearchState * fs, ExecContext *) const;
virtual bool matches(const SearchState * fs, ExecContext *) const;
@@ -25,8 +24,8 @@ class DLL_PUBLIC FsRows : public RowSet {
unsigned int depth(const SearchState * fs) const;
const struct stat & curStat(const SearchState * fs) const;
};
- typedef boost::intrusive_ptr<SpecBase> SpecBasePtr;
- typedef AdHoc::Factory<SpecBase, const ScriptNode *> SpecBaseFactory;
+ typedef std::shared_ptr<SpecBase> SpecBasePtr;
+ typedef AdHoc::Factory<SpecBase, std::shared_ptr<const ScriptNode>> SpecBaseFactory;
typedef AdHoc::Factory<SpecBase, const Glib::ustring &> SpecBaseStringFactory;
typedef ANONSTORAGEOF(SpecBase) SpecBases;
typedef std::list<Glib::ustring> SpecSpec;
diff --git a/project2/files/optionsSource.cpp b/project2/files/optionsSource.cpp
index f8d752d..ae7562e 100644
--- a/project2/files/optionsSource.cpp
+++ b/project2/files/optionsSource.cpp
@@ -52,8 +52,8 @@ DECLARE_OPTIONSSOURCE("Z_configfile", DefaultFileOptions)
DECLARE_OPTIONS(FileOptions, "File Options options")
("file.options.read", Options::functions(
[](const VariableType & vt) {
- auto fo = new FileOptions(vt.as<std::string>());
- extraFileOptions[vt] = boost::shared_ptr<FileOptions>(fo);
+ auto fo = std::make_shared<FileOptions>(vt.as<std::string>());
+ extraFileOptions[vt] = fo;
AdHoc::PluginManager::getDefault()->add<OptionsSource>(fo, vt, __FILE__, __LINE__);
},
[]() {
diff --git a/project2/files/optionsSource.h b/project2/files/optionsSource.h
index 14bab77..337f6b2 100644
--- a/project2/files/optionsSource.h
+++ b/project2/files/optionsSource.h
@@ -7,7 +7,7 @@
#include <visibility.h>
class FileOptions;
-typedef boost::shared_ptr<FileOptions> FileOptionsPtr;
+typedef std::shared_ptr<FileOptions> FileOptionsPtr;
class DLL_PUBLIC FileOptions : public OptionsSource {
public:
diff --git a/project2/files/presenterCache.cpp b/project2/files/presenterCache.cpp
index ec79a0f..8f5dd64 100644
--- a/project2/files/presenterCache.cpp
+++ b/project2/files/presenterCache.cpp
@@ -37,7 +37,7 @@ class FilePresenterCache : public PresenterCache {
typedef std::vector<std::string> Path;
typedef std::map<std::string, VariableType> Parameters;
typedef boost::tuple<Path, Parameters> Key;
- class CacheFile : public IntrusivePtrBase {
+ class CacheFile {
public:
CacheFile(int f) : fd(f) {
}
@@ -47,7 +47,7 @@ class FilePresenterCache : public PresenterCache {
operator int() const { return fd; }
const int fd;
};
- typedef boost::intrusive_ptr<CacheFile> CacheFilePtr;
+ typedef std::shared_ptr<CacheFile> CacheFilePtr;
typedef std::map<Key, CacheFilePtr> OpenCaches;
class WriteCacheFile : public boost::iostreams::sink {
@@ -87,7 +87,7 @@ class FilePresenterCache : public PresenterCache {
FilePresenterCache(ScriptNodePtr s) :
PresenterCache(s),
- idProvider(VariableFactory::createNew(Provider, s.get())) {
+ idProvider(VariableFactory::createNew(Provider, s)) {
}
~FilePresenterCache()
{
@@ -194,7 +194,7 @@ class FilePresenterCache : public PresenterCache {
}
CacheFilePtr openCacheFile(const Key & key, ExecContext * ec) const
{
- CacheFilePtr c = new CacheFile(safesys<OpenCacheFile>(-1, open(getCacheFile(ec).string().c_str(), O_RDONLY)));
+ CacheFilePtr c = std::make_shared<CacheFile>(safesys<OpenCacheFile>(-1, open(getCacheFile(ec).string().c_str(), O_RDONLY)));
openCaches[key] = c;
return c;
}
diff --git a/project2/files/writeStream.cpp b/project2/files/writeStream.cpp
index 485c138..641cde5 100644
--- a/project2/files/writeStream.cpp
+++ b/project2/files/writeStream.cpp
@@ -14,7 +14,7 @@ class WriteStream : public Task {
Task(s),
path(s, "path")
{
- s->script->loader.addLoadTarget(s, Storer::into<StreamFactory>(&stream));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<StreamFactory>(&stream));
}
void execute(ExecContext * ec) const
diff --git a/project2/ice/Jamfile.jam b/project2/ice/Jamfile.jam
index 5d398f4..001ee8f 100644
--- a/project2/ice/Jamfile.jam
+++ b/project2/ice/Jamfile.jam
@@ -4,10 +4,9 @@ alias glibmm : : : :
;
lib dl ;
-lib Slice ;
-lib Ice ;
-lib IceBox ;
-lib IceUtil ;
+lib mcpp ;
+lib Ice : : <name>Ice++11 ;
+lib IceBox : : <name>IceBox++11 ;
lib pthread ;
lib boost_filesystem ;
lib slicer : : : : <include>/usr/include/slicer ;
@@ -20,6 +19,7 @@ cpp-pch pch : pch.hpp :
<library>../common//p2common
<library>glibmm
<library>slicer
+ <library>slice//Slice
;
lib p2iceclient :
@@ -31,8 +31,7 @@ lib p2iceclient :
<library>p2ice
<library>dl
<library>Ice
- <library>Slice
- <library>IceUtil
+ <library>slice//Slice
<library>boost_filesystem
<library>pthread
: :
@@ -52,8 +51,7 @@ lib p2icedaemon :
<library>p2ice
<library>dl
<library>Ice
- <library>Slice
- <library>IceUtil
+ <library>slice//Slice
<library>boost_filesystem
<library>pthread
: :
@@ -62,7 +60,7 @@ lib p2icedaemon :
<include>.
;
-lib p2icebox :
+lib p2icebox++11 :
pch [ glob icebox*.cpp ]
:
<include>../../libmisc
@@ -73,12 +71,10 @@ lib p2icebox :
<library>pthread
<library>Ice
<library>IceBox
- <library>IceUtil
: :
<library>../daemon/lib//p2daemonlib
<library>Ice
<library>IceBox
- <library>IceUtil
<include>.
;
@@ -89,11 +85,11 @@ lib p2ice :
<library>../common//p2common
<library>..//adhocutil
<library>dl
+ <library>mcpp
<library>Ice
- <library>Slice
+ <library>slice//Slice
<library>slicer
<library>slicer-compiler
- <library>IceUtil
<library>boost_filesystem
<library>pthread
: :
diff --git a/project2/ice/buildComms.cpp b/project2/ice/buildComms.cpp
index 0b3aa76..21d89a5 100644
--- a/project2/ice/buildComms.cpp
+++ b/project2/ice/buildComms.cpp
@@ -41,18 +41,17 @@ BuildComms::Build(const boost::filesystem::path & in, const boost::filesystem::p
throw std::runtime_error("slice2cpp failed");
}
unsigned int components = 0;
- if (!iceParts) {
- // We always need to the header, but we can truncate the cpp if we don't need the ice bits
- boost::filesystem::resize_file(out, 0);
- }
- else {
+ if (iceParts) {
components += 1;
}
if (slicerParts) {
Slicer::Slicer s;
s.slicePath = in;
- s.cppPath = out;
+ s.cpp = fopen(out.c_str(), iceParts ? "a" : "w");
+ if (!s.cpp) {
+ throw std::runtime_error("slicer fopen failed");
+ }
components += s.Execute();
}
diff --git a/project2/ice/iceBase.cpp b/project2/ice/iceBase.cpp
index 7a3382c..0cdc9cc 100644
--- a/project2/ice/iceBase.cpp
+++ b/project2/ice/iceBase.cpp
@@ -5,7 +5,7 @@ void
IceBase::SetSlice(Libs & libs, const GetComponentCompiler & gcc, const VariableType & vslice, bool iceParts, bool slicerParts)
{
auto slice = vslice.as<std::string>();
- IceCompile::Ptr bc(new BuildComms(slice, iceParts, slicerParts));
+ auto bc = std::make_shared<BuildComms>(slice, iceParts, slicerParts);
bc->Update(IceCompile::UpdateBuild);
IceCompile::Ptr bcl(gcc(slice, { bc }));
libs.push_back(LibCompile(bcl, new std::thread(&IceCompile::Update, bcl.get(),
diff --git a/project2/ice/iceClient.h b/project2/ice/iceClient.h
index 1c33e78..70bcbbd 100644
--- a/project2/ice/iceClient.h
+++ b/project2/ice/iceClient.h
@@ -31,7 +31,7 @@ class DLL_PUBLIC IceClient : public IceClientBase {
}
protected:
- Interface service;
+ std::shared_ptr<Interface> service;
};
#endif
diff --git a/project2/ice/iceCompile.cpp b/project2/ice/iceCompile.cpp
index b0e5824..6f52e1b 100644
--- a/project2/ice/iceCompile.cpp
+++ b/project2/ice/iceCompile.cpp
@@ -20,7 +20,7 @@ fs::path IceCompile::slicerheaderdir;
DECLARE_OPTIONS(IceCompile, "ICE Compile Options")
("ice.compile.cxx", Options::value(&cxx, "g++"),
"The C++ compiler to use")
-("ice.compile.cxxopts", Options::value(&cxxopts, "-Wall -Werror -std=c++1y -O3 -march=native -fPIC"),
+("ice.compile.cxxopts", Options::value(&cxxopts, "-Wall -Werror -std=c++17 -DICE_CPP11_MAPPING -O3 -march=native -fPIC"),
"The extra arguments to pass to the C++ compiler")
("ice.compile.linker", Options::value(&linker, "g++"),
"The linker to use")
diff --git a/project2/ice/iceCompile.h b/project2/ice/iceCompile.h
index 3c89f69..c06f8b1 100644
--- a/project2/ice/iceCompile.h
+++ b/project2/ice/iceCompile.h
@@ -11,8 +11,8 @@ class IceCompile {
public:
INITOPTIONS;
- typedef boost::shared_ptr<IceCompile> Ptr;
- typedef boost::shared_ptr<const IceCompile> CPtr;
+ typedef std::shared_ptr<IceCompile> Ptr;
+ typedef std::shared_ptr<const IceCompile> CPtr;
typedef std::vector<Ptr> Deps;
static std::string slice2cpp;
diff --git a/project2/ice/iceConvert.h b/project2/ice/iceConvert.h
index 38b07d9..4eff923 100644
--- a/project2/ice/iceConvert.h
+++ b/project2/ice/iceConvert.h
@@ -14,17 +14,17 @@ class DLL_PUBLIC IceConvert {
};
template <typename IceOptionalType>
-class DLL_PUBLIC IceConvert<IceUtil::Optional<IceOptionalType>> {
+class DLL_PUBLIC IceConvert<Ice::optional<IceOptionalType>> {
public:
- static IceUtil::Optional<IceOptionalType> FromVariable(const VariableType & v)
+ static Ice::optional<IceOptionalType> FromVariable(const VariableType & v)
{
if (!boost::get<Null>(&v)) {
return IceConvert<IceOptionalType>::FromVariable(v);
}
- return IceUtil::Optional<IceOptionalType>();
+ return Ice::optional<IceOptionalType>();
}
- static VariableType ToVariable(const IceUtil::Optional<IceOptionalType> & v)
+ static VariableType ToVariable(const Ice::optional<IceOptionalType> & v)
{
if (v) {
return IceConvert<IceOptionalType>::ToVariable(*v);
diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp
index e6769b5..2330d02 100644
--- a/project2/ice/iceDaemon.cpp
+++ b/project2/ice/iceDaemon.cpp
@@ -73,7 +73,7 @@ IceDaemon::setup() const
Logger()->messagebf(LOG_DEBUG, " %s installing servants...", __PRETTY_FUNCTION__);
for(auto p : AdHoc::PluginManager::getDefault()->getAll<IceDaemonAdapterHandlerFactory>()) {
- p->implementation()->create(this)->add(adapter, ic);
+ p->implementation()->create(shared_from_this())->add(adapter, ic);
}
Logger()->messagebf(LOG_DEBUG, " %s starting...", __PRETTY_FUNCTION__);
@@ -96,7 +96,7 @@ class IceDaemonViewHost : public virtual CommonObjects, public virtual CheckHost
CommonObjects(s),
CheckHost(s)
{
- s->script->loader.addLoadTarget(s, Storer::into<FlatViewFactory>(&view));
+ s->script.lock()->loader.addLoadTarget(s, Storer::into<FlatViewFactory>(&view));
}
void executeView(RowSetPresenterPtr presenter, ExecContext * ec) const
{
@@ -111,7 +111,7 @@ class IceDaemonViewHost : public virtual CommonObjects, public virtual CheckHost
}
}
private:
- typedef boost::intrusive_ptr<FlatView> ViewPtr;
+ typedef std::shared_ptr<FlatView> ViewPtr;
ViewPtr view;
};
@@ -141,9 +141,9 @@ void
IceDaemon::executeView(const std::string & name, Slicer::ModelPartPtr p, const ParamMap & pm) const
{
ScriptNodePtr s = ScriptReader::resolveScript(IceDaemon::viewRoot, name, false)->root();
- boost::intrusive_ptr<IceDaemonViewHost> v = new IceDaemonViewHost(s);
+ auto v = std::make_shared<IceDaemonViewHost>(s);
IceCallContext icc(pm);
- v->executeView(new IceViewSerializer(p), &icc);
+ v->executeView(std::make_shared<IceViewSerializer>(p), &icc);
}
class IceDaemonTaskHost : public TaskHost {
@@ -168,7 +168,7 @@ void
IceDaemon::executeTask(const std::string & name, const ParamMap & pm) const
{
ScriptNodePtr s = ScriptReader::resolveScript(IceDaemon::taskRoot, name, false)->root();
- boost::intrusive_ptr<IceDaemonTaskHost> t = new IceDaemonTaskHost(s);
+ auto t = std::make_shared<IceDaemonTaskHost>(s);
IceCallContext icc(pm);
t->executeTask(&icc);
}
@@ -176,7 +176,7 @@ IceDaemon::executeTask(const std::string & name, const ParamMap & pm) const
IceCompile::Ptr
IceDaemon::GetComponentCompiler(const std::string & slice, const IceCompile::Deps & deps)
{
- return IceCompile::Ptr(new BuildDaemon(slice, deps));
+ return std::make_shared<BuildDaemon>(slice, deps);
}
void
diff --git a/project2/ice/iceDaemon.h b/project2/ice/iceDaemon.h
index e61a2b7..70939a5 100644
--- a/project2/ice/iceDaemon.h
+++ b/project2/ice/iceDaemon.h
@@ -6,7 +6,7 @@
#include "iceBase.h"
#include <visibility.h>
-class DLL_PUBLIC IceDaemon : public Daemon, IceBase {
+class DLL_PUBLIC IceDaemon : public Daemon, IceBase, public std::enable_shared_from_this<IceDaemon> {
public:
IceDaemon(int & argc, char ** argv);
virtual ~IceDaemon();
diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp
index cce2dd8..9a13f4c 100644
--- a/project2/ice/iceDataSource.cpp
+++ b/project2/ice/iceDataSource.cpp
@@ -21,7 +21,7 @@ int dummy = 0;
IceDataSource::IceDataSource(ScriptNodePtr p) :
DataSource(p),
endpoint(p, "endpoint"),
- ic(Ice::initialize(dummy, NULL))
+ ic(Ice::initialize())
{
Logger()->messagebf(LOG_DEBUG, "%s: endpoint: %s", __PRETTY_FUNCTION__, endpoint(NULL));
}
@@ -34,7 +34,7 @@ IceDataSource::~IceDataSource()
IceCompile::Ptr
IceDataSource::GetComponentCompiler(const std::string & slice, const IceCompile::Deps & deps)
{
- return IceCompile::Ptr(new BuildClient(slice, deps));
+ return std::make_shared<BuildClient>(slice, deps);
}
void
diff --git a/project2/ice/iceDataSource.h b/project2/ice/iceDataSource.h
index a18efc6..83cc7c0 100644
--- a/project2/ice/iceDataSource.h
+++ b/project2/ice/iceDataSource.h
@@ -16,15 +16,15 @@ class DLL_PUBLIC IceDataSource : public DataSource, IceBase {
~IceDataSource();
template <typename Interface>
- Interface GetProxy(const std::string object, ExecContext * ec) const
+ std::shared_ptr<Interface> GetProxy(const std::string object, ExecContext * ec) const
{
auto existingProxy = proxies.find(object);
if (existingProxy == proxies.end()) {
- auto prx = Interface::checkedCast(ic->stringToProxy(object + ":" + endpoint(ec).as<std::string>()));
+ auto prx = Ice::checkedCast<Interface>(ic->stringToProxy(object + ":" + endpoint(ec).as<std::string>()));
existingProxy = proxies.insert({ object, prx }).first;
return prx;
}
- return Interface::checkedCast(existingProxy->second);
+ return Ice::checkedCast<Interface>(existingProxy->second);
}
const Ice::CommunicatorPtr GetCommunicator() const { return ic; }
@@ -36,7 +36,7 @@ class DLL_PUBLIC IceDataSource : public DataSource, IceBase {
const Variable endpoint;
const Ice::CommunicatorPtr ic;
- typedef std::map<std::string, Ice::ObjectPrx> Proxies;
+ typedef std::map<std::string, Ice::ObjectPrxPtr> Proxies;
mutable Proxies proxies;
};
diff --git a/project2/ice/iceModule.cpp b/project2/ice/iceModule.cpp
index 309e9a5..795103c 100644
--- a/project2/ice/iceModule.cpp
+++ b/project2/ice/iceModule.cpp
@@ -1,9 +1,13 @@
#include <pch.hpp>
+#pragma GCC visibility push(default)
#include "iceModule.h"
#include "iceDaemon.h"
#include <factory.impl.h>
-IceDaemonModule::IceDaemonModule(const std::string & n, const IceDaemon * id) :
+INSTANTIATEFACTORY(IceDaemonModule, std::shared_ptr<const IceDaemon>);
+#pragma GCC visibility pop
+
+IceDaemonModule::IceDaemonModule(const std::string & n, const std::shared_ptr<const IceDaemon> & id) :
name(n),
iceDaemon(id)
{
@@ -20,16 +24,14 @@ IceDaemonModule::executeTask(const std::string & name, const ParamMap & params)
}
void
-IceDaemonModule::add(Ice::ObjectAdapterPtr adapter, Ice::CommunicatorPtr ic)
+IceDaemonModule::add(Ice::ObjectAdapterPtr adapter, Ice::CommunicatorPtr)
{
- adapter->add(this, ic->stringToIdentity(name));
+ adapter->add(ICE_SHARED_FROM_THIS, Ice::stringToIdentity(name));
}
void
-IceDaemonModule::remove(Ice::ObjectAdapterPtr adapter, Ice::CommunicatorPtr ic)
+IceDaemonModule::remove(Ice::ObjectAdapterPtr adapter, Ice::CommunicatorPtr)
{
- adapter->remove(ic->stringToIdentity(name));
+ adapter->remove(Ice::stringToIdentity(name));
}
-INSTANTIATEFACTORY(IceDaemonModule, const IceDaemon *);
-
diff --git a/project2/ice/iceModule.h b/project2/ice/iceModule.h
index 6e55e8a..7e35afb 100644
--- a/project2/ice/iceModule.h
+++ b/project2/ice/iceModule.h
@@ -15,23 +15,23 @@
typedef std::map<std::string, VariableType> ParamMap;
class IceDaemon;
-class DLL_PUBLIC IceDaemonModule : virtual public ::Ice::Object {
+class DLL_PUBLIC IceDaemonModule : virtual public ::Ice::Object, public std::enable_shared_from_this<IceDaemonModule> {
public:
void add(Ice::ObjectAdapterPtr, Ice::CommunicatorPtr);
void remove(Ice::ObjectAdapterPtr, Ice::CommunicatorPtr);
protected:
- IceDaemonModule(const std::string &, const IceDaemon *);
+ IceDaemonModule(const std::string &, const std::shared_ptr<const IceDaemon> &);
void executeTask(const std::string & name, const ParamMap & params) const;
void executeView(const std::string & name, Slicer::ModelPartPtr p, const ParamMap & params) const;
private:
const std::string name;
- const IceDaemon * const iceDaemon;
+ const std::shared_ptr<const IceDaemon> iceDaemon;
};
-typedef AdHoc::Factory<IceDaemonModule, const IceDaemon *> IceDaemonAdapterHandlerFactory;
+typedef AdHoc::Factory<IceDaemonModule, std::shared_ptr<const IceDaemon>> IceDaemonAdapterHandlerFactory;
#endif
diff --git a/project2/ice/iceRows.cpp b/project2/ice/iceRows.cpp
index 88917d2..7d38259 100644
--- a/project2/ice/iceRows.cpp
+++ b/project2/ice/iceRows.cpp
@@ -36,7 +36,7 @@ class IceRowState : public RowState {
void AddColumn(unsigned int & c, const std::string & name)
{
- columns.insert(new Column(c++, name));
+ columns.insert(std::make_shared<Column>(c++, name));
}
const Columns & getColumns() const { return columns; }
diff --git a/project2/ice/iceboxDaemon.cpp b/project2/ice/iceboxDaemon.cpp
index 0e27303..bc0431c 100644
--- a/project2/ice/iceboxDaemon.cpp
+++ b/project2/ice/iceboxDaemon.cpp
@@ -24,8 +24,8 @@ class IceBoxDaemon : public IceBox::Service, public AppInstance {
void start(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &)
{
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(new IceBoxOptionsSource(ic), "service", __FILE__, __LINE__);
- OptionsSource::loadSources([this] { return reqPlatform;} );
+ AdHoc::PluginManager::getDefault()->create<OptionsSource, IceBoxOptionsSource>("service", __FILE__, __LINE__, ic);
+ OptionsSource::loadSources([] { return reqPlatform;} );
int argc = 0;
char ** argv = nullptr;
ic->getLogger()->print("Creating daemon: " + daemonType);
@@ -70,8 +70,8 @@ extern "C" {
IceBox::Service *
createProject2Daemon(Ice::CommunicatorPtr ic)
{
- AdHoc::PluginManager::getDefault()->add<OptionsSource>(new IceBoxOptionsSource(ic), "admin", __FILE__, __LINE__);
- AdHoc::PluginManager::getDefault()->add<LogDriverFactory>(new IceBoxLoggerFactory(ic->getLogger()), "icebox", __FILE__, __LINE__);
+ AdHoc::PluginManager::getDefault()->create<OptionsSource, IceBoxOptionsSource>("admin", __FILE__, __LINE__, ic);
+ AdHoc::PluginManager::getDefault()->create<LogDriverFactory, IceBoxLoggerFactory>("icebox", __FILE__, __LINE__, ic->getLogger());
return new IceBoxDaemon();
}
}
diff --git a/project2/ice/iceboxLogger.cpp b/project2/ice/iceboxLogger.cpp
index 7e1cdd0..ba0749a 100644
--- a/project2/ice/iceboxLogger.cpp
+++ b/project2/ice/iceboxLogger.cpp
@@ -30,13 +30,13 @@ IceBoxLoggerFactory::IceBoxLoggerFactory(Ice::LoggerPtr l) :
{
}
-IceBoxLogDriver *
+std::shared_ptr<LogDriverBase>
IceBoxLoggerFactory::create() const
{
if (!instance) {
- instance = new IceBoxLogDriver(logger);
+ instance = std::make_shared<IceBoxLogDriver>(logger);
}
- return instance.get();
+ return instance;
}
DECLARE_OPTIONS(IceBoxLogDriver, "IceBox log options")
@@ -50,7 +50,7 @@ int IceBoxLogDriver::level;
std::string IceBoxLogDriver::debugCategory;
template<>
-IceBoxLogDriver *
+std::shared_ptr<LogDriverBase>
LogDriverFactoryImpl<IceBoxLogDriver>::create() const
{
return nullptr;
diff --git a/project2/ice/iceboxLogger.h b/project2/ice/iceboxLogger.h
index 5f9145c..7369adc 100644
--- a/project2/ice/iceboxLogger.h
+++ b/project2/ice/iceboxLogger.h
@@ -23,7 +23,7 @@ class DLL_PUBLIC IceBoxLoggerFactory : public LogDriverFactoryImpl<IceBoxLogDriv
public:
IceBoxLoggerFactory(Ice::LoggerPtr l);
- IceBoxLogDriver * create() const override;
+ std::shared_ptr<LogDriverBase> create() const override;
private:
const Ice::LoggerPtr logger;
@@ -31,7 +31,7 @@ class DLL_PUBLIC IceBoxLoggerFactory : public LogDriverFactoryImpl<IceBoxLogDriv
// Specialised as IceBoxLogDriver can't be defualt constructed.
template<>
-IceBoxLogDriver * LogDriverFactoryImpl<IceBoxLogDriver>::create() const;
+std::shared_ptr<LogDriverBase> LogDriverFactoryImpl<IceBoxLogDriver>::create() const;
#endif
diff --git a/project2/ice/slice/Jamroot.jam b/project2/ice/slice/Jamroot.jam
new file mode 100644
index 0000000..46b4e3c
--- /dev/null
+++ b/project2/ice/slice/Jamroot.jam
@@ -0,0 +1,22 @@
+project ice :
+ : requirements
+ ;
+
+path-constant ice : ../../../ice ;
+
+lib Slice :
+ $(ice)/cpp/src/Slice/Parser.cpp
+ $(ice)/cpp/src/Slice/Grammar.cpp
+ $(ice)/cpp/src/Slice/Preprocessor.cpp
+ $(ice)/cpp/src/Slice/CPlusPlusUtil.cpp
+ $(ice)/cpp/src/Slice/SliceUtil.cpp
+ $(ice)/cpp/src/Slice/FileTracker.cpp
+ $(ice)/cpp/src/Slice/Scanner.cpp
+ :
+ <cxxflags>-fPIC
+ <include>$(ice)/cpp/src
+ <link>static
+ : :
+ <include>$(ice)/cpp/src
+ ;
+
diff --git a/project2/ice/slice2Common.cpp b/project2/ice/slice2Common.cpp
index 9bd79aa..c20b855 100644
--- a/project2/ice/slice2Common.cpp
+++ b/project2/ice/slice2Common.cpp
@@ -19,7 +19,7 @@ Slice2Common::FunctionBegin(Slice::OperationPtr o)
// Create typed variables for call
for (const auto & p : o->parameters()) {
if (p->optional()) {
- fprintf(code, "\t\t\t\t\t\tconst auto _%s = IceConvert< ::IceUtil::Optional< %s > >::FromVariable(%s(ec));\n",
+ fprintf(code, "\t\t\t\t\t\tconst auto _%s = IceConvert< ::Ice::optional< %s > >::FromVariable(%s(ec));\n",
p->name().c_str(),
Slice::typeToString(p->type()).c_str(),
p->name().c_str());
diff --git a/project2/ice/slice2Daemon.cpp b/project2/ice/slice2Daemon.cpp
index e9d7922..78596fc 100644
--- a/project2/ice/slice2Daemon.cpp
+++ b/project2/ice/slice2Daemon.cpp
@@ -26,7 +26,7 @@ Slice2Daemon::visitClassDefStart(const Slice::ClassDefPtr & c)
fprintf(code, "\tclass %sImpl : public IceDaemonModule, public %s {\n", c->name().c_str(), c->name().c_str());
fprintf(code, "\t\tpublic:\n");
- fprintf(code, "\t\t\t%sImpl(const IceDaemon * id) :\n", c->name().c_str());
+ fprintf(code, "\t\t\t%sImpl(const std::shared_ptr<const IceDaemon> & id) :\n", c->name().c_str());
fprintf(code, "\t\t\t\tIceDaemonModule(\"%s%s\", id)\n", module.c_str(), c->name().c_str());
fprintf(code, "\t\t\t{\n\t\t\t}\n\n");
return true;
@@ -44,9 +44,10 @@ Slice2Daemon::visitOperation(const Slice::OperationPtr & o)
fprintf(code, "\t\t\tvoid %s(", o->name().c_str());
}
for (const auto & p : o->parameters()) {
- fprintf(code, "%s %s, ", inputTypeToString(p->type(), p->optional(), p->getMetaData(), 0).c_str(), p->name().c_str());
+ fprintf(code, "const %s %s, ", typeToString(p->type(), p->optional(), p->scope(),
+ p->getMetaData(), Slice::TypeContextCpp11).c_str(), p->name().c_str());
}
- fprintf(code, "const ::Ice::Current &) {\n");
+ fprintf(code, "const ::Ice::Current &) override {\n");
visitParameterMap(o);
if (o->returnType()) {
fprintf(code, "\t\t\t\t%s rtn;\n", returnTypeToString(o->returnType(), o->returnIsOptional()).c_str());
diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp
index a702dcf..18757ab 100644
--- a/project2/ice/slice2Rows.cpp
+++ b/project2/ice/slice2Rows.cpp
@@ -55,7 +55,7 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o)
fprintf(code, "\t\t\t\t\tvoid execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const\n");
fprintf(code, "\t\t\t\t\t{\n");
FunctionBegin(o);
- fprintf(code, "\t\t\t\t\t\tSlicer::SerializerPtr toRpc = new RowProcSerializer(ec, rp);\n");
+ fprintf(code, "\t\t\t\t\t\tSlicer::SerializerPtr toRpc = std::make_shared<RowProcSerializer>(ec, rp);\n");
fprintf(code, "\t\t\t\t\t\tauto result = ");
CallOperation(o);
fprintf(code, ";\n");
diff --git a/project2/ice/sliceCompile.cpp b/project2/ice/sliceCompile.cpp
index 0544aea..53832c9 100644
--- a/project2/ice/sliceCompile.cpp
+++ b/project2/ice/sliceCompile.cpp
@@ -18,11 +18,14 @@ SliceCompile::build(const boost::filesystem::path & in, FILE * out) const
Slice::PreprocessorPtr icecpp = Slice::Preprocessor::create("slice2project2", in.string(), cppArgs);
FILE * cppHandle = icecpp->preprocess(false);
- if (cppHandle == NULL) {
+ if (!cppHandle) {
throw std::runtime_error("preprocess failed");
}
Slice::UnitPtr u = Slice::Unit::createUnit(false, false, false, false);
+ if (!u) {
+ throw std::runtime_error("create unit failed");
+ }
AdHoc::ScopeExit uDestroy(boost::bind(&Slice::Unit::destroy, u.get()));
int parseStatus = u->parse(in.string(), cppHandle, false);
diff --git a/project2/ice/unittests/Jamfile.jam b/project2/ice/unittests/Jamfile.jam
index a6471c3..c78d9e5 100644
--- a/project2/ice/unittests/Jamfile.jam
+++ b/project2/ice/unittests/Jamfile.jam
@@ -5,9 +5,10 @@ lib unittestc :
:
<slicer>yes
<library>..//slicer
- <variant>component
+ <library>..//Ice
+ <library>..//pthread
<include>..
- <include>../../common
+ <library>../../common//p2common
<include>/usr/include/adhocutil
<library>..//glibmm
: :
@@ -19,7 +20,8 @@ lib unittest :
:
<slicer>no
<library>..//slicer
- <variant>component
+ <library>..//Ice
+ <library>..//pthread
<include>/usr/include/adhocutil
: :
<include>.
@@ -31,7 +33,8 @@ lib unittestr :
:
<slicer>yes
<library>..//slicer
- <variant>component
+ <library>..//Ice
+ <library>..//pthread
<include>/usr/include/adhocutil
: :
<include>.
@@ -42,7 +45,7 @@ path-constant me : . ;
run
[ glob testClientCompile.cpp ]
- : : :
+ : : unittest unittestr :
<define>ROOT=\"$(me)\"
<dependency>unittest.ice
<dependency>unittest
@@ -51,7 +54,6 @@ run
<library>../../ut//p2ut
<library>../../basics//p2basics
<library>..//Ice
- <library>..//IceUtil
<library>..//boost_filesystem
<dependency>testClient.xml
:
@@ -71,7 +73,6 @@ run
<library>../../xml//p2xml
<library>../../basics//p2basics
<library>..//Ice
- <library>..//IceUtil
<library>..//boost_filesystem
<dependency>testClient.xml
:
@@ -80,7 +81,7 @@ run
run
[ glob testDaemonCompile.cpp ]
- : : :
+ : : unittest unittestr :
<define>ROOT=\"$(me)\"
<dependency>unittest.ice
<dependency>unittest
@@ -89,7 +90,6 @@ run
<library>../../ut//p2ut
<library>../../basics//p2basics
<library>..//Ice
- <library>..//IceUtil
<library>..//boost_filesystem
:
testDaemonCompile :
@@ -108,7 +108,6 @@ run
<library>../../xml//p2xml
<library>../../basics//p2basics
<library>..//Ice
- <library>..//IceUtil
<library>..//boost_filesystem
<dependency>data/unittest-data.xml
<dependency>lib/testrows.xml
@@ -125,7 +124,7 @@ run
run
testIceBoxDaemon.cpp
: : :
- <library>..//p2icebox
+ <library>..//p2icebox++11
<library>../../ut//p2ut
:
testIceBoxDaemon
diff --git a/project2/ice/unittests/conversions.cpp b/project2/ice/unittests/conversions.cpp
index 2758c2b..92620f1 100644
--- a/project2/ice/unittests/conversions.cpp
+++ b/project2/ice/unittests/conversions.cpp
@@ -18,13 +18,13 @@ namespace Slicer {
ptimeToDateTime(const boost::posix_time::ptime & pt)
{
Logger()->messagebf(LOG_DEBUG, "%s", __PRETTY_FUNCTION__);
- return new UnitTestComplex::Date {
+ return std::make_shared<UnitTestComplex::Date>(
pt.date().year(),
pt.date().month(),
pt.date().day(),
(Ice::Int)pt.time_of_day().hours(),
(Ice::Int)pt.time_of_day().minutes(),
- (Ice::Int)pt.time_of_day().seconds() };
+ (Ice::Int)pt.time_of_day().seconds());
}
}
diff --git a/project2/ice/unittests/testClient.cpp b/project2/ice/unittests/testClient.cpp
index e151055..5abedd7 100644
--- a/project2/ice/unittests/testClient.cpp
+++ b/project2/ice/unittests/testClient.cpp
@@ -32,25 +32,25 @@ class Dummy : public UnitTest::SimpleInterface {
UnitTest::SimplePtr SingleRow(const Ice::Current&)
{
- return new UnitTest::Simple { 3, "single" };
+ return std::make_shared<UnitTest::Simple>( 3, "single" );
}
UnitTest::Simples SomeRows(const Ice::Current&)
{
UnitTest::Simples rtn {
- new UnitTest::Simple { 1, "test a" },
- new UnitTest::Simple { 2, "test b" }
+ std::make_shared<UnitTest::Simple>( 1, "test a" ),
+ std::make_shared<UnitTest::Simple>( 2, "test b" )
};
execCount += 1;
return rtn;
}
- UnitTest::Simples SomeRowsParams(Ice::Int pi, const std::string & ps, const Ice::Current&)
+ UnitTest::Simples SomeRowsParams(Ice::Int pi, const std::string ps, const Ice::Current&)
{
UnitTest::Simples rtn {
- new UnitTest::Simple { 0, "before" },
- new UnitTest::Simple { pi, ps },
- new UnitTest::Simple { 2, "after" }
+ std::make_shared<UnitTest::Simple>( 0, "before" ),
+ std::make_shared<UnitTest::Simple>( pi, ps ),
+ std::make_shared<UnitTest::Simple>( 2, "after" )
};
execCount += 1;
return rtn;
@@ -61,7 +61,7 @@ class Dummy : public UnitTest::SimpleInterface {
execCount += 1;
}
- void SomeTaskParams(Ice::Int a, const std::string & b, const Ice::Current&)
+ void SomeTaskParams(Ice::Int a, const std::string b, const Ice::Current&)
{
BOOST_REQUIRE_EQUAL(a, 1);
BOOST_REQUIRE_EQUAL(b, "first");
@@ -80,10 +80,10 @@ class DummyComplex : public UnitTestComplex::ComplexInterface {
UnitTestComplex::ComplexPtr ComplexRow(const Ice::Current&)
{
- return new UnitTestComplex::Complex { 3, "single", new UnitTestComplex::Date { 1980, 7, 9, 1, 2, 3 } };
+ return std::make_shared<UnitTestComplex::Complex>( 3, "single", std::make_shared<UnitTestComplex::Date>(1980, 7, 9, 1, 2, 3) );
}
- void ComplexParam(Ice::Int a, const std::string & b, const UnitTestComplex::DatePtr & d, const Ice::Current&)
+ void ComplexParam(Ice::Int a, const std::string b, const UnitTestComplex::DatePtr d, const Ice::Current&)
{
BOOST_REQUIRE_EQUAL(a, 1);
BOOST_REQUIRE_EQUAL(b, "first");
@@ -114,21 +114,20 @@ commonTests(ExecContext * ec)
BOOST_REQUIRE(RowSetFactory::get("UnitTestComplex-ComplexInterface-ComplexRow"));
BOOST_TEST_CHECKPOINT("Load test script");
- ScriptReaderPtr r = new XmlScriptParser(iceroot / "testClient.xml");
+ ScriptReaderPtr r = std::make_shared<XmlScriptParser>(iceroot / "testClient.xml");
BOOST_TEST_CHECKPOINT("Initialize ICE service");
- int paramCount = 0;
- Ice::CommunicatorPtr ic = Ice::initialize(paramCount, NULL);
+ Ice::CommunicatorPtr ic = Ice::initialize();
auto adapter = ic->createObjectAdapterWithEndpoints("Adp", "tcp -p 12000");
- IceUtil::Handle<Dummy> dummy = new Dummy();
- IceUtil::Handle<DummyComplex> dummyComplex = new DummyComplex();
- adapter->add(dummy, ic->stringToIdentity("testObject"));
- adapter->add(dummyComplex, ic->stringToIdentity("testObjectComplex"));
+ auto dummy = std::make_shared<Dummy>();
+ auto dummyComplex = std::make_shared<DummyComplex>();
+ adapter->add(dummy, Ice::stringToIdentity("testObject"));
+ adapter->add(dummyComplex, Ice::stringToIdentity("testObjectComplex"));
adapter->activate();
AdHoc::ScopeExit _([&ic]{ ic->destroy(); });
BOOST_TEST_CHECKPOINT("Execute test script");
- boost::intrusive_ptr<TestScriptHost> sr = new TestScriptHost(r);
+ auto sr = std::make_shared<TestScriptHost>(r);
BOOST_REQUIRE_EQUAL(dummy->execCount, 0);
BOOST_REQUIRE_EQUAL(dummyComplex->execCount, 0);
sr->process(ec);
diff --git a/project2/ice/unittests/testClientCompile.cpp b/project2/ice/unittests/testClientCompile.cpp
index a299fff..89b0b4b 100644
--- a/project2/ice/unittests/testClientCompile.cpp
+++ b/project2/ice/unittests/testClientCompile.cpp
@@ -13,7 +13,6 @@
#define STR(s) #s
const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path();
const boost::filesystem::path iceroot(XSTR(ROOT));
-const auto componentdir = iceroot / "bin" / bindir.parent_path().leaf() / "component";
const auto headers = iceroot.parent_path().parent_path();
static
@@ -77,7 +76,7 @@ BOOST_AUTO_TEST_CASE( compile_client_clientOnly )
BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
TestOptionsSource::LoadTestOptions({
- { "library", (componentdir / "libunittest.so").string() },
+ { "library", args[1] },
{ "common.datasourceRoot", iceroot.string() },
{ "ice.compile.tmpdir", tmpdir.string() },
{ "ice.compile.headers", headers.string() },
@@ -104,7 +103,7 @@ BOOST_AUTO_TEST_CASE( compile_client_slicer )
BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
TestOptionsSource::LoadTestOptions({
- { "library", (componentdir / "slicer-yes" / "libunittestr.so").string() },
+ { "library", args[2] },
{ "common.datasourceRoot", iceroot.string() },
{ "ice.compile.tmpdir", tmpdir.string() },
{ "ice.compile.headers", headers.string() },
diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp
index 3a31ebd..08eefd0 100644
--- a/project2/ice/unittests/testDaemon.cpp
+++ b/project2/ice/unittests/testDaemon.cpp
@@ -101,16 +101,16 @@ commonTests()
int dummy = 0;
BOOST_TEST_CHECKPOINT("Run daemon");
- DaemonPtr id = new IceDaemon(dummy, NULL);
+ auto id = std::make_shared<IceDaemon>(dummy, nullptr);
id->setup();
std::thread run(&Daemon::run, id.get());
BOOST_TEST_CHECKPOINT("Create and verify proxies");
- Ice::CommunicatorPtr ic = Ice::initialize(dummy, NULL);
- UnitTest::SimpleInterfacePrx si = UnitTest::SimpleInterfacePrx::checkedCast(ic->stringToProxy("UnitTestSimpleInterface:tcp -p 12024"));
+ Ice::CommunicatorPtr ic = Ice::initialize();
+ auto si = Ice::checkedCast<UnitTest::SimpleInterfacePrx>(ic->stringToProxy("UnitTestSimpleInterface:tcp -p 12024"));
BOOST_REQUIRE(si);
si->ice_ping();
- UnitTestComplex::ComplexInterfacePrx sic = UnitTestComplex::ComplexInterfacePrx::checkedCast(ic->stringToProxy("UnitTestComplexComplexInterface:tcp -p 12024"));
+ auto sic = Ice::checkedCast<UnitTestComplex::ComplexInterfacePrx>(ic->stringToProxy("UnitTestComplexComplexInterface:tcp -p 12024"));
BOOST_REQUIRE(sic);
sic->ice_ping();
@@ -177,7 +177,7 @@ commonTests()
BOOST_TEST_CHECKPOINT("Call with complex param");
BOOST_REQUIRE_EQUAL(0, DummyComplexParamTask::execCount);
- sic->ComplexParam(4, "complex", new UnitTestComplex::Date { 1980, 7, 9, 1, 2, 3});
+ sic->ComplexParam(4, "complex", std::make_shared<UnitTestComplex::Date>( 1980, 7, 9, 1, 2, 3 ));
BOOST_REQUIRE_EQUAL(1, DummyComplexParamTask::execCount);
BOOST_REQUIRE_EQUAL(4, DummyComplexParamTask::execA.as<int>());
BOOST_REQUIRE_EQUAL("complex", DummyComplexParamTask::execB.as<std::string>());
diff --git a/project2/ice/unittests/testDaemonCompile.cpp b/project2/ice/unittests/testDaemonCompile.cpp
index c3f7064..08dd3db 100644
--- a/project2/ice/unittests/testDaemonCompile.cpp
+++ b/project2/ice/unittests/testDaemonCompile.cpp
@@ -10,7 +10,6 @@
#define STR(s) #s
const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path();
const boost::filesystem::path iceroot(XSTR(ROOT));
-const auto componentdir = iceroot / "bin" / bindir.parent_path().leaf() / "component";
const auto headers = iceroot.parent_path().parent_path();
static
@@ -63,7 +62,7 @@ BOOST_AUTO_TEST_CASE( compile_daemon_daemonOnly )
BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
TestOptionsSource::LoadTestOptions({
- { "library", (componentdir / "libunittest.so").string() },
+ { "library", args[1] },
{ "ice.compile.tmpdir", tmpdir.string() },
{ "ice.compile.headers", headers.string() },
{ "ice.daemon.slicedaemon", (iceroot / "unittestTypes.ice").string() },
@@ -88,7 +87,7 @@ BOOST_AUTO_TEST_CASE( compile_daemon_slicer )
BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
TestOptionsSource::LoadTestOptions({
- { "library", (componentdir / "slicer-yes" / "libunittestr.so").string() },
+ { "library", args[2] },
{ "ice.compile.tmpdir", tmpdir.string() },
{ "ice.compile.headers", headers.string() },
{ "ice.daemon.slicerdaemon", (iceroot / "unittestTypes.ice").string() },
diff --git a/project2/json/presenter.cpp b/project2/json/presenter.cpp
index fe0a75d..7f20f8e 100644
--- a/project2/json/presenter.cpp
+++ b/project2/json/presenter.cpp
@@ -134,7 +134,7 @@ void
JsonPresenter::writeTo(std::ostream & o, const std::string & encoding, ExecContext * ec) const
{
if (returnObject(ec).isNull()) {
- serializeObject(object, o, encoding);
+ serializeValue(object, o, encoding);
}
else {
serializeValue(*object[returnObject(ec).as<Glib::ustring>().collate_key()], o, encoding);
diff --git a/project2/mail/sendmailTask.cpp b/project2/mail/sendmailTask.cpp
index a201142..1d211fe 100644
--- a/project2/mail/sendmailTask.cpp
+++ b/project2/mail/sendmailTask.cpp
@@ -136,10 +136,10 @@ class TransformWritableContentToEmail : public TransformImpl<WritableContent, Se
}
void transform(const WritableContent * wc, SendMailTask::Parts * parts, ExecContext * ec) const
{
- parts->parts.insert(new BoundaryBegin(wc->getContentType(ec), encoding, wc->getContentClass(ec)));
+ parts->parts.insert(std::make_shared<BoundaryBegin>(wc->getContentType(ec), encoding, wc->getContentClass(ec)));
std::stringstream str;
wc->writeTo(str, encoding, ec);
- parts->parts.insert(new MimeContent(str.str(), wc->getContentClass(ec)));
+ parts->parts.insert(std::make_shared<MimeContent>(str.str(), wc->getContentClass(ec)));
SendMailTask::MailPart::mimeIdx += 1;
}
void configure(ScriptNodePtr s, ExecContext * ec)
@@ -153,7 +153,7 @@ DECLARE_TRANSFORM(TransformWritableContentToEmail);
class EmailViewHost : public ViewHost {
public:
- EmailViewHost(boost::intrusive_ptr<SendMailTask::Parts> & ps, ScriptNodePtr node) :
+ EmailViewHost(std::shared_ptr<SendMailTask::Parts> & ps, ScriptNodePtr node) :
CommonObjects(node),
CheckHost(node),
ViewHost(node),
@@ -163,9 +163,9 @@ class EmailViewHost : public ViewHost {
MultiRowSetPresenterPtr getPresenter(ExecContext * ec) const {
if (!presenter) {
Logger()->message(LOG_DEBUG, "Building default email transform chain");
- XmlPresenterPtr xpp = new XmlPresenter(n, Default, ec);
- HtmlDocument * hd = new HtmlDocument(n, Default);
- TextDocument * td = new TextDocument(n, Default);
+ XmlPresenterPtr xpp = std::make_shared<XmlPresenter>(n, Default, ec);
+ auto hd = std::make_shared<HtmlDocument>(n, Default);
+ auto td = std::make_shared<TextDocument>(n, Default);
xpp->addTarget(hd, ec, n);
hd->addTarget(parts, ec, NULL);
hd->addTarget(td, ec, n);
@@ -175,7 +175,7 @@ class EmailViewHost : public ViewHost {
return presenter;
}
private:
- boost::intrusive_ptr<SendMailTask::Parts> & parts;
+ std::shared_ptr<SendMailTask::Parts> & parts;
ScriptNodePtr n;
mutable MultiRowSetPresenterPtr presenter;
};
@@ -183,17 +183,17 @@ class EmailViewHost : public ViewHost {
void
SendMailTask::execute(ExecContext * ec) const
{
- boost::intrusive_ptr<Parts> parts = new Parts();
+ auto parts = std::make_shared<Parts>();
MailPart::mimeIdx = 0;
- parts->parts.insert(new Header("To", to(ec)));
- parts->parts.insert(new Header("From", from(ec)));
- parts->parts.insert(new Header("Subject", subject(ec)));
- parts->parts.insert(new Header("Content-Type", "multipart/alternative; boundary=\"<<divider>>\""));
- parts->parts.insert(new Header("MIME-Version", "1.0"));
- parts->parts.insert(new Header("Content-Transfer-Encoding", "binary"));
- parts->parts.insert(new BoundaryEnd());
-
- ViewHostPtr vsp = new EmailViewHost(parts, ScriptReader::resolveScript("emails", present(ec), false)->root());
+ parts->parts.insert(std::make_shared<Header>("To", to(ec)));
+ parts->parts.insert(std::make_shared<Header>("From", from(ec)));
+ parts->parts.insert(std::make_shared<Header>("Subject", subject(ec)));
+ parts->parts.insert(std::make_shared<Header>("Content-Type", "multipart/alternative; boundary=\"<<divider>>\""));
+ parts->parts.insert(std::make_shared<Header>("MIME-Version", "1.0"));
+ parts->parts.insert(std::make_shared<Header>("Content-Transfer-Encoding", "binary"));
+ parts->parts.insert(std::make_shared<BoundaryEnd>());
+
+ ViewHostPtr vsp = std::make_shared<EmailViewHost>(parts, ScriptReader::resolveScript("emails", present(ec), false)->root());
vsp->executeViews(ec);
vsp->doTransforms(ec);
parts->part = parts->parts.begin();
diff --git a/project2/mail/sendmailTask.h b/project2/mail/sendmailTask.h
index 80341d3..f557130 100644
--- a/project2/mail/sendmailTask.h
+++ b/project2/mail/sendmailTask.h
@@ -1,7 +1,6 @@
#ifndef SENDMAILTASK_H
#define SENDMAILTASK_H
-#include <boost/intrusive_ptr.hpp>
#include <map>
#include "task.h"
#include "transform.h"
@@ -12,7 +11,7 @@
/// Project2 component to send an email
class DLL_PUBLIC SendMailTask : public Task {
public:
- class MailPart : public IntrusivePtrBase {
+ class MailPart {
public:
MailPart(uint8_t, uint8_t, uint8_t);
~MailPart();
@@ -20,7 +19,7 @@ class DLL_PUBLIC SendMailTask : public Task {
const uint8_t sec, ind, prt;
static uint8_t mimeIdx;
};
- typedef boost::intrusive_ptr<MailPart> MailPartPtr;
+ typedef std::shared_ptr<MailPart> MailPartPtr;
class SortMailParts {
public:
bool operator()(const MailPartPtr &, const MailPartPtr &) const;
diff --git a/project2/sql/mockDatasource.cpp b/project2/sql/mockDatasource.cpp
index 9f21e44..8246f9b 100644
--- a/project2/sql/mockDatasource.cpp
+++ b/project2/sql/mockDatasource.cpp
@@ -4,7 +4,7 @@
NAMEDPLUGIN("mock", MockConnectionFactory, DB::ConnectionFactory);
-DB::Connection *
+DB::ConnectionPtr
MockConnectionFactory::create(const std::string & n) const
{
return DB::MockDatabase::openConnectionTo(n);
diff --git a/project2/sql/mockDatasource.h b/project2/sql/mockDatasource.h
index e9a9732..b97af9b 100644
--- a/project2/sql/mockDatasource.h
+++ b/project2/sql/mockDatasource.h
@@ -5,7 +5,7 @@
class MockConnectionFactory : public DB::ConnectionFactory {
public:
- DB::Connection * create(const std::string &) const;
+ DB::ConnectionPtr create(const std::string &) const;
};
#endif
diff --git a/project2/sql/rdbmsDataSource.cpp b/project2/sql/rdbmsDataSource.cpp
index a3bb6a1..15ae638 100644
--- a/project2/sql/rdbmsDataSource.cpp
+++ b/project2/sql/rdbmsDataSource.cpp
@@ -200,7 +200,7 @@ RdbmsDataSource::connectTo(const ConnectionInfo & dsn)
}
}
-RdbmsDataSource::RdbmsConnection::RdbmsConnection(DB::Connection * const con, time_t kat) :
+RdbmsDataSource::RdbmsConnection::RdbmsConnection(DB::ConnectionPtr const con, time_t kat) :
connection(con),
txOpen(false),
lastUsedTime(0),
@@ -212,7 +212,6 @@ RdbmsDataSource::RdbmsConnection::RdbmsConnection(DB::Connection * const con, ti
RdbmsDataSource::RdbmsConnection::~RdbmsConnection()
{
connection->finish();
- delete connection;
}
void
@@ -248,7 +247,7 @@ RdbmsDataSource::ConnectionInfo::ConnectionInfo(ScriptNodePtr node) :
{
}
-DB::Connection *
+DB::ConnectionPtr
RdbmsDataSource::ConnectionInfo::connect() const
{
return DB::ConnectionFactory::createNew(typeId, dsn);
@@ -291,7 +290,7 @@ RdbmsDataSource::ConnectionRef::operator=(const RdbmsDataSource::ConnectionRef &
DB::Connection *
RdbmsDataSource::ConnectionRef::operator->() const
{
- return conn->connection;
+ return conn->connection.get();
}
DB::Connection &
@@ -303,6 +302,6 @@ RdbmsDataSource::ConnectionRef::operator*() const
DB::Connection *
RdbmsDataSource::ConnectionRef::get() const
{
- return conn->connection;
+ return conn->connection.get();
}
diff --git a/project2/sql/rdbmsDataSource.h b/project2/sql/rdbmsDataSource.h
index 807ad3f..b1cb74c 100644
--- a/project2/sql/rdbmsDataSource.h
+++ b/project2/sql/rdbmsDataSource.h
@@ -18,14 +18,14 @@ class DLL_PUBLIC RdbmsDataSource : public DataSource {
class RdbmsConnection {
public:
- RdbmsConnection(DB::Connection * const connection, time_t kat);
+ RdbmsConnection(DB::ConnectionPtr const connection, time_t kat);
~RdbmsConnection();
void touch() const;
bool isExpired() const;
- DB::Connection * const connection;
+ DB::ConnectionPtr const connection;
bool txOpen;
- boost::optional<std::thread::id> threadId;
+ std::optional<std::thread::id> threadId;
private:
friend class ConnectionRef;
@@ -56,7 +56,7 @@ class DLL_PUBLIC RdbmsDataSource : public DataSource {
public:
ConnectionInfo(ScriptNodePtr);
- DB::Connection * connect() const;
+ DB::ConnectionPtr connect() const;
bool operator<(const ConnectionInfo & o) const;
diff --git a/project2/sql/sqlBulkLoad.cpp b/project2/sql/sqlBulkLoad.cpp
index 96a590e..fc7e7e1 100644
--- a/project2/sql/sqlBulkLoad.cpp
+++ b/project2/sql/sqlBulkLoad.cpp
@@ -15,7 +15,7 @@ class SqlBulkLoad : public Task, SqlBase {
targetTable(p, "targettable"),
extras(p, "extras")
{
- p->script->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
}
void execute(ExecContext * ec) const
diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp
index db05543..79e2e83 100644
--- a/project2/sql/sqlCache.cpp
+++ b/project2/sql/sqlCache.cpp
@@ -16,9 +16,6 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
-typedef boost::shared_ptr<DB::SelectCommand> SelectPtr;
-typedef boost::shared_ptr<DB::ModifyCommand> ModifyPtr;
-
class SqlCache : public RowSetCache {
public:
SqlCache(ScriptNodePtr p) :
@@ -56,12 +53,12 @@ class SqlCache : public RowSetCache {
static void bindKeyValues(DB::Command * cmd, unsigned int * offset, const VariableType & v)
{
- boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(cmd, (*offset)++), v);
+ boost::apply_visitor(SqlVariableBinder(cmd, (*offset)++), v);
}
class SqlCacheRowSet : public RowSet {
public:
- SqlCacheRowSet(SelectPtr r) :
+ SqlCacheRowSet(DB::SelectCommandPtr r) :
SourceObject(ScriptNodePtr()),
RowSet(NULL),
s(r) {
@@ -100,7 +97,7 @@ class SqlCache : public RowSetCache {
const DB::Column & col = (*s)[c];
if (!boost::algorithm::starts_with(col.name, "p2attr_") &&
!boost::algorithm::starts_with(col.name, "p2_")) {
- ss.columns.insert(new Column(colNo++, col.name));
+ ss.columns.insert(std::make_shared<Column>(colNo++, col.name));
colCols.push_back(c);
}
}
@@ -122,7 +119,7 @@ class SqlCache : public RowSetCache {
} while (s->fetch());
}
private:
- SelectPtr s;
+ DB::SelectCommandPtr s;
mutable std::vector<unsigned int> colCols;
mutable int64_t cacheId;
};
@@ -141,12 +138,12 @@ class SqlCache : public RowSetCache {
applyKeys(ec, boost::bind(appendKeyAnds, &sql, _1), ps);
sql.appendf(" ORDER BY r.p2_cacheid DESC, r.p2_row");
auto con = db->getReadonly();
- SelectPtr gh(con->newSelectCommand(sql));
+ auto gh = con->select(sql);
unsigned int offset = 0;
gh->bindParamT(offset++, boost::posix_time::microsec_clock::universal_time() - boost::posix_time::seconds(CacheLife));
applyKeys(ec, boost::bind(bindKeyValues, gh.get(), &offset, _2), ps);
if (gh->fetch()) {
- return new SqlCacheRowSet(gh);
+ return std::make_shared<SqlCacheRowSet>(gh);
}
return NULL;
}
@@ -185,14 +182,14 @@ class SqlCache : public RowSetCache {
}
sql.appendf(")");
auto con = db->getWritable();
- ModifyPtr m(con->newModifyCommand(sql));
+ auto m = con->modify(sql);
unsigned int offset = 0;
m->bindParamI(offset++, row++);
for (const Values::value_type & a : attrs) {
- boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), a.second);
+ boost::apply_visitor(SqlVariableBinder(m.get(), offset++), a.second);
}
for (const Values::value_type & v : cols) {
- boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(m.get(), offset++), v.second);
+ boost::apply_visitor(SqlVariableBinder(m.get(), offset++), v.second);
}
m->execute();
cols.clear();
@@ -211,12 +208,12 @@ class SqlCache : public RowSetCache {
AdHoc::Buffer sp;
sp.appendf("SAVEPOINT sp%p", this);
auto con = db->getWritable();
- ModifyPtr s = ModifyPtr(con->newModifyCommand(sp));
+ auto s = con->modify(sp);
s->execute();
// Header
AdHoc::Buffer del;
del.appendf("INSERT INTO %s(p2_time) VALUES(?)", HeaderTable.c_str());
- ModifyPtr h = ModifyPtr(con->newModifyCommand(del));
+ auto h = con->modify(del);
h->bindParamT(0, boost::posix_time::microsec_clock::universal_time());
h->execute();
// Record set header
@@ -228,11 +225,11 @@ class SqlCache : public RowSetCache {
offset = 0;
applyKeys(ec, boost::bind(appendKeyBinds, &sql, &offset), ps);
sql.appendf(")");
- ModifyPtr m(con->newModifyCommand(sql));
+ auto m = con->modify(sql);
offset = 0;
applyKeys(ec, boost::bind(bindKeyValues, m.get(), &offset, _2), ps);
m->execute();
- return new SqlCachePresenter(n, f, db);
+ return std::make_shared<SqlCachePresenter>(n, f, db);
}
void save(ExecContext *, const Glib::ustring & , const Glib::ustring & , const IHaveParameters * )
@@ -240,7 +237,7 @@ class SqlCache : public RowSetCache {
AdHoc::Buffer sp;
sp.appendf("RELEASE SAVEPOINT sp%p", this);
auto con = db->getWritable();
- ModifyPtr s = ModifyPtr(con->newModifyCommand(sp));
+ auto s = con->modify(sp);
s->execute();
}
@@ -249,7 +246,7 @@ class SqlCache : public RowSetCache {
AdHoc::Buffer sp;
sp.appendf("ROLLBACK TO SAVEPOINT sp%p", this);
auto con = db->getWritable();
- ModifyPtr s = ModifyPtr(con->newModifyCommand(sp));
+ auto s = con->modify(sp);
s->execute();
}
@@ -272,10 +269,10 @@ class CustomSqlCacheFactory : public RowSetCacheFactory::For<SqlCache>, public L
{
try {
if (!SqlCache::DataSource.empty()) {
- boost::intrusive_ptr<CommonObjects> co = new CommonObjects();
+ std::shared_ptr<CommonObjects> co = std::make_shared<CommonObjects>();
RdbmsDataSource * db = co->dataSource<RdbmsDataSource>(SqlCache::DataSource);
auto con = db->getWritable();
- ModifyPtr m(con->newModifyCommand(stringbf("DELETE FROM %s WHERE p2_time < ?", SqlCache::HeaderTable)));
+ auto m = con->modify(stringbf("DELETE FROM %s WHERE p2_time < ?", SqlCache::HeaderTable));
m->bindParamT(0, boost::posix_time::microsec_clock::universal_time() - boost::posix_time::seconds(SqlCache::CacheLife));
m->execute();
db->commit();
diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp
index 6b1bb75..f78862f 100644
--- a/project2/sql/sqlMergeTask.cpp
+++ b/project2/sql/sqlMergeTask.cpp
@@ -15,12 +15,12 @@
#include <boost/bind.hpp>
bool SqlMergeTask::defaultUseTempTable = true;
-static void attach(boost::intrusive_ptr<IHaveSubTasks> i, DB::ModifyCommand * insert);
+static void attach(std::shared_ptr<IHaveSubTasks> i, DB::ModifyCommandPtr insert);
#define foreach(_type, _con, _it) for (_type _it = ((_con).begin()); _it != ((_con).end()); _it++)
class SqlMergeInsert;
-typedef boost::intrusive_ptr<SqlMergeInsert> SqlMergeInsertPtr;
+typedef std::shared_ptr<SqlMergeInsert> SqlMergeInsertPtr;
/// Project2 component insert custom constructed records during an SQL Merge task
class SqlMergeInsert : IHaveParameters, public Task {
public:
@@ -33,13 +33,13 @@ class SqlMergeInsert : IHaveParameters, public Task {
void execute(ExecContext * ec) const {
unsigned int col = 0;
for (const Parameters::value_type & v : parameters) {
- boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(insert, col++), v.second(ec));
+ boost::apply_visitor(SqlVariableBinder(insert.get(), col++), v.second(ec));
}
insert->execute();
}
private:
- friend void attach(SqlMergeInsertPtr i, DB::ModifyCommand * insert);
- DB::ModifyCommand * insert;
+ friend void attach(SqlMergeInsertPtr i, DB::ModifyCommandPtr insert);
+ DB::ModifyCommandPtr insert;
};
NAMEDFACTORY("sqlmerge", SqlMergeTask, TaskFactory);
@@ -87,7 +87,7 @@ SqlMergeTask::SqlMergeTask(ScriptNodePtr p) :
dtable(p->value("targettable", NULL).as<std::string>()),
dtablet(stringf("tmp_%s_%d", dtable.c_str(), getpid()))
{
- p->script->loader.addLoadTarget(p, Storer::into<TaskFactory>(&sources));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<TaskFactory>(&sources));
if (!sources.empty() && useView(NULL)) {
throw NotSupported("useview not supported with iterate fillers");
@@ -115,7 +115,6 @@ SqlMergeTask::SqlMergeTask(ScriptNodePtr p) :
SqlMergeTask::~SqlMergeTask()
{
- delete insCmd;
delete sqlCommand;
}
@@ -194,20 +193,18 @@ SqlMergeTask::createTempTable() const
destdb->modify(b)->execute();
}
else {
- DB::ModifyCommand * ctt = destdb->newModifyCommand(stringf(
+ auto ctt = destdb->modify(stringf(
"CREATE TEMPORARY TABLE %s AS SELECT * FROM %s WHERE 0=1",
dtablet.c_str(),
dtable.c_str()));
ctt->execute();
- delete ctt;
for (Columns::value_type c : cols) {
if (!c->maptable.empty()) {
- DB::ModifyCommand * at = destdb->newModifyCommand(stringf(
+ auto at = destdb->modify(stringf(
"ALTER TABLE %s ADD COLUMN %s VARCHAR(1000)",
dtablet.c_str(),
c->mapcolumn.c_str()));
at->execute();
- delete at;
}
}
}
@@ -217,15 +214,14 @@ void
SqlMergeTask::dropTempTable() const
{
if (tempTableCreated) {
- DB::ModifyCommand * d;
+ DB::ModifyCommandPtr d;
if (useView(NULL)) {
- d = destdb->newModifyCommand("DROP VIEW " + dtablet);
+ d = destdb->modify("DROP VIEW " + dtablet);
}
else {
- d = destdb->newModifyCommand("DROP TABLE " + dtablet);
+ d = destdb->modify("DROP TABLE " + dtablet);
}
d->execute();
- delete d;
}
}
void
@@ -237,21 +233,19 @@ SqlMergeTask::createTempKey() const
idx.appendf("ALTER TABLE %s ADD CONSTRAINT pk_%s PRIMARY KEY(%s)",
dtablet.c_str(), dtablet.c_str(),
boost::algorithm::join(keys, ", ").c_str());
- DB::ModifyCommand * at = destdb->newModifyCommand(idx);
+ DB::ModifyCommandPtr at = destdb->modify(idx);
at->execute();
- delete at;
/* Indexes */
int n = 0;
for (const Keys::value_type & i : indexes) {
- DB::ModifyCommand * ci = destdb->newModifyCommand(stringf(
+ DB::ModifyCommandPtr ci = destdb->modify(stringf(
"CREATE INDEX idx_%s_%d ON %s(%s)",
dtablet.c_str(), n, dtablet.c_str(), i.c_str()));
ci->execute();
- delete ci;
n += 1;
}
}
-DB::ModifyCommand *
+DB::ModifyCommandPtr
SqlMergeTask::insertCommand() const
{
AdHoc::Buffer ins;
@@ -272,12 +266,12 @@ SqlMergeTask::insertCommand() const
}
}
ins.append(")");
- return destdb->newModifyCommand(ins);
+ return destdb->modify(ins);
}
class Populate : public Task {
public:
- Populate(DB::ModifyCommand * c) :
+ Populate(DB::ModifyCommandPtr c) :
SourceObject(__FUNCTION__),
Task(__FUNCTION__),
cmd(c)
@@ -292,14 +286,14 @@ class Populate : public Task {
private:
void bind(unsigned int & idx, const VariableType & value) const
{
- boost::apply_visitor<const SqlVariableBinder, const VariableType>(SqlVariableBinder(cmd, idx++), value);
+ boost::apply_visitor(SqlVariableBinder(cmd.get(), idx++), value);
}
- DB::ModifyCommand * cmd;
+ DB::ModifyCommandPtr cmd;
};
-typedef boost::intrusive_ptr<Populate> PopulatePtr;
+typedef std::shared_ptr<Populate> PopulatePtr;
void
-attach(SqlMergeInsertPtr i, DB::ModifyCommand * insert)
+attach(SqlMergeInsertPtr i, DB::ModifyCommandPtr insert)
{
if (i) {
i->insert = insert;
@@ -307,18 +301,18 @@ attach(SqlMergeInsertPtr i, DB::ModifyCommand * insert)
}
static void
-attach(boost::intrusive_ptr<IHaveSubTasks> i, DB::ModifyCommand * insert)
+attach(std::shared_ptr<IHaveSubTasks> i, DB::ModifyCommandPtr insert)
{
if (!i) {
return;
}
if (i->normal.empty()) {
- i->normal.push_back(new Populate(insert));
+ i->normal.push_back(std::make_shared<Populate>(insert));
}
else {
for (const IHaveSubTasks::Tasks::value_type & n : i->normal) {
- attach(boost::dynamic_pointer_cast<IHaveSubTasks>(n), insert);
- attach(boost::dynamic_pointer_cast<SqlMergeInsert>(n), insert);
+ attach(std::dynamic_pointer_cast<IHaveSubTasks>(n), insert);
+ attach(std::dynamic_pointer_cast<SqlMergeInsert>(n), insert);
}
}
}
@@ -352,15 +346,14 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const
sqlCommand->setFilter(Glib::ustring());
sqlCommand->writeSql(ins);
ins.appendf(") tmp_src");
- DB::ModifyCommand * cttt = destdb->newModifyCommand(ins);
+ auto cttt = destdb->modify(ins);
unsigned int off = 0;
- sqlCommand->bindParams(ec, cttt, off);
+ sqlCommand->bindParams(ec, cttt.get(), off);
cttt->execute();
- delete cttt;
}
for (Columns::value_type c : cols) {
if (!c->maptable.empty()) {
- DB::ModifyCommand * utt = destdb->newModifyCommand(
+ auto utt = destdb->modify(
stringf(
"UPDATE %s d SET %s = (SELECT m.%s FROM %s m WHERE m.%s = d.%s) WHERE %s IS NULL",
dtablet.c_str(),
@@ -371,7 +364,6 @@ SqlMergeTask::copyToTempTable(ExecContext * ec) const
c->mapcolumn.c_str(),
c->column.c_str()));
utt->execute();
- delete utt;
}
}
}
diff --git a/project2/sql/sqlMergeTask.h b/project2/sql/sqlMergeTask.h
index 60b5952..f2a825a 100644
--- a/project2/sql/sqlMergeTask.h
+++ b/project2/sql/sqlMergeTask.h
@@ -22,8 +22,8 @@ class DLL_PUBLIC SqlMergeTask : public Task {
typedef std::string Table;
typedef std::string Column;
class TargetColumn;
- typedef boost::intrusive_ptr<TargetColumn> TargetColumnPtr;
- class TargetColumn : public virtual IntrusivePtrBase {
+ typedef std::shared_ptr<TargetColumn> TargetColumnPtr;
+ class TargetColumn {
public:
class Sort {
public:
@@ -69,8 +69,8 @@ class DLL_PUBLIC SqlMergeTask : public Task {
typedef ANONSTORAGEOF(IHaveSubTasks) Sources;
DynamicSql::SqlCommand * sqlCommand;
protected:
- DB::ModifyCommand * insertCommand() const;
- DB::ModifyCommand * insCmd;
+ DB::ModifyCommandPtr insertCommand() const;
+ DB::ModifyCommandPtr insCmd;
public:
Sources sources;
diff --git a/project2/sql/sqlRows.cpp b/project2/sql/sqlRows.cpp
index 5bc231b..3a65c9b 100644
--- a/project2/sql/sqlRows.cpp
+++ b/project2/sql/sqlRows.cpp
@@ -24,13 +24,13 @@ SqlRows::~SqlRows()
{
}
-SqlRows::SqlState::SqlState(SelectPtr s) :
+SqlRows::SqlState::SqlState(DB::SelectCommandPtr s) :
query(s)
{
query->execute();
fields.resize(query->columnCount());
for (unsigned int c = 0; c < query->columnCount(); c++) {
- columns.insert(new Column(c, (*query)[c].name));
+ columns.insert(std::make_shared<Column>(c, (*query)[c].name));
}
}
diff --git a/project2/sql/sqlRows.h b/project2/sql/sqlRows.h
index 30abb08..25f63f8 100644
--- a/project2/sql/sqlRows.h
+++ b/project2/sql/sqlRows.h
@@ -21,12 +21,11 @@ class DLL_PUBLIC SqlRows : public RowSet, SqlBase {
private:
const DynamicSql::SqlCommand sqlCommand;
- typedef boost::shared_ptr<DB::SelectCommand> SelectPtr;
class SqlState : public RowState {
public:
- SqlState(SelectPtr query);
+ SqlState(DB::SelectCommandPtr query);
const Columns & getColumns() const;
- SelectPtr query;
+ DB::SelectCommandPtr query;
Columns columns;
friend class SqlRows;
};
diff --git a/project2/sql/sqlTask.cpp b/project2/sql/sqlTask.cpp
index 71ccf62..d62d150 100644
--- a/project2/sql/sqlTask.cpp
+++ b/project2/sql/sqlTask.cpp
@@ -16,8 +16,8 @@ SqlTask::SqlTask(ScriptNodePtr p) :
filter(p, "filter", ""),
sqlCommand(p->child("sql"))
{
- p->script->loader.addLoadTargetSub(p, "changes", false, Storer::into<TaskFactory>(&changesTasks));
- p->script->loader.addLoadTargetSub(p, "nochanges", false, Storer::into<TaskFactory>(&noChangesTasks));
+ p->script.lock()->loader.addLoadTargetSub(p, "changes", false, Storer::into<TaskFactory>(&changesTasks));
+ p->script.lock()->loader.addLoadTargetSub(p, "nochanges", false, Storer::into<TaskFactory>(&noChangesTasks));
}
SqlTask::~SqlTask()
diff --git a/project2/sql/sqlWriters.cpp b/project2/sql/sqlWriters.cpp
index bdc42cd..88e0fc6 100644
--- a/project2/sql/sqlWriters.cpp
+++ b/project2/sql/sqlWriters.cpp
@@ -16,7 +16,7 @@ static
void
appendNew(DynamicSql::Writers * w, const Cons & cons)
{
- w->push_back(new Type(cons));
+ w->push_back(std::make_shared<Type>(cons));
}
static
@@ -24,10 +24,10 @@ void
appendNewFromNode(DynamicSql::Writers * w, ScriptNodePtr p)
{
if (p->get_name() == "filter") {
- w->push_back(new DynamicSql::SqlFilter(p));
+ w->push_back(std::make_shared<DynamicSql::SqlFilter>(p));
}
else if (p->get_name() == "param") {
- w->push_back(new DynamicSql::SqlParameter(p));
+ w->push_back(std::make_shared<DynamicSql::SqlParameter>(p));
}
}
@@ -142,7 +142,7 @@ DynamicSql::SqlText::bindParams(ExecContext *, DB::Command *, unsigned int &) co
namespace DynamicSql {
template <>
- boost::shared_ptr<DB::SelectCommand>
+ std::shared_ptr<DB::SelectCommand>
SqlWriterWrapper::getCommandFor<DB::SelectCommand>(DB::Connection * db, const Glib::ustring & f) const
{
AdHoc::Buffer sql;
@@ -155,7 +155,7 @@ namespace DynamicSql {
}
template <>
- boost::shared_ptr<DB::ModifyCommand>
+ std::shared_ptr<DB::ModifyCommand>
SqlWriterWrapper::getCommandFor<DB::ModifyCommand>(DB::Connection * db, const Glib::ustring & f) const
{
AdHoc::Buffer sql;
diff --git a/project2/sql/sqlWriters.h b/project2/sql/sqlWriters.h
index a16412d..0ef7115 100644
--- a/project2/sql/sqlWriters.h
+++ b/project2/sql/sqlWriters.h
@@ -14,10 +14,10 @@
namespace DynamicSql {
class SqlWriter;
- typedef boost::intrusive_ptr<SqlWriter> SqlWriterPtr;
+ typedef std::shared_ptr<SqlWriter> SqlWriterPtr;
typedef std::list<SqlWriterPtr> Writers;
- class DLL_PUBLIC SqlWriter : public IntrusivePtrBase {
+ class DLL_PUBLIC SqlWriter {
public:
virtual ~SqlWriter() = default;
virtual void writeSql(AdHoc::Buffer & sql) const = 0;
@@ -74,7 +74,7 @@ namespace DynamicSql {
virtual void writeSql(AdHoc::Buffer & sql) override;
virtual void bindParams(DB::Command *, unsigned int & offset) override;
- template <typename CommandType> boost::shared_ptr<CommandType> getCommandFor(DB::Connection *, const Glib::ustring & f) const;
+ template <typename CommandType> std::shared_ptr<CommandType> getCommandFor(DB::Connection *, const Glib::ustring & f) const;
private:
ExecContext * ec;
diff --git a/project2/sql/unittests/Jamfile.jam b/project2/sql/unittests/Jamfile.jam
deleted file mode 100644
index 7b45800..0000000
--- a/project2/sql/unittests/Jamfile.jam
+++ /dev/null
@@ -1,9 +0,0 @@
-import testing ;
-
-lib boost_system ;
-lib boost_filesystem ;
-lib IceUtil ;
-lib Ice ;
-
-path-constant me : . ;
-
diff --git a/project2/streams/streamNvpRows.cpp b/project2/streams/streamNvpRows.cpp
index 281360f..ddfb245 100644
--- a/project2/streams/streamNvpRows.cpp
+++ b/project2/streams/streamNvpRows.cpp
@@ -107,7 +107,7 @@ class StreamNvpRows : public RowSet {
}
bool newField(size_t start) {
- columns.insert(new Column(columns.size(),
+ columns.insert(std::make_shared<Column>(columns.size(),
boost::algorithm::trim_copy_if(tok.substr(0, start), g_unichar_isspace)));
fields.push_back(Null());
inValue = true;
@@ -158,7 +158,7 @@ class StreamNvpRows : public RowSet {
assign(p->value("assign", "=", NULL).as<Glib::ustring>()),
encoding(p->value("encoding", "utf-8", NULL).as<std::string>())
{
- p->script->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
}
void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const
diff --git a/project2/streams/streamPresenter.cpp b/project2/streams/streamPresenter.cpp
index 37553c3..7b2129b 100644
--- a/project2/streams/streamPresenter.cpp
+++ b/project2/streams/streamPresenter.cpp
@@ -8,7 +8,7 @@ class StreamPresenter : public Presenter, public SourceOf<WritableContent> {
StreamPresenter(ScriptNodePtr e, ObjectSource os, ExecContext * ) :
Presenter(os)
{
- e->script->loader.addLoadTarget(e, Storer::into<StreamFactory>(&stream));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<StreamFactory>(&stream));
}
void addNewArray(const Glib::ustring&, bool) const
diff --git a/project2/streams/streamRows.cpp b/project2/streams/streamRows.cpp
index 8e2bc82..be68340 100644
--- a/project2/streams/streamRows.cpp
+++ b/project2/streams/streamRows.cpp
@@ -56,7 +56,7 @@ class StreamRows : public DefinedColumns, public RowSet {
encoding(p->value("encoding", "utf-8", NULL).as<std::string>()),
skipheader(p->value("skipheader", 0, NULL).as<int64_t>())
{
- p->script->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<StreamFactory>(&stream));
}
void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const
diff --git a/project2/streams/viewStream.cpp b/project2/streams/viewStream.cpp
index 0f2308a..37b3f00 100644
--- a/project2/streams/viewStream.cpp
+++ b/project2/streams/viewStream.cpp
@@ -28,14 +28,14 @@ class ViewStream : public Stream, public ViewHost {
Stream(p),
ViewHost(p)
{
- p->script->loader.addLoadTarget(p, Storer::into<PresenterFactory>(&presenter, Scripted, (ExecContext*)NULL));
+ p->script.lock()->loader.addLoadTarget(p, Storer::into<PresenterFactory>(&presenter, Scripted, (ExecContext*)NULL));
}
void runStream(const Stream::Sink & s, ExecContext * ec) const
{
- TransformSourcePtr t = boost::dynamic_pointer_cast<TransformSource>(getPresenter(ec));
+ TransformSourcePtr t = std::dynamic_pointer_cast<TransformSource>(getPresenter(ec));
if (t) {
boost::iostreams::stream<SinkStream> strm(s);
- ostreamWrapper * o = new ostreamWrapper(strm);
+ auto o = std::make_shared<ostreamWrapper>(strm);
executeViews(ec);
t->addTarget(o, ec, NULL);
AdHoc::ScopeExit remove([&t] { t->clearTargets(); });
diff --git a/project2/url/curlHelper.cpp b/project2/url/curlHelper.cpp
index c38f5aa..3add479 100644
--- a/project2/url/curlHelper.cpp
+++ b/project2/url/curlHelper.cpp
@@ -29,7 +29,7 @@ CurlHelper::~CurlHelper()
AdHoc::Net::CurlHandlePtr
CurlHelper::newCurl(ExecContext * ec) const
{
- AdHoc::Net::CurlHandlePtr c = new AdHoc::Net::CurlHandle(getUrl(ec));
+ AdHoc::Net::CurlHandlePtr c = std::make_shared<AdHoc::Net::CurlHandle>(getUrl(ec));
setCurlOpts(c.get(), ec);
return c;
}
diff --git a/project2/ut/testAppInstance.cpp b/project2/ut/testAppInstance.cpp
index 21e9c38..8e3f852 100644
--- a/project2/ut/testAppInstance.cpp
+++ b/project2/ut/testAppInstance.cpp
@@ -1,4 +1,12 @@
#include "testAppInstance.h"
+#include <boost/test/unit_test_suite.hpp>
+
+TestAppInstance::TestAppInstance() :
+ args(boost::unit_test::framework::master_test_suite().argv,
+ boost::unit_test::framework::master_test_suite().argv +
+ boost::unit_test::framework::master_test_suite().argc)
+{
+}
VariableType
TestAppInstance::getParameter(const VariableType &) const
diff --git a/project2/ut/testAppInstance.h b/project2/ut/testAppInstance.h
index 1c82a90..81eecd6 100644
--- a/project2/ut/testAppInstance.h
+++ b/project2/ut/testAppInstance.h
@@ -7,8 +7,12 @@
class DLL_PUBLIC TestAppInstance : public AppInstance, public ExecContext {
public:
+ TestAppInstance();
+
VariableType getParameter(const VariableType & key) const override;
SessionPtr getSession() const override;
+
+ const std::vector<std::string> args;
};
#endif
diff --git a/project2/ut/testScriptHost.cpp b/project2/ut/testScriptHost.cpp
index c989abb..2df7fbe 100644
--- a/project2/ut/testScriptHost.cpp
+++ b/project2/ut/testScriptHost.cpp
@@ -22,7 +22,7 @@ TestScriptHost::~TestScriptHost()
MultiRowSetPresenterPtr TestScriptHost::getPresenter(ExecContext *) const
{
if (!presenter) {
- presenter = new TestPresenter();
+ presenter = std::make_shared<TestPresenter>();
}
return presenter;
}
@@ -37,7 +37,7 @@ void TestScriptHost::process(ExecContext * ec)
const PresenterData &
TestScriptHost::GetPresenterData() const
{
- auto tp = boost::dynamic_pointer_cast<TestPresenter>(presenter);
+ auto tp = std::dynamic_pointer_cast<TestPresenter>(presenter);
if (!tp) {
throw std::runtime_error("Not using the TestPresenter");
}
diff --git a/project2/ut/testScriptNode.cpp b/project2/ut/testScriptNode.cpp
index fb54c12..8c24f71 100644
--- a/project2/ut/testScriptNode.cpp
+++ b/project2/ut/testScriptNode.cpp
@@ -59,20 +59,19 @@ bool TestScriptNode::applyValue(const Glib::ustring & name, VariableType & targe
return false;
}
-VariableImpl * TestScriptNode::variable(const boost::optional<Glib::ustring> & defaultSource) const
+std::shared_ptr<VariableImpl> TestScriptNode::variable(const boost::optional<Glib::ustring> & defaultSource) const
{
Logger()->messagebf(LOG_DEBUG, "%s: defaultSource = %s", __PRETTY_FUNCTION__,
defaultSource ? *defaultSource : "NULL");
- (void)defaultSource;
return NULL;
}
-VariableImpl * TestScriptNode::variable(const Glib::ustring & name) const
+std::shared_ptr<VariableImpl> TestScriptNode::variable(const Glib::ustring & name) const
{
Logger()->messagebf(LOG_DEBUG, "%s: %s", __PRETTY_FUNCTION__, name);
auto i = vars.find(name.collate_key());
if (i != vars.end()) {
- return new VariableLiteral(i->second);
+ return std::make_shared<VariableLiteral>(i->second);
}
throw ValueNotFound(name);
}
diff --git a/project2/ut/testScriptNode.h b/project2/ut/testScriptNode.h
index bfa8bb2..1425c14 100644
--- a/project2/ut/testScriptNode.h
+++ b/project2/ut/testScriptNode.h
@@ -17,8 +17,8 @@ class DLL_PUBLIC TestScriptNode : public ScriptNode {
ScriptNodes childrenIn(const Glib::ustring & sub) const;
bool valueExists(const Glib::ustring & name) const;
bool applyValue(const Glib::ustring & name, VariableType & target, ExecContext *) const;
- VariableImpl * variable(const boost::optional<Glib::ustring> & defaultSource = boost::optional<Glib::ustring>()) const;
- VariableImpl * variable(const Glib::ustring & name) const;
+ std::shared_ptr<VariableImpl> variable(const boost::optional<Glib::ustring> & defaultSource = boost::optional<Glib::ustring>()) const;
+ std::shared_ptr<VariableImpl> variable(const Glib::ustring & name) const;
void composeWithCallbacks(const LiteralCallback &, const NodeCallback &) const;
private:
diff --git a/project2/xml/Jamfile.jam b/project2/xml/Jamfile.jam
index e9bffca..a416db9 100644
--- a/project2/xml/Jamfile.jam
+++ b/project2/xml/Jamfile.jam
@@ -3,8 +3,7 @@ alias libxslt : : : :
<linkflags>"`pkg-config --libs libexslt`" ;
lib boost_filesystem : : <name>boost_filesystem ;
lib boost_date_time : : <name>boost_date_time ;
-lib Ice ;
-lib IceUtil ;
+lib Ice : : <name>Ice++11 ;
cpp-pch pch : pch.hpp :
<library>../..//libxmlpp
@@ -20,7 +19,6 @@ lib p2xml :
<library>../url//p2url
<library>..//adhocutil
<library>Ice
- <library>IceUtil
<library>libxslt
<library>boost_filesystem
<library>boost_date_time
diff --git a/project2/xml/rawView.cpp b/project2/xml/rawView.cpp
index 1b0a9f6..7219e8a 100644
--- a/project2/xml/rawView.cpp
+++ b/project2/xml/rawView.cpp
@@ -60,7 +60,7 @@ class RawView : public RawViewBase {
RawView(ScriptNodePtr p) :
SourceObject(p),
RawViewBase(p),
- copyRoot(boost::dynamic_pointer_cast<const XmlScriptNode>(p)->xmlElement())
+ copyRoot(std::dynamic_pointer_cast<const XmlScriptNode>(p)->xmlElement())
{
}
protected:
diff --git a/project2/xml/sessionXml.cpp b/project2/xml/sessionXml.cpp
index 756f676..682d49a 100644
--- a/project2/xml/sessionXml.cpp
+++ b/project2/xml/sessionXml.cpp
@@ -80,7 +80,7 @@ SessionContainerXml::getSession(const boost::uuids::uuid & sid) const
boost::filesystem::remove(p);
return NULL;
}
- SessionPtr s = new Session(sid);
+ SessionPtr s = std::make_shared<Session>(sid);
for (const xmlpp::Node * n : sess->get_children()) {
if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) {
if (e->get_first_child_text()) {
diff --git a/project2/xml/unittests/testxml.cpp b/project2/xml/unittests/testxml.cpp
index a3a40e0..4cedcb8 100644
--- a/project2/xml/unittests/testxml.cpp
+++ b/project2/xml/unittests/testxml.cpp
@@ -27,10 +27,10 @@ BOOST_AUTO_TEST_CASE( before )
BOOST_AUTO_TEST_CASE( rawview )
{
TestOptionsSource::LoadTestOptions({ });
- ScriptReaderPtr s = new XmlScriptParser(rootDir / "rawview.xml");
- boost::intrusive_ptr<TestScriptHost> h = new TestScriptHost(s);
+ ScriptReaderPtr s = std::make_shared<XmlScriptParser>(rootDir / "rawview.xml");
+ std::shared_ptr<TestScriptHost> h = std::make_shared<TestScriptHost>(s);
h->executeViews(NULL);
- auto p = boost::dynamic_pointer_cast<XmlPresenter>(h->getPresenter(NULL));
+ auto p = std::dynamic_pointer_cast<XmlPresenter>(h->getPresenter(NULL));
BOOST_REQUIRE(p);
const auto out = tmpdir / "rawview.xml";
std::fstream strm(out.string(), std::ios::out);
diff --git a/project2/xml/xmlCache.cpp b/project2/xml/xmlCache.cpp
index 343d5e6..95607d7 100644
--- a/project2/xml/xmlCache.cpp
+++ b/project2/xml/xmlCache.cpp
@@ -28,14 +28,14 @@ class XmlCache : public RowSetCache {
boost::filesystem::remove(cache);
return NULL;
}
- return new XmlRawRows(cache.string());
+ return std::make_shared<XmlRawRows>(cache.string());
}
return NULL;
}
RowSetPresenterPtr openFor(ExecContext *, const Glib::ustring & n, const Glib::ustring &, const IHaveParameters *)
{
- writeTo = new XmlPresenter(n, Scripts::scriptNamespace, Scripts::scriptNamespacePrefix);
+ writeTo = std::make_shared<XmlPresenter>(n, Scripts::scriptNamespace, Scripts::scriptNamespacePrefix);
return writeTo;
}
@@ -85,7 +85,7 @@ boost::filesystem::path XmlCache::Store;
std::string XmlCache::FileName;
time_t XmlCache::CacheLife;
-class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, const ScriptNode *>::For<XmlCache>, public LifeCycle {
+class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, std::shared_ptr<const ScriptNode>>::For<XmlCache>, public LifeCycle {
public:
void onIdle() override
{
diff --git a/project2/xml/xmlPresenter.cpp b/project2/xml/xmlPresenter.cpp
index f6ada8c..249d2a8 100644
--- a/project2/xml/xmlPresenter.cpp
+++ b/project2/xml/xmlPresenter.cpp
@@ -67,7 +67,7 @@ XmlPresenter::XmlPresenter(ScriptNodePtr e, ObjectSource os, ExecContext * ec) :
style(e, "style", Null())
{
if (os == Scripted) {
- e->script->loader.addLoadTarget(e, Storer::into<XmlDocMutatorFactory>(&mutators));
+ e->script.lock()->loader.addLoadTarget(e, Storer::into<XmlDocMutatorFactory>(&mutators));
}
}
@@ -273,5 +273,5 @@ XmlDocMutator::XmlDocMutator(ScriptNodePtr)
{
}
-INSTANTIATEFACTORY(XmlDocMutator, const ScriptNode *);
+INSTANTIATEFACTORY(XmlDocMutator, std::shared_ptr<const ScriptNode>);
diff --git a/project2/xml/xmlPresenter.h b/project2/xml/xmlPresenter.h
index e27f169..3ad1c2d 100644
--- a/project2/xml/xmlPresenter.h
+++ b/project2/xml/xmlPresenter.h
@@ -13,13 +13,13 @@ namespace xmlpp {
class Element;
}
-class DLL_PUBLIC XmlDocMutator : public IntrusivePtrBase {
+class DLL_PUBLIC XmlDocMutator : public virtual Something {
public:
XmlDocMutator(ScriptNodePtr);
virtual void mutateElement(xmlpp::Element *) const = 0;
};
-typedef boost::intrusive_ptr<XmlDocMutator> XmlDocMutatorPtr;
-typedef AdHoc::Factory<XmlDocMutator, const ScriptNode *> XmlDocMutatorFactory;
+typedef std::shared_ptr<XmlDocMutator> XmlDocMutatorPtr;
+typedef AdHoc::Factory<XmlDocMutator, std::shared_ptr<const ScriptNode>> XmlDocMutatorFactory;
class DLL_PUBLIC XmlPresenter : public Presenter, public ContentPresenter, public SourceOf<xmlpp::Document>, public SourceOf<xmlDoc>, public SourceOf<boost::shared_ptr<xmlpp::Document> >, public WritableContent, public SourceOf<WritableContent> {
public:
@@ -75,7 +75,7 @@ class DLL_PUBLIC XmlPresenter : public Presenter, public ContentPresenter, publi
static boost::optional<std::string> customFormat;
};
-typedef boost::intrusive_ptr<XmlPresenter> XmlPresenterPtr;
+typedef std::shared_ptr<XmlPresenter> XmlPresenterPtr;
#endif
diff --git a/project2/xml/xmlRawRows.cpp b/project2/xml/xmlRawRows.cpp
index cbc3b77..680757b 100644
--- a/project2/xml/xmlRawRows.cpp
+++ b/project2/xml/xmlRawRows.cpp
@@ -62,7 +62,7 @@ void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCall
unsigned int col = 0;
for (const xmlpp::Node * in : rs.e->get_children()) {
if (const xmlpp::Element * ie = dynamic_cast<const xmlpp::Element *>(in)) {
- rs.cols.insert(new Column(col++, ie->get_name()));
+ rs.cols.insert(std::make_shared<Column>(col++, ie->get_name()));
}
}
rs.fields.resize(col);
diff --git a/project2/xml/xmlRows.cpp b/project2/xml/xmlRows.cpp
index aa1d0aa..56dfe9a 100644
--- a/project2/xml/xmlRows.cpp
+++ b/project2/xml/xmlRows.cpp
@@ -40,7 +40,7 @@ XmlRows::XmlRows(ScriptNodePtr p) :
}
fields[p] = col;
- fieldNames.insert(new Column(col++, node->get_name()));
+ fieldNames.insert(std::make_shared<Column>(col++, node->get_name()));
}
}
diff --git a/project2/xml/xmlScriptParser.cpp b/project2/xml/xmlScriptParser.cpp
index bb4bcb6..b47682f 100644
--- a/project2/xml/xmlScriptParser.cpp
+++ b/project2/xml/xmlScriptParser.cpp
@@ -53,7 +53,7 @@ ScriptNodePtr
XmlScriptParser::root() const
{
if (!_root) {
- _root = new XmlScriptNode(get_document()->get_root_node(), this);
+ _root = std::make_shared<XmlScriptNode>(get_document()->get_root_node(), shared_from_this());
}
return _root;
}
@@ -92,10 +92,10 @@ XmlScriptParser::isCurrent() const
class XmlScriptReaderFactory : public ScriptReaderFactory {
public:
- XmlScriptParser * create(const std::string & group, const std::string & name) const {
+ std::shared_ptr<ScriptReader> create(const std::string & group, const std::string & name) const {
boost::filesystem::path script(boost::filesystem::path(group) / (name + ".xml"));
if (boost::filesystem::is_regular_file(script)) {
- return new XmlScriptParser(script);
+ return std::make_shared<XmlScriptParser>(script);
}
return NULL;
}
@@ -136,10 +136,10 @@ ScriptNode::ScriptNodes
XmlScriptNode::children() const
{
if (!childrenCache) {
- childrenCache = boost::shared_ptr<ScriptNodes>(new ScriptNodes());
+ childrenCache = std::make_shared<ScriptNodes>();
for (const xmlpp::Node * n : element->get_children()) {
if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) {
- childrenCache->push_back(new XmlScriptNode(e, script));
+ childrenCache->push_back(std::make_shared<XmlScriptNode>(e, script.lock()));
}
}
}
@@ -152,7 +152,7 @@ XmlScriptNode::child(const Glib::ustring & n, bool required) const
auto cs = element->get_children(n);
if (cs.size() == 1) {
if (const xmlpp::Element * c = dynamic_cast<const xmlpp::Element *>(cs.front())) {
- return new XmlScriptNode(c, script);
+ return std::make_shared<XmlScriptNode>(c, script.lock());
}
}
if (required) {
@@ -169,7 +169,7 @@ XmlScriptNode::childrenIn(const Glib::ustring & c) const
if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) {
for (const xmlpp::Node * n1 : e->get_children()) {
if (const xmlpp::Element * e1 = dynamic_cast<const xmlpp::Element *>(n1)) {
- sns.push_back(new XmlScriptNode(e1, script));
+ sns.push_back(std::make_shared<XmlScriptNode>(e1, script.lock()));
}
}
}
@@ -177,37 +177,37 @@ XmlScriptNode::childrenIn(const Glib::ustring & c) const
return sns;
}
-VariableImpl *
+std::shared_ptr<VariableImpl>
XmlScriptNode::variable(const Glib::ustring & n) const
{
if (const xmlpp::Attribute * a = element->get_attribute(n)) {
- return new VariableLiteral(a->get_value());
+ return std::make_shared<VariableLiteral>(a->get_value());
}
auto cs = element->get_children(n);
if (cs.size() == 1) {
if (const xmlpp::Element * c = dynamic_cast<const xmlpp::Element *>(cs.front())) {
if (const xmlpp::Attribute * source = c->get_attribute("source")) {
- return VariableFactory::createNew(source->get_value(), new XmlScriptNode(c, script));
+ return VariableFactory::createNew(source->get_value(), std::make_shared<XmlScriptNode>(c, script.lock()));
}
else {
- return new VariableLiteral(new XmlScriptNode(c, script));
+ return std::make_shared<VariableLiteral>(std::make_shared<XmlScriptNode>(c, script.lock()));
}
}
}
throw ValueNotFound(n);
}
-VariableImpl *
+std::shared_ptr<VariableImpl>
XmlScriptNode::variable(const boost::optional<Glib::ustring> & defaultSource) const
{
if (const xmlpp::Attribute * source = element->get_attribute("source")) {
- return VariableFactory::createNew(source->get_value(), new XmlScriptNode(element, script));
+ return VariableFactory::createNew(source->get_value(), std::make_shared<XmlScriptNode>(element, script.lock()));
}
else if (defaultSource) {
- return VariableFactory::createNew(defaultSource.get(), new XmlScriptNode(element, script));
+ return VariableFactory::createNew(defaultSource.get(), std::make_shared<XmlScriptNode>(element, script.lock()));
}
else {
- return new VariableLiteral(new XmlScriptNode(element, script));
+ return std::make_shared<VariableLiteral>(std::make_shared<XmlScriptNode>(element, script.lock()));
}
}
@@ -221,12 +221,12 @@ XmlScriptNode::applyValue(const Glib::ustring & n, VariableType & val, ExecConte
auto cs = element->get_children(n);
if (cs.size() == 1) {
if (const xmlpp::Element * c = dynamic_cast<const xmlpp::Element *>(cs.front())) {
- boost::intrusive_ptr<VariableImpl> v;
+ std::shared_ptr<VariableImpl> v;
if (const xmlpp::Attribute * source = c->get_attribute("source")) {
- v = VariableFactory::createNew(source->get_value(), new XmlScriptNode(c, script));
+ v = VariableFactory::createNew(source->get_value(), std::make_shared<XmlScriptNode>(c, script.lock()));
}
else {
- v = new VariableLiteral(new XmlScriptNode(c, script));
+ v = std::make_shared<VariableLiteral>(std::make_shared<XmlScriptNode>(c, script.lock()));
}
val = v->value(ec);
return false;
@@ -243,7 +243,7 @@ XmlScriptNode::composeWithCallbacks(const LiteralCallback & lcb, const NodeCallb
lcb(t->get_content());
}
else if (const xmlpp::Element * e = dynamic_cast<const xmlpp::Element *>(n)) {
- ncb(new XmlScriptNode(e, script));
+ ncb(std::make_shared<XmlScriptNode>(e, script.lock()));
}
}
}
diff --git a/project2/xml/xmlScriptParser.h b/project2/xml/xmlScriptParser.h
index ae5f3af..4f9881b 100644
--- a/project2/xml/xmlScriptParser.h
+++ b/project2/xml/xmlScriptParser.h
@@ -5,7 +5,6 @@
#include "exceptions.h"
#include "scriptLoader.h"
#include "scripts.h"
-#include <intrusivePtrBase.h>
#include <boost/filesystem/path.hpp>
#include <libxml++/document.h>
#include <libxml++/nodes/element.h>
@@ -23,17 +22,17 @@ class XmlScriptNode : public ScriptNode {
ScriptNodes children() const;
ScriptNodes childrenIn(const Glib::ustring&) const;
bool valueExists(const Glib::ustring&) const;
- VariableImpl * variable(const boost::optional<Glib::ustring> & defaultSource) const;
- VariableImpl * variable(const Glib::ustring&) const;
+ std::shared_ptr<VariableImpl> variable(const boost::optional<Glib::ustring> & defaultSource) const;
+ std::shared_ptr<VariableImpl> variable(const Glib::ustring&) const;
bool applyValue(const Glib::ustring & name, VariableType & target, ExecContext *) const;
void composeWithCallbacks(const ScriptNode::LiteralCallback&, const ScriptNode::NodeCallback&) const;
private:
const xmlpp::Element * element;
- mutable boost::shared_ptr<ScriptNodes> childrenCache;
+ mutable std::shared_ptr<ScriptNodes> childrenCache;
};
-class DLL_PUBLIC XmlScriptParser : public xmlpp::DomParser, public ScriptReader {
+class DLL_PUBLIC XmlScriptParser : public xmlpp::DomParser, public ScriptReader, public std::enable_shared_from_this<XmlScriptParser> {
public:
SimpleMessageException(ParseError);
SimpleMessageExceptionBase(NotReadable, ParseError);
diff --git a/project2/xml/xpathRows.cpp b/project2/xml/xpathRows.cpp
index 10ae2f4..c00519d 100644
--- a/project2/xml/xpathRows.cpp
+++ b/project2/xml/xpathRows.cpp
@@ -23,7 +23,7 @@ XPathRows::XPathRows(ScriptNodePtr p) :
encoding(p, "encoding", Null())
{
for (ScriptNodePtr node : p->childrenIn("filterviews")) {
- FilterViewPtr fv = new FilterView(node);
+ FilterViewPtr fv = std::make_shared<FilterView>(node);
fvs[fv->name] = fv;
}
for (ScriptNodePtr node : p->childrenIn("namespaces")) {
@@ -122,10 +122,10 @@ XPathRows::FilterViewColumn::FilterViewColumn(unsigned int idx, ScriptNodePtr p)
{
}
-XPathRows::FilterViewColumn *
+std::shared_ptr<Column>
XPathRows::FilterViewColumn::make(unsigned int idx, ScriptNodePtr p)
{
- return new FilterViewColumn(idx, p);
+ return std::make_shared<FilterViewColumn>(idx, p);
}
XPathRows::XPathState::XPathState(FilterViewCPtr f) :
diff --git a/project2/xml/xpathRows.h b/project2/xml/xpathRows.h
index 663df89..9066261 100644
--- a/project2/xml/xpathRows.h
+++ b/project2/xml/xpathRows.h
@@ -3,7 +3,6 @@
#include <libxml++/nodes/element.h>
#include <libxml/tree.h>
-#include <boost/intrusive_ptr.hpp>
#include <map>
#include "rowSet.h"
#include "variables.h"
@@ -23,10 +22,10 @@ class DLL_PUBLIC XPathRows : public RowSet, XmlDocumentCache {
class FilterViewColumn : public Column {
public:
FilterViewColumn(unsigned int, ScriptNodePtr);
- static FilterViewColumn * make(unsigned int, ScriptNodePtr);
+ static std::shared_ptr<Column> make(unsigned int, ScriptNodePtr);
const Variable path;
};
- class FilterView : public DefinedColumns, public virtual IntrusivePtrBase {
+ class FilterView : public DefinedColumns {
public:
typedef std::map<const Glib::ustring, Variable> XPaths;
@@ -35,8 +34,8 @@ class DLL_PUBLIC XPathRows : public RowSet, XmlDocumentCache {
const Glib::ustring name;
const Variable root;
};
- typedef boost::intrusive_ptr<FilterView> FilterViewPtr;
- typedef boost::intrusive_ptr<const FilterView> FilterViewCPtr;
+ typedef std::shared_ptr<FilterView> FilterViewPtr;
+ typedef std::shared_ptr<const FilterView> FilterViewCPtr;
typedef std::map<const Glib::ustring, FilterViewPtr> FilterViews;
FilterViews fvs;