Remove useless code 23/277823/2
authorjh9216.park <jh9216.park@samsung.com>
Wed, 13 Jul 2022 23:21:51 +0000 (19:21 -0400)
committerjh9216.park <jh9216.park@samsung.com>
Wed, 13 Jul 2022 23:25:25 +0000 (19:25 -0400)
- There is no sync method or delegate type in group mode, we don't need
to consider them

Change-Id: I6c2b39851acc4dd6b2c84300e3d1c98e820bc519
Signed-off-by: jh9216.park <jh9216.park@samsung.com>
idlc/gen_cion/cpp_cion_group_body_gen.cc
idlc/gen_cion/cpp_cion_group_body_gen_cb.h

index 0c2748b..e497b1a 100644 (file)
@@ -125,9 +125,6 @@ void CppCionGroupBodyGen::GenCionPayloadReceivedEvent(std::ofstream& stream,
       });
 
   for (const auto& i : iface.GetDeclarations()) {
-    if (i->GetMethodType() == Declaration::MethodType::DELEGATE ||
-        i->GetMethodType() == Declaration::MethodType::SYNC)
-      continue;
     stream << Tab(2) << "case static_cast<int>(MethodId::"
            << i->GetID() << "): ";
     GenBrace(stream, TAB_SIZE * 2, [&]() {
@@ -170,9 +167,6 @@ void CppCionGroupBodyGen::GenMethods(std::ofstream& stream,
   auto& decls = iface.GetDeclarations();
 
   for (const auto& i : decls) {
-    if (i->GetMethodType() == Declaration::MethodType::DELEGATE)
-      continue;
-
     GenDeclaration(stream, iface, *i);
     GenBrace(stream, 0, [&]() {
       GenInvocation(stream, *i);
@@ -190,13 +184,9 @@ void CppCionGroupBodyGen::GenInvocation(std::ofstream& stream,
          << "rpc_port_parcel_write_int32(p, static_cast<int>(MethodId::"
          << decl.GetID() << "));" << NLine(1);
   std::string m;
-  std::string l;
   for (const auto& i : decl.GetParameters()) {
     auto& pt = i->GetParameterType();
     m += ConvertTypeToSerializer(pt.GetBaseType(), i->GetID(), "p");
-    if (IsDelegateType(pt.GetBaseType())) {
-      l += "delegate_list_.emplace_back(" + i->GetID() + ".release());\n";
-    }
   }
   stream << AddIndent(TAB_SIZE, m) << NLine(1);
 
@@ -204,23 +194,15 @@ void CppCionGroupBodyGen::GenInvocation(std::ofstream& stream,
   GenBrace(stream, TAB_SIZE, [&]() {
     stream << Tab(2) << "std::lock_guard<std::recursive_mutex> lock(mutex_);"
            << NLine(2);
-    if (!l.empty())
-      stream << AddIndent(TAB_SIZE * 2, l);
-    else if (decl.GetMethodType() == Declaration::MethodType::ASYNC)
-      stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, {
-              { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
-              { "<GROUP_PUBLISH>", GetTransportable().Cpp().GenGroupPublish() }
-          }) << NLine(1);
+    stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, {
+        { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
+        { "<GROUP_PUBLISH>", GetTransportable().Cpp().GenGroupPublish() }
+    }) << NLine(1);
   }, false, false);
   stream << " while (false);" << NLine(1);
 
-  if (decl.GetMethodType() == Declaration::MethodType::ASYNC) {
-    stream << Tab(1) << "rpc_port_parcel_destroy(p);"
-           << NLine(1);
-    return;
-  }
-
-  stream << CB_INVOCATION_END;
+  stream << Tab(1) << "rpc_port_parcel_destroy(p);"
+         << NLine(1);
 }
 
 }  // namespace tidl
index deb92ed..dfac993 100644 (file)
@@ -46,13 +46,6 @@ R"__cpp_cb(
     <GROUP_PUBLISH>
 )__cpp_cb";
 
-const char CB_INVOCATION_END[] =
-R"__cpp_cb(
-  rpc_port_parcel_destroy(p);
-
-  return ret;
-)__cpp_cb";
-
 const char CB_GROUP_ON_PAYLOAD_RECEIVED_CB_FRONT[] =
 R"__cpp_cb(
 void <CLS_NAME>::OnPayloadReceivedCB(const <PEER_INFO_T> peer_info,