summaryrefslogtreecommitdiff
path: root/project2/ice/iceDataSource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/ice/iceDataSource.cpp')
-rw-r--r--project2/ice/iceDataSource.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp
new file mode 100644
index 0000000..5cfd5b1
--- /dev/null
+++ b/project2/ice/iceDataSource.cpp
@@ -0,0 +1,43 @@
+#include <pch.hpp>
+#include "iceDataSource.h"
+#include "buildComms.h"
+#include "buildShared.h"
+#include "buildClient.h"
+#include <Ice/Ice.h>
+
+IceDataSource::Libs IceDataSource::libs;
+IceDataSource::Proxies IceDataSource::proxies;
+
+DECLARE_OPTIONS(IceDataSource, "ICE Data Source")
+("ice.client.slice", Options::functions(boost::bind(&IceDataSource::SetSlice, _1), boost::bind(&IceDataSource::ClearSlice)),
+ "The ICE Slice file(s) to compile")
+END_OPTIONS(IceDataSource);
+
+int dummy = 0;
+IceDataSource::IceDataSource(ScriptNodePtr p) :
+ DataSource(p),
+ endpoint(p, "endpoint"),
+ ic(Ice::initialize(dummy, NULL))
+{
+}
+
+void
+IceDataSource::SetSlice(const VariableType & vslice)
+{
+ auto slice = vslice.as<std::string>();
+ BuildComms bc(slice);
+ BuildShared bcs(slice, { &bc });
+ BuildClient bcl(slice, { &bcs });
+ bcl.Update();
+ libs.insert({ slice, bcl.Open() });
+}
+
+void
+IceDataSource::ClearSlice()
+{
+ libs.clear();
+ proxies.clear();
+}
+
+DECLARE_LOADER("icedatasource", IceDataSource);
+