Adjust plugin structure for type c# 50/273750/3
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 13 Apr 2022 08:01:37 +0000 (17:01 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 21 Apr 2022 08:14:12 +0000 (17:14 +0900)
Change-Id: Id5db0f951b8dde25112400c5ac57aa7718a3d622
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
13 files changed:
idlc/gen_cion/cs_cion_gen_base.cc
idlc/gen_cion/cs_cion_gen_base.h
idlc/gen_cion/cs_cion_gen_base_cb.h
idlc/gen_cion/cs_cion_group_gen.cc
idlc/gen_cion/cs_cion_group_gen_cb.h
idlc/gen_cion/cs_cion_proxy_gen.cc
idlc/gen_cion/cs_cion_proxy_gen_cb.h
idlc/gen_cion/cs_cion_stub_gen.cc
idlc/gen_cion/cs_cion_stub_gen_cb.h
idlc/gen_cion/cs_transportable.h
idlc/gen_cion/default_cs_transportable.cc [new file with mode: 0644]
idlc/gen_cion/default_cs_transportable.h [new file with mode: 0644]
idlc/gen_cion/plugin_loader.cc

index 73cb338..8a7d9a3 100644 (file)
@@ -27,7 +27,7 @@ namespace {
 namespace tidl {
 
 CsCionGeneratorBase::CsCionGeneratorBase(std::shared_ptr<Document> doc)
-    : Generator(doc) {
+    : CionPluginBase(std::move(doc)) {
   type_map_ = {
       {"char", "byte"}, {"int", "int"}, {"short", "short"},
       {"long", "long"}, {"string", "string"}, {"bool", "bool"},
@@ -235,7 +235,9 @@ void CsCionGeneratorBase::GenShareFile(std::ofstream& stream, const Interface& i
   if (hasFile == false)
     return;
 
-  stream << CB_SHARE_FILE_DEF << NLine(1);
+  ReplaceAll(CB_SHARE_FILE_DEF)
+      .Change("<SHARE_FILE>", GetTransportable().Cs().GenFileSend("path"))
+      .Out(stream);
 }
 
 void CsCionGeneratorBase::AddSerializerList(const BaseType& type) {
index 57e04d4..ee847fe 100644 (file)
 
 #include "idlc/ast/type.h"
 #include "idlc/ast/structure.h"
-#include "idlc/gen/generator.h"
+#include "idlc/gen_cion/cion_plugin_base.h"
 
 namespace tidl {
 
-class CsCionGeneratorBase : public Generator {
+class CsCionGeneratorBase : public CionPluginBase {
  public:
   explicit CsCionGeneratorBase(std::shared_ptr<Document> doc);
   virtual ~CsCionGeneratorBase() = default;
index 5fd1441..994f884 100644 (file)
@@ -145,11 +145,7 @@ R"__cs_cb(
 
             private void TryShareFile(string path)
             {
-                if (path == null)
-                    throw new ArgumentException("Invalid path");
-
-                FilePayload fp = new FilePayload(path);
-                base.SendPayloadAsync(fp);
+                <SHARE_FILE>
             }
 )__cs_cb";
 
index 99e72f1..3aa49a9 100644 (file)
@@ -27,12 +27,7 @@ CsCionGroupGen::CsCionGroupGen(std::shared_ptr<Document> doc)
 
 void CsCionGroupGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
-  stream << "using System;" << NLine(1)
-         << "using System.Collections.Generic;" << NLine(1)
-         << "using System.Threading;" << NLine(1)
-         << "using Tizen.Applications;" << NLine(1)
-         << "using Tizen.Applications.RPCPort;" << NLine(1)
-         << "using Tizen.Applications.Cion;" << NLine(1);
+  stream << GetTransportable().Cs().GenInclude();
   GenNamespace(stream);
 }
 
@@ -68,11 +63,15 @@ void CsCionGroupGen::GenInterface(std::ofstream& stream, const Interface& iface)
   stream << Tab(2) << "public class " << iface.GetID()
          << " : GroupBase" << NLine(1);
   GenBrace(stream, TAB_SIZE * 2, [&]() {
-    stream << ReplaceAll(CB_DATA_MEMBERS, "<VERSION>", FULLVER);
+    ReplaceAll(CB_DATA_MEMBERS)
+        .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+        .Out(stream);
     GenEvents(stream, iface);
     stream << NLine(1);
     GenMethodId(stream, iface, true);
-    stream << CB_EVENT_METHODS;
+    ReplaceAll(CB_EVENT_METHODS)
+        .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+        .Out(stream);
     GenSerializer(stream);
     GenListSerializer(stream);
     GenCtor(stream, iface);
@@ -206,7 +205,10 @@ void CsCionGroupGen::GenInvocation(std::ofstream& stream,
 
 void CsCionGroupGen::GenCionPayloadReceivedEvent(std::ofstream& stream,
     const Interface& iface) {
-  stream << CB_ON_PAYLOAD_RECEIVED_FRONT;
+  ReplaceAll(CB_ON_PAYLOAD_RECEIVED_FRONT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Change("<PAYLOAD_T>", GetTransportable().Cs().GenPayloadType())
+      .Out(stream);
 
   for (const auto& i : iface.GetDeclarations()) {
     if (i->GetMethodType() == Declaration::MethodType::DELEGATE ||
index ef8c40e..dd01b14 100644 (file)
@@ -21,8 +21,8 @@
  * <VERSION> Version of TIDL Compiler.
  */
 const char CB_DATA_MEMBERS[] =
-R"__cs_cb(            public delegate void JoinedHandler(object sender, PeerInfo peerInfo);
-            public delegate void LeftHandler(object sender, PeerInfo peerInfo);
+R"__cs_cb(            public delegate void JoinedHandler(object sender, <PEER_INFO_T> peerInfo);
+            public delegate void LeftHandler(object sender, <PEER_INFO_T> peerInfo);
 
             /// <summary>
             /// This event will be invoked when the peer group app is joined to the topic.
@@ -64,12 +64,12 @@ R"__cs_cb(
 
 const char CB_EVENT_METHODS[] =
 R"__cs_cb(
-            protected override void OnJoined(PeerInfo peerInfo)
+            protected override void OnJoined(<PEER_INFO_T> peerInfo)
             {
                 Joined?.Invoke(this, peerInfo);
             }
 
-            protected override void OnLeft(PeerInfo peerInfo)
+            protected override void OnLeft(<PEER_INFO_T> peerInfo)
             {
                 Left?.Invoke(this, peerInfo);
             }
@@ -77,7 +77,7 @@ R"__cs_cb(
 
 const char CB_ON_PAYLOAD_RECEIVED_FRONT[] =
 R"__cs_cb(
-            protected override void OnPayloadReceived(Payload payload, PeerInfo peerInfo)
+            protected override void OnPayloadReceived(<PAYLOAD_T> payload, <PEER_INFO_T> peerInfo)
             {
                 Parcel parcelReceived;
 
index 7266b08..d3c69c4 100644 (file)
@@ -27,12 +27,7 @@ CsCionProxyGen::CsCionProxyGen(std::shared_ptr<Document> doc)
 
 void CsCionProxyGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
-  stream << "using System;" << NLine(1)
-         << "using System.Collections.Generic;" << NLine(1)
-         << "using System.Threading;" << NLine(1)
-         << "using Tizen.Applications;" << NLine(1)
-         << "using Tizen.Applications.RPCPort;" << NLine(1)
-         << "using Tizen.Applications.Cion;" << NLine(1);
+  stream << GetTransportable().Cs().GenInclude();
   GenNamespace(stream);
 }
 
@@ -67,7 +62,11 @@ void CsCionProxyGen::GenInterface(std::ofstream& stream, const Interface& iface)
   stream << Tab(2) << "public class " << iface.GetID()
          << " : ClientBase" << NLine(1);
   GenBrace(stream, TAB_SIZE * 2, [&]() {
-    stream << ReplaceAll(CB_DATA_MEMBERS, "<VERSION>", FULLVER);
+    ReplaceAll(CB_DATA_MEMBERS)
+        .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+        .Change("<PAYLOAD_TRANSFER_STATUS>",
+            GetTransportable().Cs().GenPayloadTransferStatusType())
+        .Out(stream);
     GenCallbacks(stream, iface, true);
     GenDelegateId(stream, iface);
     GenMethodId(stream, iface);
@@ -119,7 +118,9 @@ void CsCionProxyGen::GenCtor(std::ofstream& stream, const Interface& iface) {
 
 void CsCionProxyGen::GenConnectMethod(std::ofstream& stream,
     const Interface& iface) {
-  stream << CB_CONNECT_METHOD;
+  ReplaceAll(CB_CONNECT_METHOD)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Out(stream);
   stream << NLine(1);
 }
 
index f321b2c..85169a8 100644 (file)
@@ -21,9 +21,9 @@
  * <VERSION> Version of TIDL Compiler.
  */
 const char CB_DATA_MEMBERS[] =
-R"__cs_cb(            public delegate void DiscoveredEvent(object sender, PeerInfo peerInfo);
+R"__cs_cb(            public delegate void DiscoveredEvent(object sender, <PEER_INFO_T> peerInfo);
             public delegate void DisconnectedEvent(object sender);
-            public delegate void FileReceivedEvent(object sender, FilePayload payload, PayloadTransferStatus status);
+            public delegate void FileReceivedEvent(object sender, FilePayload payload, <PAYLOAD_TRANSFER_STATUS> status);
             public delegate void ConnectionResultEvent(object sender, ConnectionResult result);
 
             public event DiscoveredEvent Discovered;
@@ -40,30 +40,30 @@ R"__cs_cb(            public delegate void DiscoveredEvent(object sender, PeerIn
 
 const char CB_EVENT_METHODS[] =
 R"__cs_cb(
-            protected override void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result)
+            protected override void OnConnectionResult(<PEER_INFO_T> peerInfo, ConnectionResult result)
             {
-               if (result.Status == ConnectionStatus.OK)
-               {
+                if (result.Status == ConnectionStatus.OK)
+                {
                     _online = true;
-               }
+                }
 
                 ConnectionResult?.Invoke(this, result);
             }
 
-            protected override void OnDisconnected(PeerInfo peerInfo)
+            protected override void OnDisconnected(<PEER_INFO_T> peerInfo)
             {
                 _online = false;
                 Disconnected?.Invoke(this);
             }
 
-            protected override void OnDiscovered(PeerInfo peerInfo)
+            protected override void OnDiscovered(<PEER_INFO_T> peerInfo)
             {
                 Discovered?.Invoke(this, peerInfo);
             }
 
-            protected override void OnPayloadReceived(Payload payload, PayloadTransferStatus status)
+            protected override void OnPayloadReceived(<PAYLOAD_T> payload, <PAYLOAD_TRANSFER_STATUS> status)
             {
-                if(payload.PayloadType == PayloadType.FilePayload)
+                if(payload.PayloadType == <PAYLOAD_TYPE_FILE>)
                 {
                     FileReceived?.Invoke(this, (FilePayload)payload, status);
                 }
@@ -136,7 +136,7 @@ R"__cs_cb(
             /// Thrown when the permission is denied.
             /// </exception>
             /// <remark> If you want to use this method, you must add privileges.</remark>
-            public new void Connect(PeerInfo peer)
+            public new void Connect(<PEER_INFO_T> peer)
             {
                 base.Connect(peer);
             }
@@ -191,7 +191,7 @@ $$
 
 const char CB_ASYNC_INVOCATION_MID[] =
 R"__cs_cb(                        // Send
-                                               DataPayload dp = new DataPayload(p.ToBytes());
+                                                DataPayload dp = new DataPayload(p.ToBytes());
                         base.SendPayloadAsync(dp);
 )__cs_cb";
 
index 4aaadc1..b47f572 100644 (file)
@@ -27,11 +27,7 @@ CsCionStubGen::CsCionStubGen(std::shared_ptr<Document> doc)
 
 void CsCionStubGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
-  stream << "using System;" << NLine(1)
-         << "using System.Collections.Generic;" << NLine(1)
-         << "using Tizen.Applications;" << NLine(1)
-         << "using Tizen.Applications.RPCPort;" << NLine(1)
-         << "using Tizen.Applications.Cion;" << NLine(1);
+  stream << GetTransportable().Cs().GenInclude();
 
   GenNamespace(stream);
 }
@@ -66,7 +62,6 @@ void CsCionStubGen::GenInterface(std::ofstream& stream, const Interface& iface)
   stream << Tab(2) << "public sealed class " << iface.GetID()
          << " : ServerBase" << NLine(1);
   GenBrace(stream, TAB_SIZE * 2, [&]() {
-    stream << ReplaceAll(CB_DATA_MEMBERS, "<VERSION>", FULLVER);
     GenServiceBase(stream, iface);
     GenCallbacks(stream, iface, false);
     GenDelegateId(stream, iface);
@@ -85,7 +80,11 @@ void CsCionStubGen::GenInterface(std::ofstream& stream, const Interface& iface)
 }
 
 void CsCionStubGen::GenServiceBase(std::ofstream& stream, const Interface& iface) {
-  stream << CB_SERVICE_BASE_FRONT;
+  ReplaceAll(CB_SERVICE_BASE_FRONT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Change("<PAYLOAD_TRANSFER_STATUS>",
+          GetTransportable().Cs().GenPayloadTransferStatusType())
+      .Out(stream);
   GenDeclarations(stream, iface.GetDeclarations());
   stream << NLine(1);
   stream << AddIndent(TAB_SIZE * 3, "}\n");
@@ -106,7 +105,9 @@ void CsCionStubGen::GenDeclarations(std::ofstream& stream,
 
 void CsCionStubGen::GenReceivedSyncEvent(std::ofstream& stream,
     const Interface& iface) {
-  stream << CB_ON_RECEIVED_SYNC_EVENT_FRONT;
+  ReplaceAll(CB_ON_RECEIVED_SYNC_EVENT_FRONT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Out(stream);
   for (const auto& i : iface.GetDeclarations()) {
     if (i->GetMethodType() != Declaration::MethodType::SYNC)
       continue;
@@ -121,7 +122,14 @@ void CsCionStubGen::GenReceivedSyncEvent(std::ofstream& stream,
 
 void CsCionStubGen::GenReceivedAsyncEvent(std::ofstream& stream,
     const Interface& iface) {
-  stream << CB_ON_RECEIVED_ASYNC_EVENT_FRONT;
+  ReplaceAll(CB_ON_RECEIVED_ASYNC_EVENT_FRONT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Change("<PAYLOAD_TRANSFER_STATUS>",
+          GetTransportable().Cs().GenPayloadTransferStatusType())
+      .Change("<PAYLOAD_T>", GetTransportable().Cs().GenPayloadType())
+      .Change("<PAYLOAD_TYPE_FILE>",
+          GetTransportable().Cs().GenPayloadTypeFile())
+      .Out(stream);
   for (const auto& i : iface.GetDeclarations()) {
     if (i->GetMethodType() != Declaration::MethodType::ASYNC)
       continue;
@@ -256,15 +264,21 @@ void CsCionStubGen::GenAsyncInvocation(std::ofstream& stream, const Declaration&
 }
 
 void CsCionStubGen::GenConnectionRequestedEvent(std::ofstream& stream) {
-  stream << CB_ON_CONNECTIONREQUESTED_EVENT;
+  ReplaceAll(CB_ON_CONNECTIONREQUESTED_EVENT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Out(stream);
 }
 
 void CsCionStubGen::GenConnectedEvent(std::ofstream& stream) {
-  stream << CB_ON_CONNECTED_EVENT;
+  ReplaceAll(CB_ON_CONNECTED_EVENT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Out(stream);
 }
 
 void CsCionStubGen::GenDisconnectedEvent(std::ofstream& stream) {
-  stream << CB_ON_DISCONNECTED_EVENT;
+  ReplaceAll(CB_ON_DISCONNECTED_EVENT)
+      .Change("<PEER_INFO_T>", GetTransportable().Cs().GenPeerInfoType())
+      .Out(stream);
 }
 
 void CsCionStubGen::GenCtor(std::ofstream& stream, const Interface& iface) {
index 82c4b61..056c385 100644 (file)
@@ -45,12 +45,12 @@ R"__cs_cb(
                 /// <summary>
                 /// The PeerInfo of client
                 /// </summary>
-                public PeerInfo Client
+                public <PEER_INFO_T> Client
                 {
                     get;  internal set;
                 }
 
-                internal PeerInfo ConnectionRequestClient;
+                internal <PEER_INFO_T> ConnectionRequestClient;
 
                 internal ServerBase ServerBase;
 
@@ -97,7 +97,7 @@ R"__cs_cb(
                 /// <summary>
                 /// This method will be called when received file payload.
                 /// </summary>
-                public abstract void OnFilePayloadReceived(FilePayload file, PayloadTransferStatus status);
+                public abstract void OnFilePayloadReceived(FilePayload file, <PAYLOAD_TRANSFER_STATUS> status);
 
                 /// <summary>
                 /// This method will be called when the client is disconnected
@@ -112,7 +112,7 @@ R"__cs_cb(
 
 const char CB_ON_RECEIVED_ASYNC_EVENT_FRONT[] =
 R"__cs_cb(
-            protected override void OnPayloadReceived(Payload data, PeerInfo peerInfo, PayloadTransferStatus status)
+            protected override void OnPayloadReceived(<PAYLOAD_T> data, <PEER_INFO_T> peerInfo, <PAYLOAD_TRANSFER_STATUS> status)
             {
                 try
                 {
@@ -136,7 +136,7 @@ R"__cs_cb(
                         return;
                     }
 
-                    if (data.PayloadType == PayloadType.FilePayload)
+                    if (data.PayloadType == <PAYLOAD_TYPE_FILE>)
                     {
                         b.OnFilePayloadReceived((FilePayload)data, status);
                         return;
@@ -175,7 +175,7 @@ R"__cs_cb(
 
 const char CB_ON_RECEIVED_SYNC_EVENT_FRONT[] =
 R"__cs_cb(
-               protected override byte[] OnDataReceived(byte[] data, PeerInfo peerInfo)
+            protected override byte[] OnDataReceived(byte[] data, <PEER_INFO_T> peerInfo)
             {
                 Parcel p;
                 byte[] returnData = new byte[0];
@@ -241,7 +241,7 @@ R"__cs_cb(
 
 const char CB_ON_CONNECTIONREQUESTED_EVENT[] =
 R"__cs_cb(
-            protected override void OnConnectionRequest(PeerInfo peerInfo)
+            protected override void OnConnectionRequest(<PEER_INFO_T> peerInfo)
             {
                 ServiceBase s = Activator.CreateInstance(_serviceType) as ServiceBase;
                 s.ServiceName = base.ServiceName;
@@ -255,7 +255,7 @@ R"__cs_cb(
 
 const char CB_ON_CONNECTED_EVENT[] =
 R"__cs_cb(
-            protected override void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result)
+            protected override void OnConnectionResult(<PEER_INFO_T> peerInfo, ConnectionResult result)
             {
                 foreach (var i in _services)
                 {
@@ -279,7 +279,7 @@ R"__cs_cb(
 
 const char CB_ON_DISCONNECTED_EVENT[] =
 R"__cs_cb(
-            protected override void OnDisconnected(PeerInfo peerInfo)
+            protected override void OnDisconnected(<PEER_INFO_T> peerInfo)
             {
                 foreach (var i in _services)
                 {
@@ -325,28 +325,28 @@ R"__cs_cb(
             }
 
 
-                       /// <summary>
-                       /// Stops the listen operation.
-                       /// </summary>
-                       /// <exception cref="InvalidOperationException">Thrown when the server is not listening.</exception>
-                       public new void Stop()
-                       {
-                               base.Stop();
-                               _services.Clear();
-                       }
-
-                       /// <summary>
-                       /// Sets ondemand launch enabled flag.
-                       /// </summary>
-                       /// <param name="enable">Whether ondemand launch is enabled or not.</param>
-                       /// <exception cref="UnauthorizedAccessException">
-                       /// Thrown when an application does not have the privilege to access this method.
-                       /// </exception>
-                       /// <privilege>http://tizen.org/privilege/d2d.remotelaunch</privilege>
-                       public new void SetOndemandLaunchEnabled(bool enable)
-                       {
-                           base.SetOndemandLaunchEnabled(enable);
-                       }
+            /// <summary>
+            /// Stops the listen operation.
+            /// </summary>
+            /// <exception cref="InvalidOperationException">Thrown when the server is not listening.</exception>
+            public new void Stop()
+            {
+                base.Stop();
+                _services.Clear();
+            }
+
+            /// <summary>
+            /// Sets ondemand launch enabled flag.
+            /// </summary>
+            /// <param name="enable">Whether ondemand launch is enabled or not.</param>
+            /// <exception cref="UnauthorizedAccessException">
+            /// Thrown when an application does not have the privilege to access this method.
+            /// </exception>
+            /// <privilege>http://tizen.org/privilege/d2d.remotelaunch</privilege>
+            public new void SetOndemandLaunchEnabled(bool enable)
+            {
+                base.SetOndemandLaunchEnabled(enable);
+            }
 
             /// <summary>
             /// Gets service objects which are connected
index 0851805..317506d 100644 (file)
@@ -24,6 +24,20 @@ namespace tidl {
 class CsTransportable {
  public:
   virtual ~CsTransportable() = default;
+  virtual std::string GenInclude() const = 0;
+  virtual std::string GenFileSend(std::string path) const = 0;
+  virtual std::string GenGroupType() const = 0;
+  virtual std::string GenPayloadTransferStatusType() const = 0;
+  virtual std::string GenPeerInfoType() const = 0;
+  virtual std::string GenPayloadType() const = 0;
+  virtual std::string GenClientType() const = 0;
+  virtual std::string GenServerType() const = 0;
+  virtual std::string GenClientExtraHeader() const = 0;
+  virtual std::string GenClientExtraBody() const = 0;
+  virtual std::string GenServerExtraHeader() const = 0;
+  virtual std::string GenServerExtraBody() const = 0;
+  virtual std::string GenPayloadTypeData() const = 0;
+  virtual std::string GenPayloadTypeFile() const = 0;
 };
 
 }  // namespace tidl
diff --git a/idlc/gen_cion/default_cs_transportable.cc b/idlc/gen_cion/default_cs_transportable.cc
new file mode 100644 (file)
index 0000000..010be78
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "idlc/gen_cion/default_cs_transportable.h"
+
+#include <utility>
+
+#include "idlc/gen/replace_all.h"
+
+namespace {
+
+constexpr const char __USING[] =
+R"__cs_cb(
+using System;
+using System.Collections.Generic;
+using Tizen.Applications;
+using Tizen.Applications.Cion;
+)__cs_cb";
+
+constexpr const char __FILE_SEND[] =
+R"__cs_cb(if (path == null)
+  throw new ArgumentException("Invalid path");
+
+  <PAYLOAD_T> fp = new FilePayload(<FILE_PATH>);
+  base.SendPayloadAsync(fp);
+)__cs_cb";
+
+}  // namespace
+
+namespace tidl {
+
+std::string DefaultCsTransportable::GenInclude() const {
+  return __USING;
+}
+
+std::string DefaultCsTransportable::GenFileSend(std::string path) const {
+  return std::string(ReplaceAll(__FILE_SEND, {
+      { "<FILE_PATH>", path } }));
+}
+
+std::string DefaultCsTransportable::GenGroupType() const {
+  return "GroupBase";
+}
+
+std::string DefaultCsTransportable::GenPayloadTransferStatusType() const {
+  return "PayloadTransferStatus";
+}
+
+std::string DefaultCsTransportable::GenPeerInfoType() const {
+  return "PeerInfo";
+}
+
+std::string DefaultCsTransportable::GenPayloadType() const {
+  return "Payload";
+}
+
+std::string DefaultCsTransportable::GenClientType() const {
+  return "ClientBase";
+}
+
+std::string DefaultCsTransportable::GenServerType() const {
+  return "ServerBase";
+}
+
+std::string DefaultCsTransportable::GenClientExtraHeader() const {
+  return "";
+}
+
+std::string DefaultCsTransportable::GenClientExtraBody() const {
+  return "";
+}
+
+std::string DefaultCsTransportable::GenServerExtraHeader() const {
+  return "";
+}
+
+std::string DefaultCsTransportable::GenServerExtraBody() const {
+  return "";
+}
+
+std::string DefaultCsTransportable::GenPayloadTypeData() const {
+  return "PayloadType.DataPayload";
+}
+
+std::string DefaultCsTransportable::GenPayloadTypeFile() const {
+  return "PayloadType.FilePayload";
+}
+
+}  // namespace tidl
diff --git a/idlc/gen_cion/default_cs_transportable.h b/idlc/gen_cion/default_cs_transportable.h
new file mode 100644 (file)
index 0000000..2f02641
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef IDLC_GEN_CION_DEFAULT_CS_TRANSPORTABLE_H_
+#define IDLC_GEN_CION_DEFAULT_CS_TRANSPORTABLE_H_
+
+#include <string>
+
+#include "idlc/gen_cion/cs_transportable.h"
+
+namespace tidl {
+
+class DefaultCsTransportable : public CsTransportable {
+ public:
+  virtual ~DefaultCsTransportable() = default;
+  std::string GenInclude() const override;
+  std::string GenFileSend(std::string path) const override;
+  std::string GenGroupType() const override;
+  std::string GenPayloadTransferStatusType() const override;
+  std::string GenPeerInfoType() const override;
+  std::string GenPayloadType() const override;
+  std::string GenClientType() const override;
+  std::string GenServerType() const override;
+  std::string GenClientExtraHeader() const override;
+  std::string GenClientExtraBody() const override;
+  std::string GenServerExtraHeader() const override;
+  std::string GenServerExtraBody() const override;
+  std::string GenPayloadTypeData() const override;
+  std::string GenPayloadTypeFile() const override;
+};
+
+}  // namespace tidl
+
+#endif  // IDLC_GEN_CION_DEFAULT_CS_TRANSPORTABLE_H_
index 7b7a6d2..8b177ce 100644 (file)
@@ -19,6 +19,7 @@
 #include "idlc/gen_cion/default_c_transportable.h"
 #include "idlc/gen_cion/default_cpp_transportable.h"
 #include "idlc/gen_cion/default_java_transportable.h"
+#include "idlc/gen_cion/default_cs_transportable.h"
 
 namespace tidl {
 
@@ -26,7 +27,7 @@ PluginLoader::PluginLoader(const std::string& plugin_path) {
   if (plugin_path.empty()) {
     C_.reset(new DefaultCTransportable());
     Cpp_.reset(new DefaultCppTransportable());
-    // Cs_.reset(new DefaultCsTransportable());
+    Cs_.reset(new DefaultCsTransportable());
     Java_.reset(new DefaultJavaTransportable());
   } else {
     // TODO