summaryrefslogtreecommitdiff
path: root/project2/ice
diff options
context:
space:
mode:
Diffstat (limited to 'project2/ice')
-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
28 files changed, 131 insertions, 112 deletions
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() },