summaryrefslogtreecommitdiff
path: root/project2/ice/slice2Rows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/ice/slice2Rows.cpp')
-rw-r--r--project2/ice/slice2Rows.cpp51
1 files changed, 10 insertions, 41 deletions
diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp
index a90b643..3534aff 100644
--- a/project2/ice/slice2Rows.cpp
+++ b/project2/ice/slice2Rows.cpp
@@ -4,7 +4,7 @@
#include <Slice/CPlusPlusUtil.h>
Slice2Rows::Slice2Rows(FILE * c) :
- code(c)
+ Slice2Common(c)
{
}
@@ -42,48 +42,17 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o)
// Execute
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");
- fprintf(code, "\t\t\t\t\t\tLogger()->messagebf(LOG_DEBUG, \"%%s: ");
- BOOST_FOREACH(const auto & p, o->parameters()) {
- fprintf(code, "%s = %%s, ", p->name().c_str());
- }
- fprintf(code, "ice @ %%p\", \n");
- fprintf(code, "\t\t\t\t\t\t\t\t__PRETTY_FUNCTION__, ");
- BOOST_FOREACH(const auto & p, o->parameters()) {
- fprintf(code, "%s(ec), ", p->name().c_str());
- }
- fprintf(code, "ice);\n");
- fprintf(code, "\t\t\t\t\t\tIce::Context ctx;\n");
- BOOST_FOREACH(const auto & p, o->parameters()) {
- if (p->optional()) {
- fprintf(code, "\t\t\t\t\t\tauto _%s = IceConvert< ::IceUtil::Optional< %s > >::FromVariable(%s(ec));\n",
- p->name().c_str(),
- Slice::typeToString(p->type()).c_str(),
- p->name().c_str());
- }
- else {
- fprintf(code, "\t\t\t\t\t\tauto _%s = IceConvert< %s >::FromVariable(%s(ec));\n",
- p->name().c_str(),
- Slice::typeToString(p->type()).c_str(),
- p->name().c_str());
- }
- }
- fprintf(code, "\t\t\t\t\t\tIceRowState<decltype(service->%s(", o->name().c_str());
- BOOST_FOREACH(const auto & p, o->parameters()) {
- fprintf(code, "_%s, ", p->name().c_str());
- }
- fprintf(code, "ctx))> irs;\n");
- fprintf(code, "\t\t\t\t\t\tirs.IterateOver(service->%s(", o->name().c_str());
- BOOST_FOREACH(const auto & p, o->parameters()) {
- fprintf(code, "_%s, ", p->name().c_str());
- }
- fprintf(code, "ctx), rp);\n");
+ FunctionBegin(o);
+ fprintf(code, "\t\t\t\t\t\tSlicer::SerializerPtr toRpc = new RowProcSerializer(rp);\n");
+ fprintf(code, "\t\t\t\t\t\tauto result = ");
+ CallOperation(o);
+ fprintf(code, ";\n");
+ fprintf(code, "\t\t\t\t\t\tSlicer::ModelPartPtr mp = new Slicer::ModelPartForSequence<decltype(result)>(&result);\n");
+ fprintf(code, "\t\t\t\t\t\ttoRpc->Serialize(mp);\n");
fprintf(code, "\t\t\t\t\t}\n\n");
- // Parameter variables
- BOOST_FOREACH(const auto & p, o->parameters()) {
- fprintf(code, "\t\t\t\t\tconst Variable %s;\n", p->name().c_str());
- }
+ ParameterVariables(o);
fprintf(code, "\t\t\t};\n");
- fprintf(code, "\t\t\tDECLARE_LOADER(\"%s-%s-%s\", %s);\n\n", module.c_str(), interface.c_str(), o->name().c_str(), o->name().c_str());
+ Declaration(o);
}
}