summaryrefslogtreecommitdiff
path: root/project2/basics
diff options
context:
space:
mode:
Diffstat (limited to 'project2/basics')
-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
18 files changed, 41 insertions, 38 deletions
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