summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--Jamroot.jam3
m---------ice0
-rw-r--r--slicer/db/Jamfile.jam6
-rw-r--r--slicer/db/sqlBinder.h2
-rw-r--r--slicer/db/sqlSource.cpp4
-rw-r--r--slicer/db/sqlSource.h2
-rw-r--r--slicer/db/testConversions.cpp2
-rw-r--r--slicer/db/testInsert.cpp37
-rw-r--r--slicer/db/testSelect.cpp16
-rw-r--r--slicer/db/testUpdate.cpp16
-rw-r--r--slicer/ice/Jamfile.jam6
-rw-r--r--slicer/ice/serializer.cpp7
-rw-r--r--slicer/ice/testSpecifics.cpp2
-rw-r--r--slicer/json/Jamfile.jam2
-rw-r--r--slicer/slicer/Jamfile.jam6
-rw-r--r--slicer/slicer/modelParts.cpp4
-rw-r--r--slicer/slicer/modelParts.h24
-rw-r--r--slicer/slicer/modelPartsTypes.cpp4
-rw-r--r--slicer/slicer/modelPartsTypes.h12
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h76
-rw-r--r--slicer/slicer/serializer.h10
-rw-r--r--slicer/slicer/slicer.cpp2
-rw-r--r--slicer/slicer/slicer.h5
-rw-r--r--slicer/test/Jamfile.jam2
-rw-r--r--slicer/test/classes.ice6
-rw-r--r--slicer/test/classtype.ice14
-rw-r--r--slicer/test/compilation.cpp28
-rw-r--r--slicer/test/included/Jamfile.jam9
-rw-r--r--slicer/test/preprocessor.cpp3
-rw-r--r--slicer/test/serializers.cpp55
-rw-r--r--slicer/test/structs.ice3
-rw-r--r--slicer/tool/Jamfile.jam28
-rw-r--r--slicer/tool/parser.cpp2
-rw-r--r--slicer/xml/Jamfile.jam6
35 files changed, 218 insertions, 190 deletions
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 a40d70e..d51b988 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -7,7 +7,8 @@ variant coverage : debug ;
project
: requirements
- <cxxflags>"-std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden"
+ <cxxflags>-DICE_CPP11_MAPPING
+ <cxxflags>"-std=c++17 -fvisibility=hidden -fvisibility-inlines-hidden"
<linkflags>"-Wl,-z,defs,--warn-once,--gc-sections"
<variant>release:<cxxflags>"-flto=2"
<variant>release:<linkflags>"-flto=2"
diff --git a/ice b/ice
new file mode 160000
+Subproject ab836be545d3d1d4b320e79383dbb988426e335
diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam
index b8e45cc..cf5cca8 100644
--- a/slicer/db/Jamfile.jam
+++ b/slicer/db/Jamfile.jam
@@ -8,8 +8,7 @@ lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
lib pthread ;
-lib Ice ;
-lib IceUtil ;
+lib Ice++11 ;
lib slicer-db :
[ glob *.cpp : test*.cpp ]
@@ -17,8 +16,7 @@ lib slicer-db :
:
<include>..
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
<library>dbppcore
<library>../..//glibmm
<library>adhocutil
diff --git a/slicer/db/sqlBinder.h b/slicer/db/sqlBinder.h
index b4d7ac4..f7a0be6 100644
--- a/slicer/db/sqlBinder.h
+++ b/slicer/db/sqlBinder.h
@@ -28,7 +28,7 @@ namespace Slicer {
DB::Command & command;
const unsigned int idx;
};
- typedef IceUtil::Handle<SqlBinder> SqlBinderPtr;
+ typedef std::shared_ptr<SqlBinder> SqlBinderPtr;
}
#endif
diff --git a/slicer/db/sqlSource.cpp b/slicer/db/sqlSource.cpp
index d277140..eeea99c 100644
--- a/slicer/db/sqlSource.cpp
+++ b/slicer/db/sqlSource.cpp
@@ -58,7 +58,9 @@ namespace Slicer {
void
SqlSource::set(Ice::Long & b) const
{
- column >> b;
+ int64_t cb;
+ column >> cb;
+ b = boost::numeric_cast<Ice::Long>(cb);
}
void
diff --git a/slicer/db/sqlSource.h b/slicer/db/sqlSource.h
index bf728dc..99ffabb 100644
--- a/slicer/db/sqlSource.h
+++ b/slicer/db/sqlSource.h
@@ -28,7 +28,7 @@ namespace Slicer {
private:
const DB::Column & column;
};
- typedef IceUtil::Handle<SqlSource> SqlSourcePtr;
+ typedef std::shared_ptr<SqlSource> SqlSourcePtr;
}
#endif
diff --git a/slicer/db/testConversions.cpp b/slicer/db/testConversions.cpp
index 893c6ae..d19f309 100644
--- a/slicer/db/testConversions.cpp
+++ b/slicer/db/testConversions.cpp
@@ -10,7 +10,7 @@ namespace Slicer {
::TestDatabase::TimespanPtr
timedurationToTimespan(const boost::posix_time::time_duration & td)
{
- return new ::TestDatabase::Timespan(SHORT(td.hours() / 24), SHORT(td.hours() % 24), SHORT(td.minutes()), SHORT(td.seconds()));
+ return std::make_shared<::TestDatabase::Timespan>(SHORT(td.hours() / 24), SHORT(td.hours() % 24), SHORT(td.minutes()), SHORT(td.seconds()));
}
DLL_PUBLIC
diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp
index fec0ed7..1c9542f 100644
--- a/slicer/db/testInsert.cpp
+++ b/slicer/db/testInsert.cpp
@@ -10,12 +10,21 @@
#include <common.h>
#include <testModels.h>
+using namespace std::literals;
+
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime);
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::IsoDate);
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestDatabase::Timespan);
// LCOV_EXCL_STOP
+namespace std {
+ template<typename T>
+ ostream & operator<<(ostream & s, const IceUtil::Optional<T> &) {
+ return s;
+ }
+}
+
class StandardMockDatabase : public PQ::Mock {
public:
StandardMockDatabase() : PQ::Mock("user=postgres dbname=postgres", "pqmock", {
@@ -32,7 +41,7 @@ typedef boost::shared_ptr<DB::SelectCommand> SelectPtr;
BOOST_AUTO_TEST_CASE( insert_builtins )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
- TestModule::BuiltInsPtr bi = new TestModule::BuiltIns(true, 4, 16, 64, 128, 1.2, 3.4, "text");
+ TestModule::BuiltInsPtr bi = std::make_shared<TestModule::BuiltIns>(true, 4, 16, 64, 128, 1.2, 3.4, "text");
Slicer::SerializeAny<Slicer::SqlInsertSerializer>(bi, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins"));
auto bi2 = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::BuiltInsPtr>(*sel);
@@ -50,8 +59,8 @@ BOOST_AUTO_TEST_CASE( insert_seq_builtins )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
TestModule::BuiltInSeq bis = {
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 5, 17, 65, 129, 2.3, 4.5, "more text")),
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 6, 18, 66, 130, 3.4, 5.6, "even more text"))
+ std::make_shared<TestModule::BuiltIns>(true, 5, 17, 65, 129, 2.3, 4.5, "more text"),
+ std::make_shared<TestModule::BuiltIns>(true, 6, 18, 66, 130, 3.4, 5.6, "even more text")
};
Slicer::SerializeAny<Slicer::SqlInsertSerializer>(bis, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins ORDER BY mint"));
@@ -71,8 +80,8 @@ BOOST_AUTO_TEST_CASE( autoinsert_seq_builtins )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
TestModule::BuiltInSeq bis = {
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 5, 17, 0, 129, 2.3, 4.5, "more text")),
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 6, 18, 0, 130, 3.4, 5.6, "even more text"))
+ std::make_shared<TestModule::BuiltIns>(true, 5, 17, 0, 129, 2.3, 4.5, "more text"),
+ std::make_shared<TestModule::BuiltIns>(true, 6, 18, 0, 130, 3.4, 5.6, "even more text")
};
Slicer::SerializeAny<Slicer::SqlAutoIdInsertSerializer>(bis, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins WHERE mint IN (1, 2) ORDER BY mint"));
@@ -95,8 +104,8 @@ BOOST_AUTO_TEST_CASE( fetchinsert_seq_builtins )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
TestModule::BuiltInSeq bis = {
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 5, 17, 0, 129, 2.3, 4.5, "more text")),
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(true, 6, 18, 0, 130, 3.4, 5.6, "even more text"))
+ std::make_shared<TestModule::BuiltIns>(true, 5, 17, 0, 129, 2.3, 4.5, "more text"),
+ std::make_shared<TestModule::BuiltIns>(true, 6, 18, 0, 130, 3.4, 5.6, "even more text")
};
Slicer::SerializeAny<Slicer::SqlFetchIdInsertSerializer>(bis, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins WHERE mint IN (3, 4) ORDER BY mint"));
@@ -119,8 +128,8 @@ BOOST_AUTO_TEST_CASE( fetchinsert_seq_builtinsWithNulls )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
TestDatabase::BuiltInSeq bis = {
- TestDatabase::BuiltInsPtr(new TestDatabase::BuiltIns(true, IceUtil::Optional<Ice::Byte>(), 17, 0, 129, 2.3, 4.5, "more text")),
- TestDatabase::BuiltInsPtr(new TestDatabase::BuiltIns(true, 6, 18, 0, 130, 3.4, IceUtil::Optional<Ice::Double>(), "even more text"))
+ std::make_shared<TestDatabase::BuiltIns>(true, IceUtil::None, 17, 0, 129, 2.3, 4.5, "more text"s),
+ std::make_shared<TestDatabase::BuiltIns>(true, 6, 18, 0, 130, 3.4, IceUtil::None, "even more text"s)
};
Slicer::SerializeAny<Slicer::SqlFetchIdInsertSerializer>(bis, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins WHERE mint IN (5, 6) ORDER BY mint"));
@@ -142,11 +151,11 @@ BOOST_AUTO_TEST_CASE( fetchinsert_seq_builtinsWithNulls )
BOOST_AUTO_TEST_CASE( insert_converted )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
- TestDatabase::SpecificTypesPtr st = new TestDatabase::SpecificTypes {
- {2015, 10, 16, 19, 12, 34},
- {2015, 10, 16},
- new TestDatabase::Timespan(1, 2, 3, 4)
- };
+ TestDatabase::SpecificTypesPtr st = std::make_shared<TestDatabase::SpecificTypes>(
+ TestModule::DateTime {2015, 10, 16, 19, 12, 34},
+ TestModule::IsoDate {2015, 10, 16},
+ std::make_shared<TestDatabase::Timespan>(1, 2, 3, 4)
+ );
Slicer::SerializeAny<Slicer::SqlInsertSerializer>(st, db.get(), "converted");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM converted"));
auto st2 = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestDatabase::SpecificTypesPtr>(*sel);
diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp
index e50047a..e1c2068 100644
--- a/slicer/db/testSelect.cpp
+++ b/slicer/db/testSelect.cpp
@@ -10,6 +10,8 @@
#include <testModels.h>
#include <sqlExceptions.h>
+using namespace std::literals;
+
class StandardMockDatabase : public PQ::Mock {
public:
StandardMockDatabase() : PQ::Mock("user=postgres dbname=postgres", "pqmock", {
@@ -93,9 +95,9 @@ BOOST_AUTO_TEST_CASE( select_inherit_single )
"SELECT id a, '::TestModule::D' || CAST(id AS TEXT) tc, 200 b, 300 c, 400 d \
FROM test \
WHERE id = 2"));
- auto bi = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::BasePtr>(*sel, "tc");
+ auto bi = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::BasePtr>(*sel, "tc"s);
BOOST_REQUIRE(bi);
- auto d2 = TestModule::D2Ptr::dynamicCast(bi);
+ auto d2 = std::dynamic_pointer_cast<TestModule::D2>(bi);
BOOST_REQUIRE(d2);
BOOST_REQUIRE_EQUAL(2, d2->a);
BOOST_REQUIRE_EQUAL(300, d2->c);
@@ -124,11 +126,11 @@ BOOST_AUTO_TEST_CASE( select_inherit_sequence )
FROM test \
WHERE id < 4 \
ORDER BY id DESC"));
- auto bi = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::BaseSeq>(*sel, "tc");
+ auto bi = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::BaseSeq>(*sel, "tc"s);
BOOST_REQUIRE_EQUAL(3, bi.size());
- auto d3 = TestModule::D3Ptr::dynamicCast(bi[0]);
- auto d2 = TestModule::D2Ptr::dynamicCast(bi[1]);
- auto d1 = TestModule::D1Ptr::dynamicCast(bi[2]);
+ auto d3 = std::dynamic_pointer_cast<TestModule::D3>(bi[0]);
+ auto d2 = std::dynamic_pointer_cast<TestModule::D2>(bi[1]);
+ auto d1 = std::dynamic_pointer_cast<TestModule::D1>(bi[2]);
BOOST_REQUIRE(d3);
BOOST_REQUIRE(d2);
BOOST_REQUIRE(d1);
@@ -264,7 +266,7 @@ BOOST_AUTO_TEST_CASE( select_null )
sel = SelectPtr(db->newSelectCommand("SELECT MAX(id) optSimple FROM test WHERE id IS NOT NULL"));
oi = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestModule::OptionalsPtr>(*sel);
BOOST_REQUIRE(oi->optSimple);
- BOOST_REQUIRE_EQUAL(oi->optSimple.get(), 4);
+ BOOST_REQUIRE_EQUAL(*oi->optSimple, 4);
sel = SelectPtr(db->newSelectCommand("SELECT MAX(id) FROM test WHERE false"));
auto v = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, IceUtil::Optional<Ice::Int>>(*sel);
diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp
index 29115e3..f97a3f5 100644
--- a/slicer/db/testUpdate.cpp
+++ b/slicer/db/testUpdate.cpp
@@ -12,6 +12,8 @@
#include <testModels.h>
#include <sqlExceptions.h>
+using namespace std::literals;
+
class StandardMockDatabase : public PQ::Mock {
public:
StandardMockDatabase() : PQ::Mock("user=postgres dbname=postgres", "pqmock", {
@@ -28,19 +30,19 @@ typedef boost::shared_ptr<DB::SelectCommand> SelectPtr;
BOOST_AUTO_TEST_CASE( update_builtinsNotFound )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
- TestModule::BuiltInsPtr ubi = new TestModule::BuiltIns(false, 5, 17, 64, 129, -1.2, -1.4, "string");
+ TestModule::BuiltInsPtr ubi = std::make_shared<TestModule::BuiltIns>(false, 5, 17, 64, 129, -1.2, -1.4, "string");
BOOST_REQUIRE_THROW(Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(ubi, db.get(), "builtins"), Slicer::NoRowsFound);
}
BOOST_AUTO_TEST_CASE( update_builtins )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
- TestModule::BuiltInsPtr bi1 = new TestModule::BuiltIns(true, 4, 16, 64, 128, 1.2, 3.4, "text1");
- TestModule::BuiltInsPtr bi2 = new TestModule::BuiltIns(true, 3, 15, 63, 127, 5.2, 5.4, "text2");
+ TestModule::BuiltInsPtr bi1 = std::make_shared<TestModule::BuiltIns>(true, 4, 16, 64, 128, 1.2, 3.4, "text1");
+ TestModule::BuiltInsPtr bi2 = std::make_shared<TestModule::BuiltIns>(true, 3, 15, 63, 127, 5.2, 5.4, "text2");
Slicer::SerializeAny<Slicer::SqlInsertSerializer>(bi1, db.get(), "builtins");
Slicer::SerializeAny<Slicer::SqlInsertSerializer>(bi2, db.get(), "builtins");
- TestModule::BuiltInsPtr ubi = new TestModule::BuiltIns(false, 5, 17, 64, 128, -1.2, -1.4, "string");
+ TestModule::BuiltInsPtr ubi = std::make_shared<TestModule::BuiltIns>(false, 5, 17, 64, 128, -1.2, -1.4, "string");
Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(ubi, db.get(), "builtins");
auto sel = SelectPtr(db->newSelectCommand("SELECT * FROM builtins ORDER BY mint DESC"));
@@ -68,8 +70,8 @@ BOOST_AUTO_TEST_CASE( update_builtins_seq )
{
auto db = DBPtr(DB::MockDatabase::openConnectionTo("pqmock"));
TestModule::BuiltInSeq ubis {
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(false, 5, 17, 64, 128, -1.2, -1.4, "string")),
- TestModule::BuiltInsPtr(new TestModule::BuiltIns(false, 5, 21, 63, 127, -4.2, -5.4, "string updated"))
+ TestModule::BuiltInsPtr(std::make_shared<TestModule::BuiltIns>(false, 5, 17, 64, 128, -1.2, -1.4, "string")),
+ TestModule::BuiltInsPtr(std::make_shared<TestModule::BuiltIns>(false, 5, 21, 63, 127, -4.2, -5.4, "string updated"))
};
Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(ubis, db.get(), "builtins");
@@ -102,7 +104,7 @@ BOOST_AUTO_TEST_CASE( update_withNulls )
BOOST_REQUIRE_EQUAL(2, bis.size());
BOOST_REQUIRE_EQUAL("string updated", *bis[0]->mstring);
BOOST_REQUIRE_EQUAL("string", *bis[1]->mstring);
- bis[0]->mstring = "not null";
+ bis[0]->mstring = "not null"s;
bis[1]->mstring = IceUtil::Optional<std::string>();
bis[0]->mfloat = IceUtil::Optional<Ice::Float>();
bis[1]->mbyte = IceUtil::Optional<Ice::Byte>();
diff --git a/slicer/ice/Jamfile.jam b/slicer/ice/Jamfile.jam
index 75a7844..d775a4a 100644
--- a/slicer/ice/Jamfile.jam
+++ b/slicer/ice/Jamfile.jam
@@ -2,11 +2,10 @@ import testing ;
import package ;
lib pthread ;
-lib Ice ;
+lib Ice++11 ;
lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
-lib IceUtil ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer-ice :
@@ -16,8 +15,7 @@ lib slicer-ice :
<library>boost_system
<library>boost_filesystem
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
<library>adhocutil
<library>../slicer//slicer
<implicit-dependency>../slicer//slicer
diff --git a/slicer/ice/serializer.cpp b/slicer/ice/serializer.cpp
index 981223f..a2e6f4a 100644
--- a/slicer/ice/serializer.cpp
+++ b/slicer/ice/serializer.cpp
@@ -1,6 +1,5 @@
#include "serializer.h"
#include "Ice/Initialize.h"
-#include "Ice/Stream.h"
#include "Ice/Communicator.h"
NAMEDFACTORY("application/ice", Slicer::IceStreamSerializer, Slicer::StreamSerializerFactory);
@@ -26,9 +25,9 @@ namespace Slicer {
void
IceBlobSerializer::Serialize(ModelPartForRootPtr mp)
{
- auto s = Ice::createOutputStream(ic);
+ Ice::OutputStream s(ic);
mp->Write(s);
- s->finished(blob);
+ s.finished(blob);
}
IceStreamSerializer::IceStreamSerializer(std::ostream & os) :
@@ -52,7 +51,7 @@ namespace Slicer {
void
IceBlobDeserializer::Deserialize(ModelPartForRootPtr mp)
{
- auto s = Ice::createInputStream(ic, blob);
+ Ice::InputStream s(ic, blob);
mp->Read(s);
}
diff --git a/slicer/ice/testSpecifics.cpp b/slicer/ice/testSpecifics.cpp
index 52a44b4..1689ed0 100644
--- a/slicer/ice/testSpecifics.cpp
+++ b/slicer/ice/testSpecifics.cpp
@@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE( optionalBuiltins )
BOOST_AUTO_TEST_CASE( classes )
{
- TestModule::BuiltInsPtr x = new TestModule::BuiltIns();
+ TestModule::BuiltInsPtr x = std::make_shared<TestModule::BuiltIns>();
x->mbool = true;
x->mbyte = 14;
x->mshort = 31434;
diff --git a/slicer/json/Jamfile.jam b/slicer/json/Jamfile.jam
index ef3c9e0..07186c8 100644
--- a/slicer/json/Jamfile.jam
+++ b/slicer/json/Jamfile.jam
@@ -8,7 +8,6 @@ lib jsonpp : : : :
lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
-lib IceUtil ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer-json :
@@ -17,7 +16,6 @@ lib slicer-json :
<include>..
<library>boost_system
<library>boost_filesystem
- <library>IceUtil
<library>jsonpp
<library>../..//glibmm
<library>adhocutil
diff --git a/slicer/slicer/Jamfile.jam b/slicer/slicer/Jamfile.jam
index dec3934..e62a22a 100644
--- a/slicer/slicer/Jamfile.jam
+++ b/slicer/slicer/Jamfile.jam
@@ -1,8 +1,7 @@
import package ;
lib pthread ;
-lib Ice ;
-lib IceUtil ;
+lib Ice++11 ;
lib boost_system ;
lib boost_filesystem ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
@@ -12,8 +11,7 @@ lib slicer :
[ glob *.ice ]
:
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
<library>boost_system
<library>adhocutil
<include>..
diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp
index 68b2597..83d7833 100644
--- a/slicer/slicer/modelParts.cpp
+++ b/slicer/slicer/modelParts.cpp
@@ -16,7 +16,7 @@ namespace Slicer {
ModelPartPtr
ModelPart::GetSubclassModelPart(const std::string &)
{
- return this;
+ return shared_from_this();
}
TypeId
@@ -71,7 +71,7 @@ namespace Slicer {
ModelPartPtr
ModelPart::GetContainedModelPart()
{
- return this;
+ return shared_from_this();
}
HookCommon::HookCommon(const std::string & n) :
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 36d8d48..08c1e0d 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -1,11 +1,9 @@
#ifndef SLICER_MODELPARTS_H
#define SLICER_MODELPARTS_H
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
#include <IceUtil/Optional.h>
-#include <Ice/Handle.h>
-#include <Ice/StreamF.h>
+#include <Ice/InputStream.h>
+#include <Ice/OutputStream.h>
#include <stdexcept>
#include <boost/function.hpp>
#include <vector>
@@ -13,14 +11,6 @@
#include <visibility.h>
namespace Slicer {
- // This allows IceUtil::Handle to play nicely with boost::things
- template <class T>
- T *
- get_pointer(const IceUtil::Handle<T> & p)
- {
- return p.get();
- }
-
template <typename T>
class TValueTarget {
public:
@@ -75,8 +65,8 @@ namespace Slicer {
class ModelPartForRootBase;
class HookCommon;
- typedef IceUtil::Handle<ModelPart> ModelPartPtr;
- typedef IceUtil::Handle<ModelPartForRootBase> ModelPartForRootPtr;
+ typedef std::shared_ptr<ModelPart> ModelPartPtr;
+ typedef std::shared_ptr<ModelPartForRootBase> ModelPartForRootPtr;
typedef std::unique_ptr<HookCommon> HookCommonPtr;
typedef IceUtil::Optional<std::string> TypeId;
@@ -128,7 +118,7 @@ namespace Slicer {
const std::string name;
};
- class DLL_PUBLIC ModelPart : virtual public IceUtil::Shared {
+ class DLL_PUBLIC ModelPart : public std::enable_shared_from_this<ModelPart> {
public:
virtual ~ModelPart() = default;
@@ -176,8 +166,8 @@ namespace Slicer {
virtual void OnEachChild(const ChildHandler & ch) override;
virtual ModelPartType GetType() const override;
virtual bool IsOptional() const override;
- virtual void Write(::Ice::OutputStreamPtr &) const = 0;
- virtual void Read(::Ice::InputStreamPtr &) = 0;
+ virtual void Write(::Ice::OutputStream &) const = 0;
+ virtual void Read(::Ice::InputStream &) = 0;
virtual ModelPartPtr GetContainedModelPart() override;
ModelPartPtr mp;
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index 3adff5a..3b2961c 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -263,8 +263,8 @@ namespace Slicer {
bool ModelPartForStreamBase::HasValue() const { return true; }
// Stream Roots
ModelPartForStreamRootBase::ModelPartForStreamRootBase(ModelPartPtr mp) : ModelPartForRootBase(mp) { }
- void ModelPartForStreamRootBase::Write(Ice::OutputStreamPtr&) const { throw InvalidStreamOperation(__FUNCTION__); }
- void ModelPartForStreamRootBase::Read(Ice::InputStreamPtr&) { throw InvalidStreamOperation(__FUNCTION__); }
+ void ModelPartForStreamRootBase::Write(Ice::OutputStream&) const { throw InvalidStreamOperation(__FUNCTION__); }
+ void ModelPartForStreamRootBase::Read(Ice::InputStream&) { throw InvalidStreamOperation(__FUNCTION__); }
bool ModelPartForStreamRootBase::HasValue() const { return mp->HasValue(); }
void ModelPartForStreamRootBase::OnEachChild(const ChildHandler & ch) { ch(GetRootName(), mp, NULL); }
}
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index d50224d..a9b8501 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -25,8 +25,8 @@ namespace Slicer {
const std::string & GetRootName() const override;
virtual bool HasValue() const override;
- void Write(::Ice::OutputStreamPtr &) const override;
- void Read(::Ice::InputStreamPtr &) override;
+ void Write(::Ice::OutputStream &) const override;
+ void Read(::Ice::InputStream &) override;
static const std::string rootName;
@@ -206,9 +206,9 @@ namespace Slicer {
};
template<typename T>
- class DLL_PUBLIC ModelPartForClass : public ModelPartForComplex<T>, protected ModelPartModel<IceInternal::Handle<T> > {
+ class DLL_PUBLIC ModelPartForClass : public ModelPartForComplex<T>, protected ModelPartModel<std::shared_ptr<T> > {
public:
- typedef IceInternal::Handle<T> element_type;
+ typedef std::shared_ptr<T> element_type;
ModelPartForClass(element_type * h);
@@ -388,8 +388,8 @@ namespace Slicer {
public:
ModelPartForStreamRootBase(ModelPartPtr mp);
- virtual void Write(Ice::OutputStreamPtr&) const override;
- virtual void Read(Ice::InputStreamPtr&) override;
+ virtual void Write(Ice::OutputStream&) const override;
+ virtual void Read(Ice::InputStream&) override;
virtual bool HasValue() const override;
virtual void OnEachChild(const ChildHandler & ch) override;
virtual const std::string & GetRootName() const override = 0;
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 017d243..03af7c1 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -3,9 +3,7 @@
#include "modelPartsTypes.h"
#include "common.h"
-#include <Ice/Stream.h>
#include <Ice/StreamHelpers.h>
-#include <Ice/BasicStream.h>
#include <IceUtil/Optional.h>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
@@ -13,13 +11,13 @@
#include <boost/algorithm/string/case_conv.hpp>
#define CUSTOMMODELPARTFOR(Type, BaseModelPart, ModelPartType) \
- template<> ModelPartPtr ModelPart::CreateFor<Type>() { return new ModelPartType(nullptr); } \
- template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return new ModelPartType(&s); } \
+ template<> ModelPartPtr ModelPart::CreateFor<Type>() { return std::make_shared<ModelPartType>(nullptr); } \
+ template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return std::make_shared<ModelPartType>(&s); } \
template<> ModelPartPtr ModelPart::CreateFor(const Type & s) { return CreateFor(const_cast<Type &>(s)); } \
- template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional<Type> & s) { return new ModelPartForOptional<ModelPartType>(&s); } \
+ template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional<Type> & s) { return std::make_shared<ModelPartForOptional<ModelPartType>>(&s); } \
template<> ModelPartPtr ModelPart::CreateFor(const IceUtil::Optional<Type> & s) { return CreateFor(const_cast<IceUtil::Optional<Type> &>(s)); } \
- template<> ModelPartForRootPtr ModelPart::CreateRootFor(Type & s) { return new ModelPartForRoot<Type>(&s); } \
- template<> ModelPartForRootPtr ModelPart::CreateRootFor(IceUtil::Optional<Type> & s) { return new ModelPartForRoot<IceUtil::Optional<Type> >(&s); } \
+ template<> ModelPartForRootPtr ModelPart::CreateRootFor(Type & s) { return std::make_shared<ModelPartForRoot<Type>>(&s); } \
+ template<> ModelPartForRootPtr ModelPart::CreateRootFor(IceUtil::Optional<Type> & s) { return std::make_shared<ModelPartForRoot<IceUtil::Optional<Type>>>(&s); } \
template<> ModelPartForRootPtr ModelPart::CreateRootFor(const Type & s) { return CreateRootFor(const_cast<Type &>(s)); } \
template<> ModelPartForRootPtr ModelPart::CreateRootFor(const IceUtil::Optional<Type> & s) { return CreateRootFor(const_cast<IceUtil::Optional<Type> &>(s)); } \
template class BaseModelPart; \
@@ -31,7 +29,7 @@
#define MODELPARTFORSTREAM(StreamImpl) \
namespace Slicer { \
template<> ModelPartForRootPtr ModelPart::CreateRootFor(const StreamImpl & stream) { \
- return new ModelPartForStreamRoot<typename StreamImpl::element_type>(const_cast<StreamImpl *>(&stream)); \
+ return std::make_shared<ModelPartForStreamRoot<typename StreamImpl::element_type>>(const_cast<StreamImpl *>(&stream)); \
} \
}
@@ -58,16 +56,16 @@ namespace Slicer {
template<typename T>
void
- typeWrite(::Ice::OutputStreamPtr & s, const ::IceUtil::Optional<T> & m)
+ typeWrite(::Ice::OutputStream & s, const ::IceUtil::Optional<T> & m)
{
if constexpr (!Slicer::isLocal<T>::value) {
typedef Ice::StreamableTraits<T> traits;
typedef Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength> SOH;
- s->startEncapsulation();
- if (m && s->writeOptional(0, SOH::optionalFormat)) {
- SOH::write(s.get(), *m);
+ s.startEncapsulation();
+ if (m && s.writeOptional(0, SOH::optionalFormat)) {
+ SOH::write(&s, *m);
}
- s->endEncapsulation();
+ s.endEncapsulation();
}
else {
throw LocalTypeException();
@@ -76,10 +74,10 @@ namespace Slicer {
template<typename T>
void
- typeWrite(::Ice::OutputStreamPtr & s, const T & m)
+ typeWrite(::Ice::OutputStream & s, const T & m)
{
if constexpr (!Slicer::isLocal<T>::value) {
- s->write(m);
+ s.write(m);
}
else {
throw LocalTypeException();
@@ -88,20 +86,20 @@ namespace Slicer {
template<typename T>
void
- typeRead(::Ice::InputStreamPtr & s, ::IceUtil::Optional<T> & m)
+ typeRead(::Ice::InputStream & s, ::IceUtil::Optional<T> & m)
{
if constexpr (!Slicer::isLocal<T>::value) {
typedef Ice::StreamableTraits<T> traits;
typedef Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength> SOH;
- s->startEncapsulation();
- if (s->readOptional(0, SOH::optionalFormat)) {
- m.__setIsSet();
- SOH::read(s.get(), *m);
+ s.startEncapsulation();
+ if (s.readOptional(0, SOH::optionalFormat)) {
+ m = T();
+ SOH::read(&s, *m);
}
else {
m = IceUtil::None;
}
- s->endEncapsulation();
+ s.endEncapsulation();
}
else {
throw LocalTypeException();
@@ -110,10 +108,10 @@ namespace Slicer {
template<typename T>
void
- typeRead(::Ice::InputStreamPtr & s, T & m)
+ typeRead(::Ice::InputStream & s, T & m)
{
if constexpr (!Slicer::isLocal<T>::value) {
- s->read(m);
+ s.read(m);
}
else {
throw LocalTypeException();
@@ -121,13 +119,13 @@ namespace Slicer {
}
template<typename T>
- void ModelPartForRoot<T>::Write(::Ice::OutputStreamPtr & s) const
+ void ModelPartForRoot<T>::Write(::Ice::OutputStream & s) const
{
typeWrite(s, *ModelObject);
}
template<typename T>
- void ModelPartForRoot<T>::Read(::Ice::InputStreamPtr & s)
+ void ModelPartForRoot<T>::Read(::Ice::InputStream & s)
{
typeRead(s, *ModelObject);
}
@@ -171,7 +169,7 @@ namespace Slicer {
bool ModelPartForConverted<IceUtil::Optional<T>, M, MV>::HasValue() const
{
BOOST_ASSERT(this->Model);
- return *this->Model;
+ return (bool)*this->Model;
}
// Function traits helpers
@@ -195,7 +193,7 @@ namespace Slicer {
template <typename Y>
const T & operator()(const IceUtil::Optional<Y> & x) const { return *x; }
static bool valueExists(const T &) { return true; }
- static bool valueExists(const IceUtil::Optional<T> & y) { return y; }
+ static bool valueExists(const IceUtil::Optional<T> & y) { return y.has_value(); }
};
template <typename X>
struct Coerce<IceUtil::Optional<X>> {
@@ -278,7 +276,7 @@ namespace Slicer {
ModelPartModel<IceUtil::Optional< typename T::element_type> >(h)
{
if (this->Model && *this->Model) {
- modelPart = new T(&**this->Model);
+ modelPart = std::make_shared<T>(&**this->Model);
}
}
@@ -286,7 +284,7 @@ namespace Slicer {
bool ModelPartForOptional<T>::hasModel() const
{
BOOST_ASSERT(this->Model);
- return *this->Model;
+ return (bool)*this->Model;
}
template<typename T>
@@ -295,7 +293,7 @@ namespace Slicer {
BOOST_ASSERT(this->Model);
if (!*this->Model) {
*this->Model = typename T::element_type();
- modelPart = new T(&**this->Model);
+ modelPart = std::make_shared<T>(&**this->Model);
modelPart->Create();
}
}
@@ -394,7 +392,7 @@ namespace Slicer {
template<typename MT, typename MP>
ModelPartPtr ModelPartForComplex<T>::Hook<MT, MP>::Get(T * t) const
{
- return new MP(t ? const_cast<typename std::remove_const<MT>::type *>(&(t->*member)) : NULL);
+ return std::make_shared<MP>(t ? const_cast<typename std::remove_const<MT>::type *>(&(t->*member)) : NULL);
}
template<typename T>
@@ -423,7 +421,7 @@ namespace Slicer {
void ModelPartForClass<T>::Create()
{
BOOST_ASSERT(this->Model);
- *this->Model = new T();
+ *this->Model = std::make_shared<T>();
}
template<typename T>
@@ -443,7 +441,7 @@ namespace Slicer {
bool ModelPartForClass<T>::HasValue() const
{
BOOST_ASSERT(this->Model);
- return *this->Model;
+ return (bool)*this->Model;
}
template<typename T>
@@ -455,7 +453,7 @@ namespace Slicer {
template<typename T>
ModelPartPtr ModelPartForClass<T>::CreateModelPart(void * p)
{
- return new ModelPartForClass<T>(static_cast<element_type *>(p));
+ return std::make_shared<ModelPartForClass<T>>(static_cast<element_type *>(p));
}
template<typename T>
@@ -638,7 +636,7 @@ namespace Slicer {
{
BOOST_ASSERT(this->Model);
for (auto & pair : *this->Model) {
- ch(pairName, new ModelPartForStruct<typename T::value_type>(&pair), NULL);
+ ch(pairName, std::make_shared<ModelPartForStruct<typename T::value_type>>(&pair), NULL);
}
}
@@ -646,7 +644,7 @@ namespace Slicer {
ChildRef ModelPartForDictionary<T>::GetAnonChildRef(const HookFilter &)
{
BOOST_ASSERT(this->Model);
- return ChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
+ return ChildRef(std::make_shared<ModelPartForDictionaryElementInserter<T>>(this->Model));
}
template<typename T>
@@ -656,7 +654,7 @@ namespace Slicer {
if (!optionalCaseEq(name, pairName, matchCase)) {
throw IncorrectElementName(name);
}
- return ChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
+ return ChildRef(std::make_shared<ModelPartForDictionaryElementInserter<T>>(this->Model));
}
template<typename T>
@@ -668,7 +666,7 @@ namespace Slicer {
template<typename T>
ModelPartPtr ModelPartForDictionary<T>::GetContainedModelPart()
{
- return new ModelPartForStruct<typename T::value_type>(nullptr);
+ return std::make_shared<ModelPartForStruct<typename T::value_type>>(nullptr);
}
// ModelPartForStream
@@ -697,7 +695,7 @@ namespace Slicer {
template<typename T>
ModelPartForStreamRoot<T>::ModelPartForStreamRoot(Stream<T> * s) :
- ModelPartForStreamRootBase(new ModelPartForStream<T>(s))
+ ModelPartForStreamRootBase(std::make_shared<ModelPartForStream<T>>(s))
{
}
diff --git a/slicer/slicer/serializer.h b/slicer/slicer/serializer.h
index fbe0bbf..5e76200 100644
--- a/slicer/slicer/serializer.h
+++ b/slicer/slicer/serializer.h
@@ -1,25 +1,23 @@
#ifndef SLICER_SERIALIZER_H
#define SLICER_SERIALIZER_H
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
#include <boost/filesystem/path.hpp>
#include <slicer/modelParts.h>
#include <visibility.h>
#include <factory.h>
namespace Slicer {
- class DLL_PUBLIC Serializer : public IceUtil::Shared {
+ class DLL_PUBLIC Serializer {
public:
virtual void Serialize(ModelPartForRootPtr) = 0;
};
- typedef IceUtil::Handle<Serializer> SerializerPtr;
+ typedef std::shared_ptr<Serializer> SerializerPtr;
- class DLL_PUBLIC Deserializer : public IceUtil::Shared {
+ class DLL_PUBLIC Deserializer {
public:
virtual void Deserialize(ModelPartForRootPtr) = 0;
};
- typedef IceUtil::Handle<Deserializer> DeserializerPtr;
+ typedef std::shared_ptr<Deserializer> DeserializerPtr;
typedef AdHoc::Factory<Serializer, std::ostream &> StreamSerializerFactory;
typedef AdHoc::Factory<Deserializer, std::istream &> StreamDeserializerFactory;
diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp
index e132281..ba24faf 100644
--- a/slicer/slicer/slicer.cpp
+++ b/slicer/slicer/slicer.cpp
@@ -29,7 +29,7 @@ namespace Slicer {
Slicer::ChildRef::operator bool() const
{
- return mpp;
+ return (bool)mpp;
}
const Metadata &
diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h
index 4513ced..7d6f381 100644
--- a/slicer/slicer/slicer.h
+++ b/slicer/slicer/slicer.h
@@ -1,7 +1,6 @@
#ifndef SLICER_H
#define SLICER_H
-#include <Ice/Handle.h>
#include <slicer/modelParts.h>
#include <slicer/serializer.h>
@@ -19,7 +18,7 @@ namespace Slicer {
Object
DeserializeAny(SerializerParams && ... sp)
{
- return DeserializeAnyWith<Object>(new Deserializer(sp ...));
+ return DeserializeAnyWith<Object>(std::make_shared<Deserializer>(sp ...));
}
template <typename Object>
@@ -33,7 +32,7 @@ namespace Slicer {
void
SerializeAny(const Object & object, SerializerParams && ... sp)
{
- SerializeAnyWith(object, new Serializer(sp ...));
+ SerializeAnyWith(object, std::make_shared<Serializer>(sp ...));
}
}
diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam
index 9a801c4..44f9aa1 100644
--- a/slicer/test/Jamfile.jam
+++ b/slicer/test/Jamfile.jam
@@ -6,8 +6,6 @@ import toolset ;
lib dl ;
lib pthread ;
-lib Ice ;
-lib IceUtil ;
lib boost_system ;
lib boost_filesystem ;
lib boost_date_time ;
diff --git a/slicer/test/classes.ice b/slicer/test/classes.ice
index c85f377..5a1642b 100644
--- a/slicer/test/classes.ice
+++ b/slicer/test/classes.ice
@@ -1,6 +1,7 @@
#ifndef SLICER_TEST_CLASSES
#define SLICER_TEST_CLASSES
+#include <classtype.ice>
#include <structs.ice>
module TestModule {
@@ -23,11 +24,6 @@ module TestModule {
double mdouble;
string mstring;
};
- [ "slicer:custommodelpart:TestModule.AbValidator" ]
- class ClassType {
- int a;
- int b;
- };
class ClassClass {
ClassType cls;
StructType str;
diff --git a/slicer/test/classtype.ice b/slicer/test/classtype.ice
new file mode 100644
index 0000000..98ec34a
--- /dev/null
+++ b/slicer/test/classtype.ice
@@ -0,0 +1,14 @@
+#ifndef SLICER_TEST_CLASSTYPE
+#define SLICER_TEST_CLASSTYPE
+
+["slicer:include:conversions.h"]
+module TestModule {
+ [ "slicer:custommodelpart:TestModule.AbValidator" ]
+ class ClassType {
+ int a;
+ int b;
+ };
+};
+
+#endif
+
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index ba87f06..85e13ce 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -15,19 +15,21 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info);
Slicer::ModelPartPtr mpp = Slicer::ModelPart::CreateFor(obj); \
BOOST_REQUIRE_EQUAL(Slicer::Expected, mpp->GetType()); \
\
- auto mppvalue = mpp.get(); \
- auto amppvalue = mpp.get(); \
- auto apmppvalue = mpp.get(); \
- BOOST_TEST_CHECKPOINT(typeid(*mppvalue).name()); \
- BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*amppvalue)); \
- BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*apmppvalue));
+ BOOST_TEST_CONTEXT(#Var) { \
+ auto mppvalue = mpp.get(); \
+ auto amppvalue = mpp.get(); \
+ auto apmppvalue = mpp.get(); \
+ BOOST_TEST_CHECKPOINT(typeid(*mppvalue).name()); \
+ BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*amppvalue)); \
+ BOOST_REQUIRE_EQUAL(typeid(*mppvalue), typeid(*apmppvalue)); \
+ }
#define StackTypeTest(Var, Explicit, Expected) \
TypeTest(Var, Var(), Explicit, Expected)
BOOST_AUTO_TEST_CASE( compile_auto_modelpart_type_class )
{
- TypeTest(TestModule::BuiltInsPtr, new TestModule::BuiltIns(), ModelPartForClass, mpt_Complex);
+ TypeTest(TestModule::BuiltInsPtr, std::make_shared<TestModule::BuiltIns>(), ModelPartForClass, mpt_Complex);
BOOST_REQUIRE_EQUAL(mpp.get(), mpp->GetContainedModelPart().get());
}
@@ -143,7 +145,7 @@ BOOST_AUTO_TEST_CASE( compile_auto_modelpart_type_enum )
BOOST_AUTO_TEST_CASE( normalClassTypeId )
{
- TestModule::BasePtr base = new TestModule::Base(1);
+ TestModule::BasePtr base = std::make_shared<TestModule::Base>(1);
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
@@ -153,7 +155,7 @@ BOOST_AUTO_TEST_CASE( normalClassTypeId )
BOOST_AUTO_TEST_CASE( normalSubClassTypeId )
{
- TestModule::BasePtr base = new TestModule::D1(1, 2);
+ TestModule::BasePtr base = std::make_shared<TestModule::D1>(1, 2);
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
@@ -164,7 +166,7 @@ BOOST_AUTO_TEST_CASE( normalSubClassTypeId )
BOOST_AUTO_TEST_CASE( normalSubSubClassTypeId )
{
- TestModule::BasePtr base = new TestModule::D3(1, 2, 3);
+ TestModule::BasePtr base = std::make_shared<TestModule::D3>(1, 2, 3);
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
@@ -175,7 +177,7 @@ BOOST_AUTO_TEST_CASE( normalSubSubClassTypeId )
BOOST_AUTO_TEST_CASE( localClassTypeId )
{
- Locals::LocalClassPtr base = new Locals::LocalClass(1, "One");
+ Locals::LocalClassPtr base = std::make_shared<Locals::LocalClass>(1, "One");
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
@@ -185,7 +187,7 @@ BOOST_AUTO_TEST_CASE( localClassTypeId )
BOOST_AUTO_TEST_CASE( localSubClassTypeId )
{
- Locals::LocalClassPtr base = new Locals::LocalSubClass(1, "One", 3.1);
+ Locals::LocalClassPtr base = std::make_shared<Locals::LocalSubClass>(1, "One", 3.1);
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
@@ -196,7 +198,7 @@ BOOST_AUTO_TEST_CASE( localSubClassTypeId )
BOOST_AUTO_TEST_CASE( localSubSubClassTypeId )
{
- Locals::LocalClassPtr base = new Locals::LocalSub2Class(1, "One", 3.1, 1);
+ Locals::LocalClassPtr base = std::make_shared<Locals::LocalSub2Class>(1, "One", 3.1, 1);
BOOST_REQUIRE(base);
auto a = Slicer::ModelPart::CreateFor(base);
BOOST_REQUIRE(a);
diff --git a/slicer/test/included/Jamfile.jam b/slicer/test/included/Jamfile.jam
index bbf476d..a0fcac6 100644
--- a/slicer/test/included/Jamfile.jam
+++ b/slicer/test/included/Jamfile.jam
@@ -1,18 +1,15 @@
lib dl ;
lib pthread ;
-lib Ice ;
-lib IceUtil ;
+lib Ice++11 ;
lib included :
included.ice
:
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
: :
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
<include>.
;
diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp
index fbf692a..ae93937 100644
--- a/slicer/test/preprocessor.cpp
+++ b/slicer/test/preprocessor.cpp
@@ -12,7 +12,8 @@ namespace fs = boost::filesystem;
typedef std::map<std::string, unsigned int> ComponentsCount;
ComponentsCount COMPONENTS_IN_TEST_ICE = {
- { "classes.ice", 4 },
+ { "classtype.ice", 1 },
+ { "classes.ice", 3 },
{ "collections.ice", 6 },
{ "enums.ice", 2 },
{ "inheritance.ice", 12 },
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index 8fee506..a94567e 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -25,6 +25,13 @@ namespace fs = boost::filesystem;
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE ( TestModule::ClassMap::iterator )
+BOOST_TEST_DONT_PRINT_LOG_VALUE ( TestModule::SomeNumbers )
+namespace std {
+ template<typename T>
+ ostream & operator<<(ostream & s, const IceUtil::Optional<T> &) {
+ return s;
+ }
+}
// LCOV_EXCL_STOP
class FileBased {
@@ -144,30 +151,30 @@ void
checkInherits_types(const TestModule::InheritanceContPtr & i)
{
BOOST_REQUIRE(i->b);
- BOOST_REQUIRE(TestModule::D1Ptr::dynamicCast(i->b));
- BOOST_REQUIRE_EQUAL(TestModule::D1Ptr::dynamicCast(i->b)->a, 1);
- BOOST_REQUIRE_EQUAL(TestModule::D1Ptr::dynamicCast(i->b)->b, 2);
+ BOOST_REQUIRE(std::dynamic_pointer_cast<TestModule::D1>(i->b));
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D1>(i->b)->a, 1);
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D1>(i->b)->b, 2);
BOOST_REQUIRE_EQUAL(i->bs.size(), 3);
BOOST_REQUIRE(i->bs[0]);
- BOOST_REQUIRE(TestModule::D2Ptr::dynamicCast(i->bs[0]));
- BOOST_REQUIRE_EQUAL(TestModule::D2Ptr::dynamicCast(i->bs[0])->a, 1);
- BOOST_REQUIRE_EQUAL(TestModule::D2Ptr::dynamicCast(i->bs[0])->c, 100);
+ BOOST_REQUIRE(std::dynamic_pointer_cast<TestModule::D2>(i->bs[0]));
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D2>(i->bs[0])->a, 1);
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D2>(i->bs[0])->c, 100);
BOOST_REQUIRE(i->bs[1]);
- BOOST_REQUIRE(TestModule::D3Ptr::dynamicCast(i->bs[1]));
- BOOST_REQUIRE_EQUAL(TestModule::D3Ptr::dynamicCast(i->bs[1])->a, 2);
- BOOST_REQUIRE_EQUAL(TestModule::D3Ptr::dynamicCast(i->bs[1])->c, 100);
- BOOST_REQUIRE_EQUAL(TestModule::D3Ptr::dynamicCast(i->bs[1])->d, 200);
+ BOOST_REQUIRE(std::dynamic_pointer_cast<TestModule::D3>(i->bs[1]));
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D3>(i->bs[1])->a, 2);
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D3>(i->bs[1])->c, 100);
+ BOOST_REQUIRE_EQUAL(std::dynamic_pointer_cast<TestModule::D3>(i->bs[1])->d, 200);
BOOST_REQUIRE(i->bs[2]);
BOOST_REQUIRE_EQUAL(i->bs[2]->a, 3);
- BOOST_REQUIRE(!TestModule::D1Ptr::dynamicCast(i->bs[2]));
- BOOST_REQUIRE(!TestModule::D2Ptr::dynamicCast(i->bs[2]));
- BOOST_REQUIRE(!TestModule::D3Ptr::dynamicCast(i->bs[2]));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D1>(i->bs[2]));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D2>(i->bs[2]));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D3>(i->bs[2]));
BOOST_REQUIRE_EQUAL(i->bm.size(), 3);
- BOOST_REQUIRE(TestModule::D1Ptr::dynamicCast(i->bm.find(10)->second));
- BOOST_REQUIRE(TestModule::D3Ptr::dynamicCast(i->bm.find(12)->second));
- BOOST_REQUIRE(!TestModule::D1Ptr::dynamicCast(i->bm.find(14)->second));
- BOOST_REQUIRE(!TestModule::D2Ptr::dynamicCast(i->bm.find(14)->second));
- BOOST_REQUIRE(!TestModule::D3Ptr::dynamicCast(i->bm.find(14)->second));
+ BOOST_REQUIRE(std::dynamic_pointer_cast<TestModule::D1>(i->bm.find(10)->second));
+ BOOST_REQUIRE(std::dynamic_pointer_cast<TestModule::D3>(i->bm.find(12)->second));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D1>(i->bm.find(14)->second));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D2>(i->bm.find(14)->second));
+ BOOST_REQUIRE(!std::dynamic_pointer_cast<TestModule::D3>(i->bm.find(14)->second));
}
void
@@ -260,14 +267,14 @@ checkBare(const TestXml::BareContainers & bc)
void
checkSomeEnums(const TestModule::SomeEnumsPtr & se)
{
- BOOST_REQUIRE_EQUAL(se->one, TestModule::Ten);
- BOOST_REQUIRE_EQUAL(se->two, TestModule::FiftyFive);
+ BOOST_REQUIRE_EQUAL(se->one, TestModule::SomeNumbers::Ten);
+ BOOST_REQUIRE_EQUAL(se->two, TestModule::SomeNumbers::FiftyFive);
}
void
checkSomeNumbers(const TestModule::SomeNumbers & sn)
{
- BOOST_REQUIRE_EQUAL(sn, TestModule::FiftyFive);
+ BOOST_REQUIRE_EQUAL(sn, TestModule::SomeNumbers::FiftyFive);
}
void
@@ -591,10 +598,10 @@ BOOST_AUTO_TEST_CASE( xml_streams )
BOOST_AUTO_TEST_CASE( invalid_enum )
{
- Slicer::DeserializerPtr jdeserializer = new Slicer::JsonFileDeserializer(rootDir / "initial" / "invalidEnum.json");
+ auto jdeserializer = std::make_shared<Slicer::JsonFileDeserializer>(rootDir / "initial" / "invalidEnum.json");
BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(jdeserializer), Slicer::InvalidEnumerationSymbol);
- Slicer::DeserializerPtr xdeserializer = new Slicer::XmlFileDeserializer(rootDir / "initial" / "invalidEnum.xml");
+ auto xdeserializer = std::make_shared<Slicer::XmlFileDeserializer>(rootDir / "initial" / "invalidEnum.xml");
BOOST_REQUIRE_THROW(Slicer::DeserializeAnyWith<TestModule::SomeNumbers>(xdeserializer), Slicer::InvalidEnumerationSymbol);
}
@@ -625,7 +632,7 @@ BOOST_AUTO_TEST_CASE( missingConversion )
Slicer::DeserializeAny<Slicer::JsonValueDeserializer, TestModule2::MissingConvPtr>(in)
), Slicer::NoConversionFound);
- TestModule2::MissingConvPtr obj = new TestModule2::MissingConv("2016-06-30 12:34:56");
+ auto obj = std::make_shared<TestModule2::MissingConv>("2016-06-30 12:34:56");
json::Value v;
BOOST_REQUIRE_THROW(
Slicer::SerializeAny<Slicer::JsonValueSerializer>(obj, v),
diff --git a/slicer/test/structs.ice b/slicer/test/structs.ice
index e06f93b..fcd17fe 100644
--- a/slicer/test/structs.ice
+++ b/slicer/test/structs.ice
@@ -1,6 +1,8 @@
#ifndef SLICER_TEST_STRUCTS
#define SLICER_TEST_STRUCTS
+#include <classtype.ice>
+
["slicer:include:conversions.h"]
module TestModule {
struct DateTime {
@@ -22,7 +24,6 @@ module TestModule {
int a;
int b;
};
- class ClassType;
struct StructStruct {
ClassType cls;
StructType str;
diff --git a/slicer/tool/Jamfile.jam b/slicer/tool/Jamfile.jam
index cc0ace7..de8b8f8 100644
--- a/slicer/tool/Jamfile.jam
+++ b/slicer/tool/Jamfile.jam
@@ -1,19 +1,37 @@
import package ;
-lib Slice ;
-lib Ice ;
-lib IceUtil ;
+lib Ice++11 ;
lib po : : <name>boost_program_options ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib boost_system ;
lib boost_filesystem ;
+lib mcpp ;
+
+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
+ :
+ <define>register=
+ <cxxflags>-fPIC
+ <cxxflags>-UICE_CPP11_MAPPING
+ <cxxflags>-Wno-error=unused-parameter
+ <include>../../ice/cpp/src
+ <link>static
+ : :
+ <include>../../ice/cpp/src
+ ;
lib slicer-compiler :
parser.cpp
:
<library>Slice
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
+ <library>mcpp
<library>boost_system
<library>boost_filesystem
<library>adhocutil
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index ee7ef8c..c05e2e6 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -308,7 +308,7 @@ namespace Slicer {
e->scoped());
fprintbf(cpp, "{\n\tModelPartForEnum< %s >::Enumerations e;\n",
e->scoped());
- for (const auto & ee : e->getEnumerators()) {
+ for (const auto & ee : e->enumerators()) {
fprintbf(cpp, "\te.insert( { %s, \"%s\" } );\n", ee->scoped(), ee->name());
}
fprintbf(cpp, "\treturn e;\n}());\n\n");
diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam
index e9bcec4..b8a9e4c 100644
--- a/slicer/xml/Jamfile.jam
+++ b/slicer/xml/Jamfile.jam
@@ -2,11 +2,10 @@ import testing ;
import package ;
lib pthread ;
-lib Ice ;
+lib Ice++11 ;
lib boost_system ;
lib boost_filesystem ;
lib boost_utf : : <name>boost_unit_test_framework ;
-lib IceUtil ;
lib adhocutil : : : : <include>/usr/include/adhocutil ;
lib slicer-xml :
@@ -17,8 +16,7 @@ lib slicer-xml :
<library>boost_system
<library>boost_filesystem
<library>pthread
- <library>Ice
- <library>IceUtil
+ <library>Ice++11
<library>../..//libxmlpp
<library>adhocutil
<library>../slicer//slicer