[aitt] Implement Cpp generator 04/279404/32
authorSukhyungKang <shine.kang@samsung.com>
Tue, 9 Aug 2022 01:32:08 +0000 (10:32 +0900)
committerjusung <jusung07.son@samsung.com>
Wed, 14 Sep 2022 08:23:23 +0000 (17:23 +0900)
Change-Id: I375c50c3d17565633ffce91dc3753b2cd6de7798
Signed-off-by: SukhyungKang <shine.kang@samsung.com>
Signed-off-by: jusung <jusung07.son@samsung.com>
36 files changed:
Makefile.dibs
idlc/gen_aitt_plugin/aitt_plugin_c_transportable.cc
idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.cc [new file with mode: 0644]
idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.h [new file with mode: 0644]
idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen.cc
idlc/gen_aitt_plugin/aitt_plugin_internal_body_gen_cb.h
idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen.cc
idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen_cb.h
idlc/gen_aitt_plugin/aitt_plugin_loader.cc
idlc/gen_cion/c_cion_body_gen_base.cc
idlc/gen_cion/c_cion_gen_base.cc
idlc/gen_cion/c_cion_gen_base.h
idlc/gen_cion/c_cion_group_body_gen.cc
idlc/gen_cion/c_cion_proxy_body_gen.cc
idlc/gen_cion/c_cion_stub_body_gen.cc
idlc/gen_cion/cpp_cion_gen_base.cc
idlc/gen_cion/cpp_cion_gen_base.h
idlc/gen_cion/cpp_cion_gen_base_cb.h
idlc/gen_cion/cpp_cion_group_body_gen.cc
idlc/gen_cion/cpp_cion_group_body_gen_cb.h
idlc/gen_cion/cpp_cion_group_header_gen.cc
idlc/gen_cion/cpp_cion_group_header_gen_cb.h
idlc/gen_cion/cpp_cion_proxy_body_gen.cc
idlc/gen_cion/cpp_cion_proxy_body_gen_cb.h
idlc/gen_cion/cpp_cion_proxy_header_gen.cc
idlc/gen_cion/cpp_cion_proxy_header_gen_cb.h
idlc/gen_cion/cpp_cion_stub_body_gen.cc
idlc/gen_cion/cpp_cion_stub_body_gen_cb.h
idlc/gen_cion/cpp_cion_stub_header_gen.cc
idlc/gen_cion/cpp_cion_stub_header_gen_cb.h
idlc/gen_cion/cpp_transportable.h
idlc/gen_cion/default_cpp_transportable.cc
idlc/gen_cion/default_cpp_transportable.h
idlc/main.cc
tests/build_tests/CMakeLists.txt
tests/build_tests/prebuild.sh

index 6c0bb382e47694b296abc69e979d59205877a45e..2f74b732214268376af299ef86f9a494c98cb475 100644 (file)
@@ -70,6 +70,7 @@ SRC_FILES := \
        idlc/gen_aitt_plugin/aitt_plugin_internal_header_gen.cc \
        idlc/gen_aitt_plugin/aitt_plugin_loader.cc \
        idlc/gen_aitt_plugin/aitt_plugin_java_transportable.cc \
+       idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.cc \
        idlc/options.cc \
        idlc/main.cc
 
index 7a1ddf6604d98b77d0b9c34e7228bd1f1f76f468..bb70f2b51dbb839d0d33265f81e5fde5c3bfa173 100644 (file)
@@ -24,97 +24,97 @@ namespace {
 
 constexpr const char __CLINET_FILE_SEND[] =
 R"__c_cb(
-    plugin_payload_h pl;
-    int ret = plugin_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+    <INTERNAL_PREFIX>_payload_h pl;
+    int ret = <INTERNAL_PREFIX>_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
 
     if (ret != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_payload_create : %d", ret);
+      _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret);
       return ret;
     }
 
-    ret = plugin_payload_set_file_path(pl, <FILE_PATH>);
+    ret = <INTERNAL_PREFIX>_payload_set_file_path(pl, <FILE_PATH>);
     if (ret != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_payload_set_file_path : %d - %s", ret, value);
-      plugin_payload_destroy(pl);
+      _E("Failed to <INTERNAL_PREFIX>_payload_set_file_path : %d - %s", ret, value);
+      <INTERNAL_PREFIX>_payload_destroy(pl);
       return ret;
     }
 
-    ret = plugin_client_send_payload_async(<CLIENT_H>, pl, NULL, NULL);
+    ret = <INTERNAL_PREFIX>_client_send_payload_async(<CLIENT_H>, pl, NULL, NULL);
     if (ret != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_client_send_payload_async : %d - %s", ret, value);
-      plugin_payload_destroy(pl);
+      _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d - %s", ret, value);
+      <INTERNAL_PREFIX>_payload_destroy(pl);
       return ret;
     }
 
-    plugin_payload_destroy(pl);
+    <INTERNAL_PREFIX>_payload_destroy(pl);
 )__c_cb";
 
 constexpr const char __SERVER_FILE_SEND[] =
 R"__c_cb(
-    plugin_payload_h pl;
-    int r = plugin_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+    <INTERNAL_PREFIX>_payload_h pl;
+    int r = <INTERNAL_PREFIX>_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
 
     if (r != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_payload_create : %d", r);
+      _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", r);
       return r;
     }
 
-    r = plugin_payload_set_file_path(pl, <FILE_PATH>);
+    r = <INTERNAL_PREFIX>_payload_set_file_path(pl, <FILE_PATH>);
     if (r != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_payload_set_file_path : %d - %s", r, value);
-      plugin_payload_destroy(pl);
+      _E("Failed to <INTERNAL_PREFIX>_payload_set_file_path : %d - %s", r, value);
+      <INTERNAL_PREFIX>_payload_destroy(pl);
       return r;
     }
 
-    r = plugin_server_send_payload_async(<SERVER_H>, <PEER_H>, pl, NULL, NULL);
+    r = <INTERNAL_PREFIX>_server_send_payload_async(<SERVER_H>, <PEER_H>, pl, NULL, NULL);
     if (r != AITT_PLUGIN_ERROR_NONE) {
-      _E("Failed to plugin_server_send_payload_async : %d - %s", r, value);
-      plugin_payload_destroy(pl);
+      _E("Failed to <INTERNAL_PREFIX>_server_send_payload_async : %d - %s", r, value);
+      <INTERNAL_PREFIX>_payload_destroy(pl);
       return r;
     }
 
-    plugin_payload_destroy(pl);
+    <INTERNAL_PREFIX>_payload_destroy(pl);
 )__c_cb";
 
 constexpr const char __SERVER_REGISTER[] =
 R"__c_cb(
 
-  ret = plugin_server_create(&__<NAME>.stub, service_name, display_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+  ret = <INTERNAL_PREFIX>_server_create(&__<NAME>.stub, service_name, display_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to create stub handle. error(%d)", ret);
     <PREFIX>_<NAME>_unregister();
     return ret;
   }
 
-  ret = plugin_server_add_connection_result_cb(__<NAME>.stub, __<PREFIX>_<NAME>_connection_result_cb, &__<NAME>);
+  ret = <INTERNAL_PREFIX>_server_add_connection_result_cb(__<NAME>.stub, __<PREFIX>_<NAME>_connection_result_cb, &__<NAME>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add connection result event callback");
     <PREFIX>_<NAME>_unregister();
     return ret;
   }
 
-  ret = plugin_server_add_payload_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_payload_received_cb, &__<NAME>);
+  ret = <INTERNAL_PREFIX>_server_add_payload_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_payload_received_cb, &__<NAME>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add payload recieved event callback");
     <PREFIX>_<NAME>_unregister();
     return ret;
   }
 
-  ret = plugin_server_add_disconnected_cb(__<NAME>.stub, __<PREFIX>_<NAME>_disconnected_cb, &__<NAME>);
+  ret = <INTERNAL_PREFIX>_server_add_disconnected_cb(__<NAME>.stub, __<PREFIX>_<NAME>_disconnected_cb, &__<NAME>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add disconnected event callback");
     <PREFIX>_<NAME>_unregister();
     return ret;
   }
 
-  ret = plugin_server_set_data_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_data_received_cb, &__<NAME>);
+  ret = <INTERNAL_PREFIX>_server_set_data_received_cb(__<NAME>.stub, __<PREFIX>_<NAME>_data_received_cb, &__<NAME>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add data recieved event callback");
     <PREFIX>_<NAME>_unregister();
     return ret;
   }
 
-  ret = plugin_server_listen(__<NAME>.stub, __<PREFIX>_<NAME>_connection_request_cb, &__<NAME>);
+  ret = <INTERNAL_PREFIX>_server_listen(__<NAME>.stub, __<PREFIX>_<NAME>_connection_request_cb, &__<NAME>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to listen events. error(%d)", ret);
     <PREFIX>_<NAME>_unregister();
@@ -125,35 +125,35 @@ R"__c_cb(
 constexpr const char __SERVER_UNREGISTER[] =
 R"__c_cb(
   if (__<NAME>.stub) {
-    plugin_server_destroy(__<NAME>.stub);
+    <INTERNAL_PREFIX>_server_destroy(__<NAME>.stub);
     __<NAME>.stub = nullptr;
   }
 )__c_cb";
 
 constexpr const char __SERVER_ACCEPT[] =
 R"__c_cb(
-  ret = plugin_server_accept(__<NAME>.stub, peer_info);
+  ret = <INTERNAL_PREFIX>_server_accept(__<NAME>.stub, peer_info);
   if (ret != AITT_PLUGIN_ERROR_NONE)
     _E("Failed to accept. error(%d)", ret);
 )__c_cb";
 
 constexpr const char __SERVER_REJECT[] =
 R"__c_cb(
-  ret = plugin_server_reject(__<NAME>.stub, peer_info, reason);
+  ret = <INTERNAL_PREFIX>_server_reject(__<NAME>.stub, peer_info, reason);
   if (ret != AITT_PLUGIN_ERROR_NONE)
     _E("Failed to reject. error(%d)", ret);
 )__c_cb";
 
 constexpr const char __SERVER_SET_DISPLAY_NAME[] =
 R"__c_cb(
-  ret = plugin_server_set_display_name(__<NAME>.stub, display_name);
+  ret = <INTERNAL_PREFIX>_server_set_display_name(__<NAME>.stub, display_name);
   if (ret != AITT_PLUGIN_ERROR_NONE)
     _E("Failed to set display name. error(%d)", ret);
 )__c_cb";
 
 constexpr const char __CLIENT_TRY_CONNECT[] =
 R"__c_cb(
-  ret = plugin_client_connect(<CLIENT>, <PEER>);
+  ret = <INTERNAL_PREFIX>_client_connect(<CLIENT>, <PEER>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to connect to stub. error(%d)", ret);
     return ret;
@@ -162,7 +162,7 @@ R"__c_cb(
 
 constexpr const char __CLIENT_DISCONNECT[] =
 R"__c_cb(
-  ret = plugin_client_disconnect(<CLIENT>);
+  ret = <INTERNAL_PREFIX>_client_disconnect(<CLIENT>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to disconnect to stub. error(%d)", ret);
     return ret;
@@ -171,7 +171,7 @@ R"__c_cb(
 
 constexpr const char __CLIENT_TRY_DISCOVERY[] =
 R"__c_cb(
-  ret = plugin_client_try_discovery(<CLIENT>, __<PREFIX>_<NAME>_discovered, h);
+  ret = <INTERNAL_PREFIX>_client_try_discovery(<CLIENT>, __<PREFIX>_<NAME>_discovered, h);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to discovery to stub. error(%d)", ret);
     return ret;
@@ -180,7 +180,7 @@ R"__c_cb(
 
 constexpr const char __CLIENT_STOP_DISCOVERY[] =
 R"__c_cb(
-  ret = plugin_client_stop_discovery(<CLIENT>);
+  ret = <INTERNAL_PREFIX>_client_stop_discovery(<CLIENT>);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to stop discovery to stub. error(%d)", ret);
     return ret;
@@ -189,31 +189,31 @@ R"__c_cb(
 
 constexpr const char __CLIENT_SEND_ASYNC[] =
 R"__c_cb(
-  res_ = plugin_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+  res_ = <INTERNAL_PREFIX>_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_create : %d", res_);
-    plugin_payload_destroy(<PAYLOAD>);
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", res_);
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
     goto out;
   }
 
-  res_ = plugin_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
+  res_ = <INTERNAL_PREFIX>_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_set_data : %d", res_);
-    plugin_payload_destroy(<PAYLOAD>);
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", res_);
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
     goto out;
   }
 
-  res_ = plugin_client_send_payload_async(<CLIENT>, <PAYLOAD>, NULL, NULL);
-  plugin_payload_destroy(<PAYLOAD>);
+  res_ = <INTERNAL_PREFIX>_client_send_payload_async(<CLIENT>, <PAYLOAD>, NULL, NULL);
+  <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_client_send_payload_async : %d", res_);
+    _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d", res_);
     goto out;
   }
 )__c_cb";
 
 constexpr const char __CLIENT_SEND[] =
 R"__c_cb(
-  res_ = plugin_client_send_data(<CLIENT>, <DATA>, <DATA_SIZE> , 5 * 1000, &<RET_DATA>, &<RET_DATA_SIZE>);
+  res_ = <INTERNAL_PREFIX>_client_send_data(<CLIENT>, <DATA>, <DATA_SIZE> , 5 * 1000, &<RET_DATA>, &<RET_DATA_SIZE>);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to send parcel. error(%d)", res_);
     goto out;
@@ -222,55 +222,55 @@ R"__c_cb(
 
 constexpr const char __SERVER_SEND_ASYNC[] =
 R"__c_cb(
-  ret_ = plugin_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+  ret_ = <INTERNAL_PREFIX>_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
   if (ret_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_create : %d", ret_);
-    plugin_payload_destroy(<PAYLOAD>);
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret_);
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
     goto out;
   }
 
-  ret_ = plugin_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
+  ret_ = <INTERNAL_PREFIX>_payload_set_data(<PAYLOAD>, (const unsigned char*)data_, <SIZE>);
   if (ret_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_set_data : %d", ret_);
-    plugin_payload_destroy(<PAYLOAD>);
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", ret_);
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
     goto out;
   }
 
-  ret_ = plugin_server_send_payload_async(<SERVER>, peer_info, <PAYLOAD>, NULL, NULL);
-  plugin_payload_destroy(<PAYLOAD>);
+  ret_ = <INTERNAL_PREFIX>_server_send_payload_async(<SERVER>, peer_info, <PAYLOAD>, NULL, NULL);
+  <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
   if (ret_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_client_send_payload_async : %d", ret_);
+    _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d", ret_);
     goto out;
   }
 )__c_cb";
 
 constexpr const char __GROUP_PUBLISH[] =
 R"__c_cb(
-  res_ = plugin_payload_create(&pl_, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+  res_ = <INTERNAL_PREFIX>_payload_create(&pl_, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_create : %d", res_);
-    plugin_payload_destroy(pl_);
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", res_);
+    <INTERNAL_PREFIX>_payload_destroy(pl_);
     goto out;
   }
 
-  res_ = plugin_payload_set_data(pl_, (const unsigned char*)data_, data_size_);
+  res_ = <INTERNAL_PREFIX>_payload_set_data(pl_, (const unsigned char*)data_, data_size_);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_payload_set_data : %d", res_);
-    plugin_payload_destroy(pl_);
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", res_);
+    <INTERNAL_PREFIX>_payload_destroy(pl_);
     goto out;
   }
 
-  res_ = plugin_group_publish(h->group, pl_);
-  plugin_payload_destroy(pl_);
+  res_ = <INTERNAL_PREFIX>_group_publish(h->group, pl_);
+  <INTERNAL_PREFIX>_payload_destroy(pl_);
   if (res_ != AITT_PLUGIN_ERROR_NONE) {
-    _E("Failed to plugin_group_publish : %d", res_);
+    _E("Failed to <INTERNAL_PREFIX>_group_publish : %d", res_);
     goto out;
   }
 )__c_cb";
 
 constexpr const char __CLIENT_CREATE[] =
 R"__c_cb(
-  ret = plugin_client_create(&handle->client, service_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+  ret = <INTERNAL_PREFIX>_client_create(&handle->client, service_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to create proxy handle. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
@@ -280,21 +280,21 @@ R"__c_cb(
   handle->callback = *callback;
   handle->user_data = user_data;
 
-  ret = plugin_client_add_connection_result_cb(handle->client, __<PREFIX>_<NAME>_connection_result, handle);
+  ret = <INTERNAL_PREFIX>_client_add_connection_result_cb(handle->client, __<PREFIX>_<NAME>_connection_result, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add connection result cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
     return ret;
   }
 
-  ret = plugin_client_add_disconnected_cb(handle->client, __<PREFIX>_<NAME>_disconnected, handle);
+  ret = <INTERNAL_PREFIX>_client_add_disconnected_cb(handle->client, __<PREFIX>_<NAME>_disconnected, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add disconnected event cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
     return ret;
   }
 
-  ret = plugin_client_add_payload_received_cb(handle->client, __<PREFIX>_<NAME>_received, handle);
+  ret = <INTERNAL_PREFIX>_client_add_payload_received_cb(handle->client, __<PREFIX>_<NAME>_received, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add received event cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
@@ -304,7 +304,7 @@ R"__c_cb(
 
 constexpr const char __GROUP_CREATE[] =
 R"__c_cb(
-  ret = plugin_group_create(&handle->group, topic_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
+  ret = <INTERNAL_PREFIX>_group_create(&handle->group, topic_name, broker_ip, broker_port, user_name, password, my_ip, protocols);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to create group handle. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
@@ -314,28 +314,28 @@ R"__c_cb(
   handle->callback = *callback;
   handle->user_data = user_data;
 
-  ret = plugin_group_add_joined_cb(handle->group, __<PREFIX>_<NAME>_joined_cb, handle);
+  ret = <INTERNAL_PREFIX>_group_add_joined_cb(handle->group, __<PREFIX>_<NAME>_joined_cb, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add connection result cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
     return ret;
   }
 
-  ret = plugin_group_add_left_cb(handle->group, __<PREFIX>_<NAME>_left_cb, handle);
+  ret = <INTERNAL_PREFIX>_group_add_left_cb(handle->group, __<PREFIX>_<NAME>_left_cb, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add disconnected event cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
     return ret;
   }
 
-  ret = plugin_group_add_payload_received_cb(handle->group, __<PREFIX>_<NAME>_received, handle);
+  ret = <INTERNAL_PREFIX>_group_add_payload_received_cb(handle->group, __<PREFIX>_<NAME>_received, handle);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to add received event cb. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
     return ret;
   }
 
-  ret = plugin_group_subscribe(handle->group);
+  ret = <INTERNAL_PREFIX>_group_subscribe(handle->group);
   if (ret != AITT_PLUGIN_ERROR_NONE) {
     _E("Failed to subscribe event. error(%d)", ret);
     <PREFIX>_<NAME>_destroy(handle);
@@ -348,28 +348,28 @@ R"__c_cb(
 constexpr const char __GROUP_DESTROY[] =
 R"__c_cb(
   if (h->group) {
-    plugin_group_unsubscribe(h->group);
-    plugin_group_destroy(h->group);
+    <INTERNAL_PREFIX>_group_unsubscribe(h->group);
+    <INTERNAL_PREFIX>_group_destroy(h->group);
   }
 )__c_cb";
 
 constexpr const char __CLIENT_DESTROY[] =
 R"__c_cb(
   if (h->client)
-    plugin_client_destroy(h->client);
+    <INTERNAL_PREFIX>_client_destroy(h->client);
 )__c_cb";
 
 constexpr const char __PEER_INFO_CLONE[] =
-    "plugin_peer_info_clone(<SRC_PEER>, <DEST_PEER>);";
+    "<INTERNAL_PREFIX>_peer_info_clone(<SRC_PEER>, <DEST_PEER>);";
 
 constexpr const char __SERVER_FOREACH_CONNECTED_PEER_INFO[] =
-    "plugin_server_foreach_connected_peer_info(__<NAME>.stub, callback, user_data);";
+    "<INTERNAL_PREFIX>_server_foreach_connected_peer_info(__<NAME>.stub, callback, user_data);";
 
 constexpr const char __SERVER_SET_ONDEMAND_LAUNCH_ENABLED[] =
 R"__c_cb(
   int ret;
 
-  ret = plugin_server_set_on_demand_launch_enabled(__<NAME>.stub, enable);
+  ret = <INTERNAL_PREFIX>_server_set_on_demand_launch_enabled(__<NAME>.stub, enable);
   if (ret != AITT_PLUGIN_ERROR_NONE)
     _E("Failed to set ondemand launch enable. error(%d)", ret);
 
@@ -669,56 +669,56 @@ constexpr const char __COMMON_BODY_PEERINFO_BASE[] =
 R"__c_cb(
 int <MODULE_PREFIX>_peer_info_clone(const <MODULE_PREFIX>_peer_info_h peer_info,
     <MODULE_PREFIX>_peer_info_h *peer_info_clone) {
-  return  plugin_peer_info_clone(peer_info, peer_info_clone);
+  return <INTERNAL_PREFIX>_peer_info_clone(peer_info, peer_info_clone);
 }
 
 int <MODULE_PREFIX>_peer_info_destroy(<MODULE_PREFIX>_peer_info_h peer_info) {
-  return plugin_peer_info_destroy(peer_info);
+  return <INTERNAL_PREFIX>_peer_info_destroy(peer_info);
 }
 
 int <MODULE_PREFIX>_peer_info_get_device_id(<MODULE_PREFIX>_peer_info_h peer_info,
     char **device_id) {
-  return plugin_peer_info_get_device_id(peer_info, device_id);
+  return <INTERNAL_PREFIX>_peer_info_get_device_id(peer_info, device_id);
 }
 
 int <MODULE_PREFIX>_peer_info_get_device_name(<MODULE_PREFIX>_peer_info_h peer_info,
     char **device_name) {
-  return plugin_peer_info_get_device_name(peer_info, device_name);
+  return <INTERNAL_PREFIX>_peer_info_get_device_name(peer_info, device_name);
 }
 
 int <MODULE_PREFIX>_peer_info_get_device_platform(<MODULE_PREFIX>_peer_info_h peer_info,
     char **device_platform) {
-  return plugin_peer_info_get_device_platform(peer_info, device_platform);
+  return <INTERNAL_PREFIX>_peer_info_get_device_platform(peer_info, device_platform);
 }
 
 int <MODULE_PREFIX>_peer_info_get_device_platform_version(<MODULE_PREFIX>_peer_info_h peer_info,
     char **device_platform_version) {
-  return plugin_peer_info_get_device_platform_version(peer_info, device_platform_version);
+  return <INTERNAL_PREFIX>_peer_info_get_device_platform_version(peer_info, device_platform_version);
 }
 
 int <MODULE_PREFIX>_peer_info_get_device_type(<MODULE_PREFIX>_peer_info_h peer_info,
     char **device_type) {
-  return plugin_peer_info_get_device_type(peer_info, device_type);
+  return <INTERNAL_PREFIX>_peer_info_get_device_type(peer_info, device_type);
 }
 
 int <MODULE_PREFIX>_peer_info_get_app_id(<MODULE_PREFIX>_peer_info_h peer_info,
     char **app_id) {
-  return plugin_peer_info_get_app_id(peer_info, app_id);
+  return <INTERNAL_PREFIX>_peer_info_get_app_id(peer_info, app_id);
 }
 
 int <MODULE_PREFIX>_peer_info_get_app_version(<MODULE_PREFIX>_peer_info_h peer_info,
     char **app_version) {
-  return plugin_peer_info_get_app_version(peer_info,  app_version);
+  return <INTERNAL_PREFIX>_peer_info_get_app_version(peer_info,  app_version);
 }
 
 int <MODULE_PREFIX>_peer_info_get_uuid(<MODULE_PREFIX>_peer_info_h peer_info,
     char **uuid) {
-  return plugin_peer_info_get_uuid(peer_info, uuid);
+  return <INTERNAL_PREFIX>_peer_info_get_uuid(peer_info, uuid);
 }
 
 int <MODULE_PREFIX>_peer_info_get_display_name(<MODULE_PREFIX>_peer_info_h peer_info,
     char **display_name) {
-  return plugin_peer_info_get_display_name(peer_info, display_name);
+  return <INTERNAL_PREFIX>_peer_info_get_display_name(peer_info, display_name);
 }
 )__c_cb";
 
@@ -729,12 +729,12 @@ constexpr const char __COMMON_BODY_CONNECTION_RESULT_BASE[] =
 R"__c_cb(
 int <MODULE_PREFIX>_connection_result_get_status(const <MODULE_PREFIX>_connection_result_h result,
     <MODULE_PREFIX>_connection_status_e *status) {
-  return plugin_connection_result_get_status(result,(plugin_connection_status_e *)status);
+  return <INTERNAL_PREFIX>_connection_result_get_status(result,(<INTERNAL_PREFIX>_connection_status_e *)status);
 }
 
 int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connection_result_h result,
     char **reason) {
-  return plugin_connection_result_get_reason(result, reason);
+  return <INTERNAL_PREFIX>_connection_result_get_reason(result, reason);
 }
 )__c_cb";
 
@@ -744,20 +744,20 @@ int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connectio
 constexpr const char __COMMON_BODY_PAYLOAD_BASE[] =
 R"__c_cb(
 int <MODULE_PREFIX>_payload_save_as_file(<MODULE_PREFIX>_payload_h payload, const char *path) {
-  return plugin_payload_save_as_file(payload, path);
+  return <INTERNAL_PREFIX>_payload_save_as_file(payload, path);
 }
 
 int <MODULE_PREFIX>_payload_get_received_file_name(<MODULE_PREFIX>_payload_h payload,
     char **file_name) {
-  return plugin_payload_get_received_file_name(payload, file_name);
+  return <INTERNAL_PREFIX>_payload_get_received_file_name(payload, file_name);
 }
 
 int <MODULE_PREFIX>_payload_get_received_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
-  return plugin_payload_get_received_bytes( payload, bytes);
+  return <INTERNAL_PREFIX>_payload_get_received_bytes( payload, bytes);
 }
 
 int <MODULE_PREFIX>_payload_get_total_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
-  return plugin_payload_get_total_bytes( payload, bytes);
+  return <INTERNAL_PREFIX>_payload_get_total_bytes( payload, bytes);
 }
 )__c_cb";
 
@@ -904,23 +904,8 @@ namespace tidl {
 std::string AittPluginCTransportable::GenInclude(bool body, int type) const {
   if (!body)
     return __INCLUDE_HEADER_DEF;
-
-  switch (type) {
-  case 1:
-  {
-    return "#include \"aitt_plugin_proxy_internal.h\"";
-  }
-  case 2:
-  {
-    return "#include \"aitt_plugin_stub_internal.h\"";
-  }
-  case 3:
-  {
-    return "#include \"aitt_plugin_group_internal.h\"";
-  }
-  default:
-    return {};
-  }
+  else
+    return "#include \"<FILENAME>_internal.h\"";
 }
 
 std::string AittPluginCTransportable::GenHeaderBase() const {
@@ -1045,7 +1030,7 @@ std::string AittPluginCTransportable::GenClientFileSend(std::string path,
 }
 
 std::string AittPluginCTransportable::GenGroupType() const {
-  return "plugin_group_h";
+  return "<INTERNAL_PREFIX>_group_h";
 }
 
 std::string AittPluginCTransportable::GenPayloadTransferStatusType(bool internal_type) const {
@@ -1066,13 +1051,13 @@ std::string AittPluginCTransportable::GenPeerInfoDestroy(std::string peer) const
 
 std::string AittPluginCTransportable::GenPayloadType(bool internal_type) const {
   if (internal_type)
-  return "plugin_payload_h";
+  return "<INTERNAL_PREFIX>_payload_h";
   else
   return "<MODULE_PREFIX>_payload_h";
 }
 
 std::string AittPluginCTransportable::GenClientType() const {
-  return "plugin_client_h";
+  return "<INTERNAL_PREFIX>_client_h";
 }
 
 std::string AittPluginCTransportable::GenSecurityType(bool definition) const {
@@ -1080,7 +1065,7 @@ std::string AittPluginCTransportable::GenSecurityType(bool definition) const {
 }
 
 std::string AittPluginCTransportable::GenServerType() const {
-  return "plugin_server_h";
+  return "<INTERNAL_PREFIX>_server_h";
 }
 
 std::string AittPluginCTransportable::GenClientTryConnect(std::string client,
@@ -1149,7 +1134,7 @@ std::string AittPluginCTransportable::GenGroupPublish() const {
 }
 
 std::string AittPluginCTransportable::GenPayloadTypeEnum() const {
-  return "plugin_payload_type_e";
+  return "<INTERNAL_PREFIX>_payload_type_e";
 }
 
 std::string AittPluginCTransportable::GenPayloadTypeData() const {
@@ -1161,7 +1146,7 @@ std::string AittPluginCTransportable::GenPayloadTypeFile() const {
 }
 
 std::string AittPluginCTransportable::GenPayloadGetType() const {
-  return "ret = plugin_payload_get_type(payload, &type);";
+  return "ret = <INTERNAL_PREFIX>_payload_get_type(payload, &type);";
 }
 
 std::string AittPluginCTransportable::GenErrorNone() const {
@@ -1169,7 +1154,7 @@ std::string AittPluginCTransportable::GenErrorNone() const {
 }
 
 std::string AittPluginCTransportable::GenPayloadGetData() const {
-  return "ret = plugin_payload_get_data(payload, &data, &data_len);";
+  return "ret = <INTERNAL_PREFIX>_payload_get_data(payload, &data, &data_len);";
 }
 
 std::string AittPluginCTransportable::GenClientCreate() const {
diff --git a/idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.cc b/idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.cc
new file mode 100644 (file)
index 0000000..80753d3
--- /dev/null
@@ -0,0 +1,1189 @@
+/*
+ * 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_aitt_plugin/aitt_plugin_cpp_transportable.h"
+
+#include <utility>
+
+#include "idlc/gen/replace_all.h"
+
+namespace {
+
+constexpr const char __CLINET_FILE_SEND[] =
+R"__cpp_cb(<PAYLOAD_T> pl;
+  int ret = <INTERNAL_PREFIX>_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret);
+    return;
+  }
+
+  ret = <INTERNAL_PREFIX>_payload_set_file_path(pl, <FILE_PATH>.c_str());
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_file_path : %d - %s", ret, <FILE_PATH>.c_str());
+    <INTERNAL_PREFIX>_payload_destroy(pl);
+    return;
+  }
+
+  ret = <INTERNAL_PREFIX>_client_send_payload_async(<CLIENT_H>, pl, nullptr, nullptr);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d", ret);
+    <INTERNAL_PREFIX>_payload_destroy(pl);
+    return;
+  }
+
+  <INTERNAL_PREFIX>_payload_destroy(pl);
+)__cpp_cb";
+
+constexpr const char __SERVER_FILE_SEND[] =
+R"__cpp_cb(<PAYLOAD_T> pl;
+  int ret = <INTERNAL_PREFIX>_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_FILE);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret);
+    return;
+  }
+
+  ret = <INTERNAL_PREFIX>_payload_set_file_path(pl, <FILE_PATH>.c_str());
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_file_path : %d - %s", ret, <FILE_PATH>.c_str());
+    <INTERNAL_PREFIX>_payload_destroy(pl);
+    return;
+  }
+
+  ret = <INTERNAL_PREFIX>_server_send_payload_async(<SERVER_H>, <PEER_H>, pl, nullptr, nullptr);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_send_payload_async : %d", ret);
+    <INTERNAL_PREFIX>_payload_destroy(pl);
+    return;
+  }
+
+  <INTERNAL_PREFIX>_payload_destroy(pl);
+)__cpp_cb";
+
+constexpr const char __SERVER_REGISTER[] =
+R"__cpp_cb(<SERVER_T> server;
+  int ret = <INTERNAL_PREFIX>_server_create(&server, service_name.c_str(),
+      display_name.c_str(), broker_ip.c_str(), broker_port, user_name.c_str(), password.c_str(), my_ip.c_str(), protocols);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to create handle. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_server_add_connection_result_cb(server, OnConnectionResultCB,
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_add_connection_result_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_server_add_payload_received_cb(server,
+      [](const char *service_name, const <INTERNAL_PREFIX>_peer_info_h peer_info,
+        const <INTERNAL_PREFIX>_payload_h payload, transfer_status_e status, void *user_data) {
+            ## *sr = static_cast<##*>(user_data);
+            sr->OnPayloadReceivedCB(service_name, peer_info, payload,
+                static_cast<<MODULE_PREFIX>_payload_transfer_status_e>(status), user_data);
+          },
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_add_payload_received_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_server_set_data_received_cb(server, OnDataReceivedCB, this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_set_data_received_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_server_add_disconnected_cb(server, OnDisconnectedCB, this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_add_disconnected_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  server_ = server;
+)__cpp_cb";
+
+
+
+constexpr const char __SERVER_UNREGISTER[] =
+R"__cpp_cb(
+  if (server_ != nullptr)
+    <INTERNAL_PREFIX>_server_destroy(server_);
+)__cpp_cb";
+
+constexpr const char __SERVER_ACCEPT[] =
+R"__cpp_cb(auto p = service->GetPeer();
+  int ret = <INTERNAL_PREFIX>_server_accept(server_, p);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_accept. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  service->OnCreate();
+  services_.emplace_back(std::move(service));
+)__cpp_cb";
+
+constexpr const char __SERVER_REJECT[] =
+R"__cpp_cb(auto p = service->GetPeer();
+  int ret = <INTERNAL_PREFIX>_server_reject(server_, p, reason.c_str());
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_reject. error(%d)", ret);
+    throw InvalidIOException();
+  }
+)__cpp_cb";
+
+constexpr const char __SERVER_SET_DISPLAY_NAME[] =
+R"__cpp_cb(int ret = <INTERNAL_PREFIX>_server_set_display_name(server_, display_name.c_str());
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_set_display_name. error(%d)", ret);
+    InvalidIOException();
+  }
+)__cpp_cb";
+
+constexpr const char __CLIENT_TRY_CONNECT[] =
+R"__cpp_cb(int ret = <INTERNAL_PREFIX>_client_connect(<CLIENT>, <PEER>);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to connect to stub. error(%d)", ret);
+      switch(ret) {
+      case AITT_PLUGIN_ERROR_PERMISSION_DENIED :
+        throw UnauthorizedAccessException();
+        break;
+      case AITT_PLUGIN_ERROR_INVALID_PARAMETER :
+        throw NotConnectedSocketException();
+        break;
+      default :
+        throw InvalidIOException();
+      }
+    }
+)__cpp_cb";
+
+constexpr const char __CLIENT_DISCONNECT[] =
+R"__cpp_cb(int ret = <INTERNAL_PREFIX>_client_disconnect(<CLIENT>);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to disconnect to stub. error(%d)", ret);
+    throw NotConnectedSocketException();
+  }
+)__cpp_cb";
+
+constexpr const char __CLIENT_TRY_DISCOVERY[] =
+R"__cpp_cb(int ret = <INTERNAL_PREFIX>_client_try_discovery(<CLIENT>, OnDiscoveredCB, this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to discovery to stub. error(%d)", ret);
+    switch(ret) {
+      case AITT_PLUGIN_ERROR_PERMISSION_DENIED :
+        throw UnauthorizedAccessException();
+        break;
+      default :
+        throw InvalidIOException();
+    }
+  }
+)__cpp_cb";
+
+constexpr const char __CLIENT_STOP_DISCOVERY[] =
+R"__cpp_cb(int ret = <INTERNAL_PREFIX>_client_stop_discovery(<CLIENT>);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to stop discovery. error(%d)", ret);
+    return;
+  }
+)__cpp_cb";
+
+constexpr const char __CLIENT_SEND_ASYNC[] =
+R"__cpp_cb(
+    ret = <INTERNAL_PREFIX>_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret);
+      rpc_port_parcel_destroy(p);
+      throw InvalidIOException();
+    }
+
+    ret = <INTERNAL_PREFIX>_payload_set_data(<PAYLOAD>, (const unsigned char*)data, <SIZE>);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", ret);
+      rpc_port_parcel_destroy(p);
+      <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
+      throw InvalidIOException();
+    }
+
+    ret = <INTERNAL_PREFIX>_client_send_payload_async(<CLIENT>, <PAYLOAD>, nullptr, nullptr);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d", ret);
+      rpc_port_parcel_destroy(p);
+      <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
+      throw InvalidIOException();
+    }
+
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
+)__cpp_cb";
+
+constexpr const char __CLIENT_SEND[] =
+R"__cpp_cb(
+    ret = <INTERNAL_PREFIX>_client_send_data(<CLIENT>, (unsigned char *)<DATA>, <DATA_SIZE>,
+        100, &<RET_DATA>, &<RET_DATA_SIZE>);
+    if (ret != RPC_PORT_ERROR_NONE) {
+        _E("Failed to <INTERNAL_PREFIX>_client_send_data : error(%d)", ret);
+        rpc_port_parcel_destroy(p);
+        throw InvalidIOException();
+    }
+)__cpp_cb";
+
+constexpr const char __SERVER_SEND_ASYNC[] =
+R"__cpp_cb(ret_ = <INTERNAL_PREFIX>_payload_create(&<PAYLOAD>, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+  if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret_);
+    rpc_port_parcel_destroy(p);
+    return;
+  }
+
+  ret_ = <INTERNAL_PREFIX>_payload_set_data(<PAYLOAD>, (const unsigned char*)data, <SIZE>);
+  if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", ret_);
+    rpc_port_parcel_destroy(p);
+    <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
+    return;
+  }
+
+  ret_ = <INTERNAL_PREFIX>_server_send_payload_async(<SERVER>, service_.lock()->GetPeer(), <PAYLOAD>, nullptr, nullptr);
+  <INTERNAL_PREFIX>_payload_destroy(<PAYLOAD>);
+  if (ret_ != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_client_send_payload_async : %d", ret_);
+    rpc_port_parcel_destroy(p);
+    return;
+  }
+)__cpp_cb";
+
+constexpr const char __GROUP_HANDLES[] =
+R"__c_cb(
+  /**
+  * @brief The aitt group handle.
+  */
+typedef void *<MODULE_PREFIX>_group_h;
+
+)__c_cb";
+
+constexpr const char __GROUP_PUBLISH[] =
+R"__c_cb(ret = <INTERNAL_PREFIX>_payload_create(&pl, AITT_PLUGIN_PAYLOAD_TYPE_DATA);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_payload_create : %d", ret);
+      rpc_port_parcel_destroy(p);
+      throw InvalidIOException();
+    }
+
+    ret = <INTERNAL_PREFIX>_payload_set_data(pl, (const unsigned char*)data, size);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_payload_set_data : %d", ret);
+      rpc_port_parcel_destroy(p);
+      <INTERNAL_PREFIX>_payload_destroy(pl);
+      throw InvalidIOException();
+    }
+
+    ret = <INTERNAL_PREFIX>_group_publish(group_, pl);
+    <INTERNAL_PREFIX>_payload_destroy(pl);
+    if (ret != AITT_PLUGIN_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_group_publish : %d", ret);
+      rpc_port_parcel_destroy(p);
+      throw InvalidIOException();
+    }
+)__c_cb";
+
+constexpr const char __CLIENT_CREATE[] =
+R"__c_cb(<CLIENT_T> client = nullptr;
+  int ret = <INTERNAL_PREFIX>_client_create(&client, service_name.c_str(),
+      broker_ip.c_str(), broker_port, user_name.c_str(), password.c_str(), my_ip.c_str(), protocols);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to create handle. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_client_add_disconnected_cb(client, OnDisconnectedCB,
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_client_add_disconnected_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_client_add_connection_result_cb(client, OnConnectionResultCB,
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_client_add_connection_result_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_client_add_payload_received_cb(client,
+      [](const char *service_name, const <INTERNAL_PREFIX>_peer_info_h peer_info,
+        const <INTERNAL_PREFIX>_payload_h payload, transfer_status_e status, void *user_data) {
+            $$ *sr = static_cast<$$*>(user_data);
+            sr->OnPayloadReceivedCB(service_name, peer_info, payload,
+                static_cast<<MODULE_PREFIX>_payload_transfer_status_e>(status), user_data);
+          }, this);
+
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_client_add_payload_received_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  client_ = client;
+)__c_cb";
+
+constexpr const char __GROUP_CREATE[] =
+R"__c_cb(<GROUP_T> group = nullptr;
+  int ret = <INTERNAL_PREFIX>_group_create(&group, topic_name_.c_str(),
+      broker_ip.c_str(), broker_port, user_name.c_str(), password.c_str(), my_ip.c_str(), protocols);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to create handle. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_group_add_joined_cb(group,
+      [](const char *topic_name, const <PEER_INFO_T> peer_info,
+          void *user_data) {
+            <CLS_NAME> *gr = static_cast<<CLS_NAME>*>(user_data);
+            gr->OnJoined(peer_info);
+          },
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_group_add_joined_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_group_add_left_cb(group,
+      [](const char *topic_name, const <PEER_INFO_T> peer_info,
+          void *user_data) {
+            <CLS_NAME> *gr = static_cast<<CLS_NAME>*>(user_data);
+            gr->OnLeft(peer_info);
+          },
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_group_add_left_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_group_add_payload_received_cb(group,
+      [](const char *topic_name, const <PEER_INFO_T> peer_info,
+          const <PAYLOAD_T> payload, void *user_data) {
+            <CLS_NAME> *gr = static_cast<<CLS_NAME>*>(user_data);
+            gr->OnPayloadReceivedCB(peer_info, payload);
+          },
+      this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_group_add_payload_received_cb. error(%d)", ret);
+    throw InvalidIOException();
+  }
+
+  ret = <INTERNAL_PREFIX>_group_subscribe(group);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to subscribe. error(%d)", ret);
+    switch (ret) {
+    case AITT_PLUGIN_ERROR_PERMISSION_DENIED :
+      throw UnauthorizedAccessException();
+      break;
+    case AITT_PLUGIN_ERROR_INVALID_PARAMETER :
+      throw NotConnectedSocketException();
+      break;
+    default :
+      throw InvalidIOException();
+    }
+  }
+
+  group_ = group;
+)__c_cb";
+
+constexpr const char __GROUP_DESTROY[] =
+R"__c_cb(if (group_ != nullptr) {
+    <INTERNAL_PREFIX>_group_unsubscribe(group_);
+    <INTERNAL_PREFIX>_group_destroy(group_);
+  }
+)__c_cb";
+
+constexpr const char __CLIENT_DESTROY[] =
+R"__c_cb(
+  if (client_ != nullptr)
+    <INTERNAL_PREFIX>_client_destroy(client_);
+)__c_cb";
+
+const char __PEER_INFO_CLONE[] =
+  "<INTERNAL_PREFIX>_peer_info_clone(<SRC_PEER>, <DEST_PEER>);";
+
+constexpr const char __SERVER_SET_ONDEMAND_LAUNCH_ENABLED[] =
+R"__c_cb(int ret = <INTERNAL_PREFIX>_server_set_on_demand_launch_enabled(server_, enabled);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_set_on_demand_launch_enabled. error(%d)", ret);
+    switch(ret) {
+      case AITT_PLUGIN_ERROR_PERMISSION_DENIED :
+        throw UnauthorizedAccessException();
+        break;
+      default :
+        throw InvalidIOException();
+    }
+  }
+)__c_cb";
+
+constexpr const char __SERVER_LISTEN[] =
+R"__c_cb(int ret = <INTERNAL_PREFIX>_server_listen(server_, OnConnectionRequestCB, this);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_listen. error(%d)", ret);
+    switch(ret) {
+      case AITT_PLUGIN_ERROR_PERMISSION_DENIED :
+        throw UnauthorizedAccessException();
+        break;
+      default :
+        throw InvalidIOException();
+    }
+  }
+)__c_cb";
+
+constexpr const char __SERVER_DISCONNECT[] =
+R"__c_cb(int ret = <INTERNAL_PREFIX>_server_disconnect(<SERVER>, <PEER>);
+  if (ret != AITT_PLUGIN_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_server_disconnect. error(%d)", ret);
+    throw InvalidIOException();
+  }
+)__c_cb";
+
+constexpr const char __PEER_INFO_GET_APPID[] =
+    "<INTERNAL_PREFIX>_peer_info_get_app_id(<PEER>, <APPID>);";
+
+constexpr const char __PEER_INFO_GET_UUID[] =
+    "<INTERNAL_PREFIX>_peer_info_get_uuid(<PEER>, <UUID>);";
+
+}  // namespace
+
+constexpr const char __COMMON_HEADER_PAYLOAD_HANDLE[] =
+R"__c_cb(
+/**
+ * @brief Enumeration for <MODULE_PREFIX>_payload transfer status types.
+ */
+typedef enum _payload_transfer_status_e {
+  AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_SUCCESS, /**< Transfer is success **/
+  AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_FAILURE, /**< Transfer is failed **/
+  AITT_PLUGIN_PAYLOAD_TRANSFER_STATUS_IN_PROGRESS, /**< Transfer is in progress **/
+} <MODULE_PREFIX>_payload_transfer_status_e;
+
+/**
+  * @brief The <MODULE_PREFIX>_payload handle.
+  */
+ typedef void *<MODULE_PREFIX>_payload_h;
+ typedef void *<MODULE_PREFIX>_payload_async_result_h;
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_HANDLES[] =
+R"__c_cb(
+
+typedef enum _<MODULE_PREFIX>_error {
+  AITT_PLUGIN_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */
+  AITT_PLUGIN_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+  AITT_PLUGIN_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+  AITT_PLUGIN_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+  AITT_PLUGIN_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+  AITT_PLUGIN_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented */
+  AITT_PLUGIN_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Already in progress */
+  AITT_PLUGIN_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+  AITT_PLUGIN_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timed out */
+  AITT_PLUGIN_ERROR_OPERATION_FAILED = TIZEN_ERROR_CION | 0x01, /**< Operation failed */
+} <MODULE_PREFIX>_error_e;
+
+enum AittProtocol {
+  AITT_TYPE_MQTT = (0x1 << 0),   // Publish message through the MQTT
+  AITT_TYPE_TCP = (0x1 << 1),   // Publish message to peers using the TCP
+  AITT_TYPE_UDP = (0x1 << 2),   // Publish message to peers using the UDP
+  AITT_TYPE_SRTP = (0x1 << 3),   // Publish message to peers using the SRTP
+  AITT_TYPE_WEBRTC = (0x1 << 4),  // Publish message to peers using the WEBRTC
+};
+
+/**
+  * @brief The aitt plugin peer info handle.
+  */
+typedef void *<MODULE_PREFIX>_peer_info_h;
+
+)__c_cb";
+
+constexpr const char __CLIENT_HEADER_HANDLES[] =
+R"__c_cb(
+  /**
+  * @brief The aitt client handle.
+  */
+typedef void *<MODULE_PREFIX>_client_h;
+
+)__c_cb";
+
+constexpr const char __CLIENT_SERVER_HANDLES[] =
+R"__c_cb(
+  /**
+  * @brief The aitt server handle.
+  */
+typedef void *<MODULE_PREFIX>_server_h;
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_CONNECTION_RESULT_HANDLE[] =
+R"__c_cb(
+typedef enum _aitt_connection_status_e {
+  AITT_PLUGIN_CONNECTION_STATUS_OK, /**< Connection is ok **/
+  AITT_PLUGIN_CONNECTION_STATUS_REJECTED, /**< Connection is rejected **/
+  AITT_PLUGIN_CONNECTION_STATUS_ERROR, /**< Connection error occurs **/
+} <MODULE_PREFIX>_connection_status_e;
+
+/**
+ * @brief The Aitt plugin connection result handle.
+ */
+typedef void *<MODULE_PREFIX>_connection_result_h;
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_COMMON_BASE[] =
+R"__c_cb(
+/**
+  * @brief Creates a clone of aitt plugin peer info handle.
+  * @remarks @a peer_info_clone must be released using <MODULE_PREFIX>_peer_info_destroy().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] peer_info_clone The cloned peer information handle
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  * @retval #AITT_PLUGIN_ERROR_IO_ERROR IO error
+  * @see <MODULE_PREFIX>_peer_info_destroy()
+  */
+int <MODULE_PREFIX>_peer_info_clone(const <MODULE_PREFIX>_peer_info_h peer_info,
+    <MODULE_PREFIX>_peer_info_h *peer_info_clone);
+
+/**
+  * @brief Destroys the peer info handle and releases all its resources.
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @see <MODULE_PREFIX>_peer_info_clone()
+  */
+int <MODULE_PREFIX>_peer_info_destroy(<MODULE_PREFIX>_peer_info_h peer_info);
+
+/**
+  * @brief Gets the device ID.
+  * @remarks @a device_id must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] device_id The device ID
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_device_id(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_id);
+
+/**
+  * @brief Gets the device name.
+  * @remarks @a device_name must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] device_name The device name
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_device_name(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_name);
+
+/**
+  * @brief Gets the device's platform.
+  * @remarks @a device_platform must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] device_platform The platform name
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_device_platform(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_platform);
+
+/**
+  * @brief Gets the device's platform version.
+  * @remarks @a device_platform_version must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] device_platform_version The platform version
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_device_platform_version(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_platform_version);
+
+/**
+  * @brief Gets the device's type.
+  * @remarks @a device_type must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] device_type Device type
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_device_type(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_type);
+
+/**
+  * @brief Gets application ID of peer.
+  * @remarks @a app_id must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] app_id The application ID
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_app_id(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **app_id);
+
+/**
+  * @brief Gets application version of peer.
+  * @remarks @a app_version must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] app_version The application version
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_app_version(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **app_version);
+
+/**
+  * @brief Gets UUID of peer.
+  * @remarks @a uuid must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] uuid The UUID
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_uuid(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **uuid);
+
+/**
+  * @brief Gets display name of peer.
+  * @details The custom name for service name. \n
+  *          It is possible that @a display_name does not exist.
+  * @remarks @a display_name must be released using free().
+  * @param[in] peer_info The aitt plugin peer information handle
+  * @param[out] display_name The display name
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+int <MODULE_PREFIX>_peer_info_get_display_name(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **display_name);
+
+)__c_cb";
+
+
+constexpr const char __COMMON_HEADER_PAYLOAD_BASE[] =
+R"__c_cb(
+/**
+  * @brief Saves the payload as a file.
+  * @remarks The @a path is absolute path.
+  * @remarks If the media storage is used, %http://tizen.org/privilege/mediastorage privilege is necessary. \n
+  *          If the external storage is used, %http://tizen.org/privilege/externalstorage privilege is necessary.
+  * @param[in] payload The <MODULE_PREFIX>_payload handle
+  * @param[in] path The path of file
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_PERMISSION_DENIED Permission denied
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OPERATION_FAILED Operation failed
+  */
+int <MODULE_PREFIX>_payload_save_as_file(<MODULE_PREFIX>_payload_h payload, const char *path);
+
+/**
+  * @brief Gets the name of received file from the payload.
+  * @remarks @a file_name must be released using free().
+  * @param[in] payload The <MODULE_PREFIX>_payload handle
+  * @param[out] file_name The name of file
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+  */
+
+int <MODULE_PREFIX>_payload_get_received_file_name(<MODULE_PREFIX>_payload_h payload,
+    char **file_name);
+
+/**
+  * @brief Gets the size of currently received file from the payload.
+  * @param[in] payload The <MODULE_PREFIX>_payload handle
+  * @param[out] bytes The size of file
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  */
+int <MODULE_PREFIX>_payload_get_received_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes);
+
+/**
+  * @brief Gets the total size of file from the payload.
+  * @param[in] payload The <MODULE_PREFIX>_payload handle
+  * @param[out] bytes The size of file
+  * @return @c 0 on success, otherwise a negative error value
+  * @retval #AITT_PLUGIN_ERROR_NONE Successful
+  * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+  */
+int <MODULE_PREFIX>_payload_get_total_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes);
+
+)__c_cb";
+
+constexpr const char __COMMON_HEADER_CONNECTION_RESULT_BASE[] =
+R"__c_cb(
+/**
+ * @brief Gets the connection result status.
+ * @param[in] result The connection result handle
+ * @param[out] status Connection result status
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int <MODULE_PREFIX>_connection_result_get_status(const <MODULE_PREFIX>_connection_result_h result,
+         <MODULE_PREFIX>_connection_status_e *status);
+
+/**
+ * @brief Gets the connection result reason.
+ * @remarks @a reason must be released using free().
+ * @param[in] result The connection result handle
+ * @param[out] reason Connection result reason, should be freed after use
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #AITT_PLUGIN_ERROR_NONE Successful
+ * @retval #AITT_PLUGIN_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #AITT_PLUGIN_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connection_result_h result,
+        char **reason);
+
+)__c_cb";
+
+constexpr const char __COMMON_BODY_PAYLOAD_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_payload_save_as_file(<MODULE_PREFIX>_payload_h payload, const char *path) {
+  return <INTERNAL_PREFIX>_payload_save_as_file(payload, path);
+}
+
+int <MODULE_PREFIX>_payload_get_received_file_name(<MODULE_PREFIX>_payload_h payload,
+    char **file_name) {
+  return <INTERNAL_PREFIX>_payload_get_received_file_name(payload, file_name);
+}
+
+int <MODULE_PREFIX>_payload_get_received_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
+  return <INTERNAL_PREFIX>_payload_get_received_bytes(payload, bytes);
+}
+
+int <MODULE_PREFIX>_payload_get_total_bytes(<MODULE_PREFIX>_payload_h payload, uint64_t *bytes) {
+  return <INTERNAL_PREFIX>_payload_get_total_bytes(payload, bytes);
+}
+
+)__c_cb";
+
+constexpr const char __COMMON_BODY_CONNECTION_RESULT_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_connection_result_get_status(const <MODULE_PREFIX>_connection_result_h result,
+    <MODULE_PREFIX>_connection_status_e *status) {
+  return <INTERNAL_PREFIX>_connection_result_get_status(result,(<INTERNAL_PREFIX>_connection_status_e *)status);
+}
+
+int <MODULE_PREFIX>_connection_result_get_reason(const <MODULE_PREFIX>_connection_result_h result,
+    char **reason) {
+  return <INTERNAL_PREFIX>_connection_result_get_reason(result, reason);
+}
+
+)__c_cb";
+
+constexpr const char __COMMON_BODY_PEERINFO_BASE[] =
+R"__c_cb(
+int <MODULE_PREFIX>_peer_info_clone(const <MODULE_PREFIX>_peer_info_h peer_info,
+    <MODULE_PREFIX>_peer_info_h *peer_info_clone) {
+  return  <INTERNAL_PREFIX>_peer_info_clone(peer_info, peer_info_clone);
+}
+
+int <MODULE_PREFIX>_peer_info_destroy(<MODULE_PREFIX>_peer_info_h peer_info) {
+  return <INTERNAL_PREFIX>_peer_info_destroy(peer_info);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_id(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_id) {
+  return <INTERNAL_PREFIX>_peer_info_get_device_id(peer_info, device_id);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_name(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_name) {
+  return <INTERNAL_PREFIX>_peer_info_get_device_name(peer_info, device_name);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_platform(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_platform) {
+  return <INTERNAL_PREFIX>_peer_info_get_device_platform(peer_info, device_platform);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_platform_version(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_platform_version) {
+  return <INTERNAL_PREFIX>_peer_info_get_device_platform_version(peer_info, device_platform_version);
+}
+
+int <MODULE_PREFIX>_peer_info_get_device_type(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **device_type) {
+  return <INTERNAL_PREFIX>_peer_info_get_device_type(peer_info, device_type);
+}
+
+int <MODULE_PREFIX>_peer_info_get_app_id(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **app_id) {
+  return <INTERNAL_PREFIX>_peer_info_get_app_id(peer_info, app_id);
+}
+
+int <MODULE_PREFIX>_peer_info_get_app_version(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **app_version) {
+  return <INTERNAL_PREFIX>_peer_info_get_app_version(peer_info,  app_version);
+}
+
+int <MODULE_PREFIX>_peer_info_get_uuid(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **uuid) {
+  return <INTERNAL_PREFIX>_peer_info_get_uuid(peer_info, uuid);
+}
+
+int <MODULE_PREFIX>_peer_info_get_display_name(<MODULE_PREFIX>_peer_info_h peer_info,
+    char **display_name) {
+  return <INTERNAL_PREFIX>_peer_info_get_display_name(peer_info, display_name);
+}
+
+)__c_cb";
+
+namespace tidl {
+
+std::string AittPluginCppTransportable::GenInclude(int type) const {
+    return "#include \"<FILENAME>_internal.h\"";
+}
+
+std::string AittPluginCppTransportable::GenHeaderBase() const {
+  return __COMMON_HEADER_COMMON_BASE;
+}
+
+std::string AittPluginCppTransportable::GenHeaderPayloadHandle() const {
+  return __COMMON_HEADER_PAYLOAD_HANDLE;
+}
+
+std::string AittPluginCppTransportable::GenHeaderCommonHandle() const {
+  return __COMMON_HEADER_HANDLES;
+}
+
+std::string AittPluginCppTransportable::GenHeaderClientHandle() const {
+  return __CLIENT_HEADER_HANDLES;
+}
+
+std::string AittPluginCppTransportable::GenHeaderServerHandle() const {
+  return __CLIENT_SERVER_HANDLES;
+}
+std::string AittPluginCppTransportable::GenHeaderGroupHandle() const {
+  return __GROUP_HANDLES;
+}
+
+std::string AittPluginCppTransportable::GenHeaderConnectionHandle() const {
+  return __COMMON_HEADER_CONNECTION_RESULT_HANDLE;
+}
+
+std::string AittPluginCppTransportable::GenHeaderPayloadBase() const {
+  return __COMMON_HEADER_PAYLOAD_BASE;
+}
+
+std::string AittPluginCppTransportable::GenHeaderConnectionBase() const {
+  return __COMMON_HEADER_CONNECTION_RESULT_BASE;
+}
+
+std::string AittPluginCppTransportable::GenBodyPayloadBase() const {
+  return __COMMON_BODY_PAYLOAD_BASE;
+}
+
+std::string AittPluginCppTransportable::GenBodyConnectionBase() const {
+  return __COMMON_BODY_CONNECTION_RESULT_BASE;
+}
+
+std::string AittPluginCppTransportable::GenBodyPeerInfoBase() const {
+  return __COMMON_BODY_PEERINFO_BASE;
+}
+
+std::string AittPluginCppTransportable::GenNamespace() const {
+  return "aitt";
+}
+
+std::string AittPluginCppTransportable::GenProxyPrefix() const {
+  return "aitt_plugin_proxy";
+}
+
+std::string AittPluginCppTransportable::GenStubPrefix() const {
+  return "aitt_plugin_stub";
+}
+
+std::string AittPluginCppTransportable::GenGroupPrefix() const {
+  return "aitt_plugin_group";
+}
+
+std::string AittPluginCppTransportable::GenModulePrefix() const {
+  return "aitt_plugin";
+}
+
+std::string AittPluginCppTransportable::GenErrorPrefix() const {
+  return "AITT_PLUGIN";
+}
+
+std::string AittPluginCppTransportable::GenConnectionResultPrefix() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenClientSendAsync(std::string client,
+    std::string payload, std::string size) const {
+  return std::string(ReplaceAll(__CLIENT_SEND_ASYNC, {
+      { "<CLIENT>", client },
+      { "<PAYLOAD>", payload},
+      { "<SIZE>", size} }));
+}
+
+std::string AittPluginCppTransportable::GenClientSend(std::string client,
+    std::string data, std::string data_size,
+    std::string ret_data, std::string ret_data_size) const {
+  return std::string(ReplaceAll(__CLIENT_SEND, {
+      { "<CLIENT>", client },
+      { "<DATA>", data},
+      { "<DATA_SIZE>", data_size},
+      { "<RET_DATA>", ret_data},
+      { "<RET_DATA_SIZE>", ret_data_size} }));
+}
+
+std::string AittPluginCppTransportable::GenServerSendAsync(std::string server,
+    std::string client,
+    std::string payload, std::string size) const {
+  return std::string(ReplaceAll(__SERVER_SEND_ASYNC, {
+      { "<SERVER>", server },
+      { "<CLIENT>", client},
+      { "<PAYLOAD>", payload},
+      { "<SIZE>", size} }));
+}
+
+std::string AittPluginCppTransportable::GenServerFileSend(std::string path,
+    std::string server, std::string peer) const {
+  return std::string(ReplaceAll(__SERVER_FILE_SEND, {
+      { "<FILE_PATH>", path },
+      { "<SERVER_H>", server },
+      { "<PEER_H>", peer } }));
+}
+
+std::string AittPluginCppTransportable::GenClientFileSend(std::string path,
+    std::string client) const {
+  return std::string(ReplaceAll(__CLINET_FILE_SEND, {
+      { "<FILE_PATH>", path },
+      { "<CLIENT_H>", client } }));
+}
+
+std::string AittPluginCppTransportable::GenGroupType() const {
+  return "<MODULE_PREFIX>_group_h";
+}
+
+std::string AittPluginCppTransportable::GenPayloadTransferStatusType(bool internal_type) const {
+  if (internal_type)
+    return "transfer_status_e";
+  else
+    return "<MODULE_PREFIX>_payload_transfer_status_e";
+}
+
+std::string AittPluginCppTransportable::GenPayloadAsyncResultType() const {
+  return "<MODULE_PREFIX>_payload_async_result_h";
+}
+
+std::string AittPluginCppTransportable::GenPeerInfoType() const {
+  return "<MODULE_PREFIX>_peer_info_h";
+}
+
+std::string AittPluginCppTransportable::GenPeerInfoDestroy(
+    std::string peer) const {
+  return std::string(ReplaceAll("<MODULE_PREFIX>_peer_info_destroy(<PEER>);", {
+      { "<PEER>", peer } }));
+}
+
+std::string AittPluginCppTransportable::GenPayloadType() const {
+  return "<MODULE_PREFIX>_payload_h";
+}
+
+std::string AittPluginCppTransportable::GenClientType() const {
+  return "<MODULE_PREFIX>_client_h";
+}
+
+std::string AittPluginCppTransportable::GenSecurityType(bool definition) const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenServerType() const {
+  return "<MODULE_PREFIX>_server_h";
+}
+
+std::string AittPluginCppTransportable::GenClientTryConnect(std::string client,
+    std::string peer) const {
+  return std::string(ReplaceAll(__CLIENT_TRY_CONNECT, {
+      { "<CLIENT>", client },
+      { "<PEER>", peer } }));
+}
+
+std::string AittPluginCppTransportable::GenClientDisconnect(
+    std::string client) const {
+  return std::string(ReplaceAll(__CLIENT_DISCONNECT, {
+      { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCppTransportable::GenClientTryDiscovery(
+    std::string client) const {
+  return std::string(ReplaceAll(__CLIENT_TRY_DISCOVERY, {
+      { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCppTransportable::GenClientStopDiscovery(
+    std::string client) const {
+  return std::string(ReplaceAll(__CLIENT_STOP_DISCOVERY, {
+      { "<CLIENT>", client } }));
+}
+
+std::string AittPluginCppTransportable::GenServerRegister() const {
+  return __SERVER_REGISTER;
+}
+
+std::string AittPluginCppTransportable::GenServerUnregister() const {
+  return __SERVER_UNREGISTER;
+}
+
+std::string AittPluginCppTransportable::GenClientExtraHeader() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenClientExtraBody() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenServerExtraHeader() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenServerExtraBody() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenServerAccept() const {
+  return __SERVER_ACCEPT;
+}
+
+std::string AittPluginCppTransportable::GenServerReject() const {
+  return __SERVER_REJECT;
+}
+
+std::string AittPluginCppTransportable::GenServerSetDisplayName() const {
+  return __SERVER_SET_DISPLAY_NAME;
+}
+
+std::string AittPluginCppTransportable::GenGroupPublish() const {
+  return __GROUP_PUBLISH;
+}
+
+std::string AittPluginCppTransportable::GenPayloadTypeEnum() const {
+  return "<INTERNAL_PREFIX>_payload_type_e";
+}
+
+std::string AittPluginCppTransportable::GenPayloadTypeData() const {
+  return "AITT_PLUGIN_PAYLOAD_TYPE_DATA";
+}
+
+std::string AittPluginCppTransportable::GenPayloadTypeFile() const {
+  return "AITT_PLUGIN_PAYLOAD_TYPE_FILE";
+}
+
+std::string AittPluginCppTransportable::GenPayloadGetType() const {
+  return "ret = <INTERNAL_PREFIX>_payload_get_type(payload, &type);";
+}
+
+std::string AittPluginCppTransportable::GenErrorNone() const {
+  return "AITT_PLUGIN_ERROR_NONE";
+}
+
+std::string AittPluginCppTransportable::GenPayloadGetData() const {
+  return "ret = <INTERNAL_PREFIX>_payload_get_data(payload, &data, &size);";
+}
+
+std::string AittPluginCppTransportable::GenClientCreate() const {
+  return __CLIENT_CREATE;
+}
+
+std::string AittPluginCppTransportable::GenGroupCreate() const {
+  return __GROUP_CREATE;
+}
+
+std::string AittPluginCppTransportable::GenGroupDestroy() const {
+  return __GROUP_DESTROY;
+}
+
+std::string AittPluginCppTransportable::GenClientDestroy() const {
+  return __CLIENT_DESTROY;
+}
+
+std::string AittPluginCppTransportable::GenSetSecurityCA(std::string arg) const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenSetSecurityCert(std::string arg) const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenSetSecurityPrivateKey(
+    std::string arg) const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenPeerInfoClone(std::string src_peer,
+      std::string dest_peer) const {
+  return std::string(ReplaceAll(__PEER_INFO_CLONE, {
+      { "<SRC_PEER>", src_peer },
+      { "<DEST_PEER>", dest_peer } }));
+}
+
+std::string AittPluginCppTransportable::GenServerSetOnDemandLaunchEnabled() const {
+  return "";
+}
+
+std::string AittPluginCppTransportable::GenServerListen() const {
+  return __SERVER_LISTEN;
+}
+
+std::string AittPluginCppTransportable::GenServerDisconnect(std::string server,
+      std::string peer) const {
+  return std::string(ReplaceAll(__SERVER_DISCONNECT, {
+      { "<SERVER>", server },
+      { "<PEER>", peer } }));
+}
+
+std::string AittPluginCppTransportable::GenPeerInfoGetAppID(std::string peer,
+      std::string appid) const {
+  return std::string(ReplaceAll(__PEER_INFO_GET_APPID, {
+      { "<PEER>", peer},
+      { "<APPID>", appid} }));
+}
+
+std::string AittPluginCppTransportable::GenPeerInfoGetUUID(std::string peer,
+      std::string uuid) const {
+  return std::string(ReplaceAll(__PEER_INFO_GET_UUID, {
+      { "<PEER>", peer},
+      { "<UUID>", uuid} }));
+}
+
+}  // namespace tidl
diff --git a/idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.h b/idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.h
new file mode 100644 (file)
index 0000000..d7de754
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * 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_AITT_PLUGIN_CPP_TRANSPORTABLE_H_
+#define IDLC_GEN_AITT_PLUGIN_CPP_TRANSPORTABLE_H_
+
+#include <string>
+
+#include "idlc/gen_cion/cpp_transportable.h"
+
+namespace tidl {
+
+class AittPluginCppTransportable : public CppTransportable {
+ public:
+  virtual ~AittPluginCppTransportable() = default;
+  std::string GenInclude(int type = 0) const override;
+  std::string GenClientSendAsync(std::string client,
+      std::string payload, std::string size) const override;
+  std::string GenClientSend(std::string client, std::string data,
+      std::string data_size, std::string ret_data,
+      std::string ret_data_size) const override;
+  std::string GenServerSendAsync(std::string server, std::string client,
+      std::string payload, std::string size) const override;
+  std::string GenServerFileSend(std::string path,
+      std::string server, std::string peer) const override;
+  std::string GenClientFileSend(std::string path,
+      std::string client) const override;
+  std::string GenGroupType() const override;
+  std::string GenPayloadTransferStatusType(bool internal_type = false) const override;
+  std::string GenPayloadAsyncResultType() const override;
+  std::string GenPeerInfoType() const override;
+  std::string GenPeerInfoDestroy(std::string peer) const override;
+  std::string GenPayloadType() const override;
+  std::string GenClientType() const override;
+  std::string GenSecurityType(bool definition = true) const override;
+  std::string GenServerType() const override;
+  std::string GenClientTryConnect(std::string client,
+      std::string peer) const override;
+  std::string GenClientDisconnect(std::string client) const override;
+  std::string GenClientTryDiscovery(std::string client) const override;
+  std::string GenClientStopDiscovery(std::string client) const override;
+  std::string GenServerRegister() const override;
+  std::string GenServerUnregister() const override;
+  std::string GenClientExtraHeader() const override;
+  std::string GenClientExtraBody() const override;
+  std::string GenServerExtraHeader() const override;
+  std::string GenServerExtraBody() const override;
+  std::string GenServerAccept() const override;
+  std::string GenServerReject() const override;
+  std::string GenServerSetDisplayName() const override;
+  std::string GenGroupPublish() const override;
+  std::string GenPayloadTypeEnum() const override;
+  std::string GenPayloadTypeData() const override;
+  std::string GenPayloadTypeFile() const override;
+  std::string GenPayloadGetType() const override;
+  std::string GenErrorNone() const override;
+  std::string GenPayloadGetData() const override;
+  std::string GenClientCreate() const override;
+  std::string GenGroupCreate() const override;
+  std::string GenGroupDestroy() const override;
+  std::string GenClientDestroy() const override;
+  std::string GenSetSecurityCA(std::string arg) const override;
+  std::string GenSetSecurityCert(std::string arg) const override;
+  std::string GenSetSecurityPrivateKey(std::string arg) const override;
+  std::string GenPeerInfoClone(std::string src_peer,
+      std::string dest_peer) const override;
+  std::string GenServerSetOnDemandLaunchEnabled() const override;
+  std::string GenServerListen() const override;
+  std::string GenServerDisconnect(std::string server,
+      std::string peer) const override;
+  std::string GenPeerInfoGetAppID(std::string peer,
+      std::string appid) const override;
+  std::string GenPeerInfoGetUUID(std::string peer,
+      std::string uuid) const override;
+  std::string GenHeaderBase() const override;
+  std::string GenHeaderPayloadHandle() const override;
+  std::string GenHeaderCommonHandle() const override;
+  std::string GenHeaderClientHandle() const override;
+  std::string GenHeaderServerHandle() const override;
+  std::string GenHeaderGroupHandle() const override;
+  std::string GenHeaderConnectionHandle() const override;
+  std::string GenHeaderPayloadBase() const override;
+  std::string GenHeaderConnectionBase() const override;
+  std::string GenBodyPayloadBase() const override;
+  std::string GenBodyConnectionBase() const override;
+  std::string GenBodyPeerInfoBase() const override;
+  std::string GenNamespace() const override;
+  std::string GenProxyPrefix() const override;
+  std::string GenStubPrefix() const override;
+  std::string GenGroupPrefix() const override;
+  std::string GenModulePrefix() const override;
+  std::string GenErrorPrefix() const override;
+  std::string GenConnectionResultPrefix() const override;
+};
+
+}  // namespace tidl
+
+#endif  // IDLC_GEN_AITT_PLUGIN_CPP_TRANSPORTABLE_H_
\ No newline at end of file
index 86b2dc0ac58adafa2636731534e699a6e54b2362..6aa0e1b87319fce9c9dba78ee56615b7956ca0c9 100644 (file)
@@ -41,53 +41,56 @@ void AittPluginInternalBodyGen::GenPluginInit(std::ofstream& stream) {
 }
 
 void AittPluginInternalBodyGen::GenIncludeHeader(std::ofstream& stream) {
-  stream << tidl::ReplaceAll(CB_INTERNAL_HEADER, "<PREFIX>", GetHandlePrefix());
+  stream << tidl::ReplaceAll(CB_INTERNAL_HEADER, "<FILENAME>", GetFileNamespace());
 }
 
 void AittPluginInternalBodyGen::GenLoadModule(std::ofstream& stream) {
-  stream << CB_LOAD_MOUDLE_BASE;
-  stream << CB_LOAD_MOUDLE_PAYLOAD;
-  stream << CB_LOAD_MOUDLE_PEERINFO;
-  stream << CB_LOAD_MOUDLE_CONNECTION;
+  std::string code;
+  code = CB_LOAD_MOUDLE_BASE;
+  code += CB_LOAD_MOUDLE_PAYLOAD;
+  code += CB_LOAD_MOUDLE_PEERINFO;
+  code += CB_LOAD_MOUDLE_CONNECTION;
 
   switch (GetType()) {
     case 1:
     {
-      stream << CB_LOAD_MOUDLE_CLIENT;
+      code += CB_LOAD_MOUDLE_CLIENT;
       break;
     }
     case 2:
     {
-      stream << CB_LOAD_MOUDLE_SERVER;
+      code += CB_LOAD_MOUDLE_SERVER;
       break;
     }
     case 3:
     {
-      stream << CB_LOAD_MOUDLE_GROUP;
+      code += CB_LOAD_MOUDLE_GROUP;
       break;
     }
     default:
       break;
   }
-  stream << CB_LOAD_MOUDLE_BASE_RETURN;
+   code += CB_LOAD_MOUDLE_BASE_RETURN;
+
+   stream << tidl::ReplaceAll(code, "<PREFIX>", GetHandlePrefix());
 }
 
 void AittPluginInternalBodyGen::GenBody(std::ofstream& stream) {
-  stream << CB_BODY_BASE;
+  stream << tidl::ReplaceAll(CB_BODY_BASE, "<PREFIX>", GetHandlePrefix());
   switch (GetType()) {
     case 1:
     {
-      stream << CB_BODY_CLIENT;
+      stream << tidl::ReplaceAll(CB_BODY_CLIENT, "<PREFIX>", GetHandlePrefix());
       break;
     }
     case 2:
     {
-      stream << CB_BODY_SERVER;
+      stream << tidl::ReplaceAll(CB_BODY_SERVER, "<PREFIX>", GetHandlePrefix());
       break;
     }
     case 3:
     {
-      stream << CB_BODY_GROUP;
+      stream << tidl::ReplaceAll(CB_BODY_GROUP, "<PREFIX>", GetHandlePrefix());
       break;
     }
 
index a36befaafd7c2e1b528a14872172becbaf7e46b5..647def8214377c59f147a0b7fd00ba0afe69bb8f 100644 (file)
@@ -24,7 +24,7 @@ R"__c_cb(
 #include <stdio.h>
 #include <dlog.h>
 
-#include "<PREFIX>_internal.h"
+#include "<FILENAME>.h"
 
 )__c_cb";
 
@@ -101,79 +101,79 @@ static void *plugin_handle;
 #define PLUGIN_CTOR __attribute__((constructor))
 
 static bool __load_payload() {
-  plugin_payload_create = dlsym(plugin_handle,
+  <PREFIX>_payload_create = dlsym(plugin_handle,
       "aitt_plugin_payload_create");
-  if (!plugin_payload_create) {
+  if (!<PREFIX>_payload_create) {
     LOGE("Failed to find plugin_payload_create");
     return false;
   }
 
-  plugin_payload_destroy = dlsym(plugin_handle,
+  <PREFIX>_payload_destroy = dlsym(plugin_handle,
       "aitt_plugin_payload_destroy");
-  if (!plugin_payload_destroy) {
+  if (!<PREFIX>_payload_destroy) {
     LOGE("Failed to find plugin_payload_destroy");
     return false;
   }
 
-  plugin_payload_get_type = dlsym(plugin_handle,
+  <PREFIX>_payload_get_type = dlsym(plugin_handle,
       "aitt_plugin_payload_get_type");
-  if (!plugin_payload_get_type) {
+  if (!<PREFIX>_payload_get_type) {
     LOGE("Failed to find plugin_payload_get_type");
     return false;
   }
 
-  plugin_payload_get_data = dlsym(plugin_handle,
+  <PREFIX>_payload_get_data = dlsym(plugin_handle,
       "aitt_plugin_payload_get_data");
-  if (!plugin_payload_get_data) {
+  if (!<PREFIX>_payload_get_data) {
     LOGE("Failed to find plugin_payload_get_data");
     return false;
   }
 
-  plugin_payload_set_data = dlsym(plugin_handle,
+  <PREFIX>_payload_set_data = dlsym(plugin_handle,
       "aitt_plugin_payload_set_data");
-  if (!plugin_payload_set_data) {
+  if (!<PREFIX>_payload_set_data) {
     LOGE("Failed to find plugin_payload_set_data");
     return false;
   }
 
-  plugin_payload_save_as_file = dlsym(plugin_handle,
+  <PREFIX>_payload_save_as_file = dlsym(plugin_handle,
       "aitt_plugin_payload_save_as_file");
-  if (!plugin_payload_save_as_file) {
+  if (!<PREFIX>_payload_save_as_file) {
     LOGE("Failed to find plugin_payload_save_as_file");
     return false;
   }
 
-  plugin_payload_get_received_file_name = dlsym(plugin_handle,
+  <PREFIX>_payload_get_received_file_name = dlsym(plugin_handle,
       "aitt_plugin_payload_get_received_file_name");
-  if (!plugin_payload_get_received_file_name) {
+  if (!<PREFIX>_payload_get_received_file_name) {
     LOGE("Failed to find plugin_payload_get_received_file_name");
     return false;
   }
 
-  plugin_payload_get_received_bytes = dlsym(plugin_handle,
+  <PREFIX>_payload_get_received_bytes = dlsym(plugin_handle,
       "aitt_plugin_payload_get_received_bytes");
-  if (!plugin_payload_get_received_bytes) {
+  if (!<PREFIX>_payload_get_received_bytes) {
     LOGE("Failed to init plugin_payload_get_received_bytes");
     return false;
   }
 
-  plugin_payload_get_total_bytes = dlsym(plugin_handle,
+  <PREFIX>_payload_get_total_bytes = dlsym(plugin_handle,
       "aitt_plugin_payload_get_total_bytes");
-  if (!plugin_payload_get_total_bytes) {
+  if (!<PREFIX>_payload_get_total_bytes) {
     LOGE("Failed to find plugin_payload_get_total_bytes");
     return false;
   }
 
-  plugin_payload_set_file_path = dlsym(plugin_handle,
+  <PREFIX>_payload_set_file_path = dlsym(plugin_handle,
       "aitt_plugin_payload_set_file_path");
-  if (!plugin_payload_set_file_path) {
+  if (!<PREFIX>_payload_set_file_path) {
     LOGE("Failed to find plugin_payload_set_file_path");
     return false;
   }
 
-  plugin_payload_get_payload_id = dlsym(plugin_handle,
+  <PREFIX>_payload_get_payload_id = dlsym(plugin_handle,
       "aitt_plugin_payload_get_payload_id");
-  if (!plugin_payload_get_payload_id) {
+  if (!<PREFIX>_payload_get_payload_id) {
     LOGE("Failed to find plugin_payload_get_payload_id");
     return false;
   }
@@ -182,79 +182,79 @@ static bool __load_payload() {
 }
 
 static bool __load_peerinfo() {
-  plugin_peer_info_clone = dlsym(plugin_handle,
+  <PREFIX>_peer_info_clone = dlsym(plugin_handle,
       "aitt_plugin_peer_info_clone");
-  if (!plugin_peer_info_clone) {
+  if (!<PREFIX>_peer_info_clone) {
     LOGE("Failed to find plugin_peer_info_clone");
     return false;
   }
 
-  plugin_peer_info_destroy = dlsym(plugin_handle,
+  <PREFIX>_peer_info_destroy = dlsym(plugin_handle,
       "aitt_plugin_peer_info_destroy");
-  if (!plugin_peer_info_destroy) {
+  if (!<PREFIX>_peer_info_destroy) {
     LOGE("Failed to find plugin_peer_info_destroy");
     return false;
   }
 
-  plugin_peer_info_get_device_id = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_device_id = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_device_id");
-  if (!plugin_peer_info_get_device_id) {
+  if (!<PREFIX>_peer_info_get_device_id) {
     LOGE("Failed to find plugin_peer_info_get_device_id");
     return false;
   }
 
-  plugin_peer_info_get_device_name = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_device_name = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_device_name");
-  if (!plugin_peer_info_get_device_name) {
+  if (!<PREFIX>_peer_info_get_device_name) {
     LOGE("Failed to find plugin_peer_info_get_device_name");
     return false;
   }
 
-  plugin_peer_info_get_device_platform = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_device_platform = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_device_platform");
-  if (!plugin_peer_info_get_device_platform) {
+  if (!<PREFIX>_peer_info_get_device_platform) {
     LOGE("Failed to find plugin_peer_info_get_device_platform");
     return false;
   }
 
-  plugin_peer_info_get_device_platform_version = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_device_platform_version = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_device_platform_version");
-  if (!plugin_peer_info_get_device_platform_version) {
+  if (!<PREFIX>_peer_info_get_device_platform_version) {
     LOGE("Failed to find plugin_peer_info_get_device_platform_version");
     return false;
   }
 
-  plugin_peer_info_get_device_type = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_device_type = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_device_type");
-  if (!plugin_peer_info_get_device_type) {
+  if (!<PREFIX>_peer_info_get_device_type) {
     LOGE("Failed to find plugin_peer_info_get_device_type");
     return false;
   }
 
-  plugin_peer_info_get_app_id = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_app_id = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_app_id");
-  if (!plugin_peer_info_get_app_id) {
+  if (!<PREFIX>_peer_info_get_app_id) {
     LOGE("Failed to init plugin_peer_info_get_app_id");
     return false;
   }
 
-  plugin_peer_info_get_app_version = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_app_version = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_app_version");
-  if (!plugin_peer_info_get_app_version) {
+  if (!<PREFIX>_peer_info_get_app_version) {
     LOGE("Failed to find plugin_peer_info_get_app_version");
     return false;
   }
 
-  plugin_peer_info_get_uuid = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_uuid = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_uuid");
-  if (!plugin_peer_info_get_uuid) {
+  if (!<PREFIX>_peer_info_get_uuid) {
     LOGE("Failed to find plugin_peer_info_get_uuid");
     return false;
   }
 
-  plugin_peer_info_get_display_name = dlsym(plugin_handle,
+  <PREFIX>_peer_info_get_display_name = dlsym(plugin_handle,
       "aitt_plugin_peer_info_get_display_name");
-  if (!plugin_peer_info_get_display_name) {
+  if (!<PREFIX>_peer_info_get_display_name) {
     LOGE("Failed to find plugin_peer_info_get_display_name");
     return false;
   }
@@ -263,16 +263,16 @@ static bool __load_peerinfo() {
 }
 
 static bool __load_connection() {
-  plugin_connection_result_get_status = dlsym(plugin_handle,
+  <PREFIX>_connection_result_get_status = dlsym(plugin_handle,
       "aitt_plugin_connection_result_get_status");
-  if (!plugin_connection_result_get_status) {
+  if (!<PREFIX>_connection_result_get_status) {
     LOGE("Failed to find plugin_connection_result_get_status");
     return false;
   }
 
-  plugin_connection_result_get_reason = dlsym(plugin_handle,
+  <PREFIX>_connection_result_get_reason = dlsym(plugin_handle,
       "aitt_plugin_connection_result_get_reason");
-  if (!plugin_connection_result_get_reason) {
+  if (!<PREFIX>_connection_result_get_reason) {
     LOGE("Failed to find plugin_connection_result_get_reason");
     return false;
   }
@@ -284,57 +284,57 @@ static bool __load_connection() {
 constexpr const char CB_BODY_GROUP[] =
 R"__c_cb(
 static bool __load_group_channel() {
-  plugin_group_create = dlsym(plugin_handle, "aitt_plugin_group_create");
-  if (!plugin_group_create) {
+  <PREFIX>_group_create = dlsym(plugin_handle, "aitt_plugin_group_create");
+  if (!<PREFIX>_group_create) {
     LOGE("Failed to find plugin_group_create");
     return false;
   }
 
-  plugin_group_destroy = dlsym(plugin_handle,
+  <PREFIX>_group_destroy = dlsym(plugin_handle,
       "aitt_plugin_group_destroy");
-  if (!plugin_group_destroy) {
+  if (!<PREFIX>_group_destroy) {
     LOGE("Failed to find plugin_group_destroy");
     return false;
   }
 
-  plugin_group_subscribe = dlsym(plugin_handle,
+  <PREFIX>_group_subscribe = dlsym(plugin_handle,
       "aitt_plugin_group_subscribe");
-  if (!plugin_group_subscribe) {
+  if (!<PREFIX>_group_subscribe) {
     LOGE("Failed to find plugin_group_subscribe");
     return false;
   }
 
-  plugin_group_unsubscribe = dlsym(plugin_handle,
+  <PREFIX>_group_unsubscribe = dlsym(plugin_handle,
       "aitt_plugin_group_unsubscribe");
-  if (!plugin_group_unsubscribe) {
+  if (!<PREFIX>_group_unsubscribe) {
     LOGE("Failed to find plugin_group_unsubscribe");
     return false;
   }
 
-  plugin_group_publish = dlsym(plugin_handle,
+  <PREFIX>_group_publish = dlsym(plugin_handle,
       "aitt_plugin_group_publish");
-  if (!plugin_group_publish) {
+  if (!<PREFIX>_group_publish) {
     LOGE("Failed to find plugin_group_publish");
     return false;
   }
 
-  plugin_group_add_payload_received_cb = dlsym(plugin_handle,
+  <PREFIX>_group_add_payload_received_cb = dlsym(plugin_handle,
       "aitt_plugin_group_add_payload_received_cb");
-  if (!plugin_group_add_payload_received_cb) {
+  if (!<PREFIX>_group_add_payload_received_cb) {
     LOGE("Failed to find plugin_group_add_payload_received_cb");
     return false;
   }
 
-  plugin_group_add_joined_cb = dlsym(plugin_handle,
+  <PREFIX>_group_add_joined_cb = dlsym(plugin_handle,
       "aitt_plugin_group_add_joined_cb");
-  if (!(*plugin_group_add_joined_cb)) {
+  if (!<PREFIX>_group_add_joined_cb) {
     LOGE("Failed to find plugin_group_add_joined_cb");
     return false;
   }
 
-  plugin_group_add_left_cb = dlsym(plugin_handle,
+  <PREFIX>_group_add_left_cb = dlsym(plugin_handle,
       "aitt_plugin_group_add_left_cb");
-  if (!plugin_group_add_left_cb) {
+  if (!<PREFIX>_group_add_left_cb) {
     LOGE("Failed to init plugin_group_add_left_cb");
     return false;
   }
@@ -346,78 +346,78 @@ static bool __load_group_channel() {
 constexpr const char CB_BODY_CLIENT[] =
 R"__c_cb(
 static bool __load_client_channel() {
-  plugin_client_create = dlsym(plugin_handle, "aitt_plugin_client_create");
-  if (!plugin_client_create) {
+  <PREFIX>_client_create = dlsym(plugin_handle, "aitt_plugin_client_create");
+  if (!<PREFIX>_client_create) {
     LOGE("Failed to find plugin_client_create");
     return false;
   }
 
-  plugin_client_destroy = dlsym(plugin_handle,
+  <PREFIX>_client_destroy = dlsym(plugin_handle,
       "aitt_plugin_client_destroy");
-  if (!plugin_client_destroy) {
+  if (!<PREFIX>_client_destroy) {
     LOGE("Failed to find plugin_client_destroy");
     return false;
   }
 
-  plugin_client_try_discovery = dlsym(plugin_handle,
+  <PREFIX>_client_try_discovery = dlsym(plugin_handle,
       "aitt_plugin_client_try_discovery");
-  if (!plugin_client_try_discovery) {
+  if (!<PREFIX>_client_try_discovery) {
     LOGE("Failed to find plugin_client_try_discovery");
     return false;
   }
 
-  plugin_client_stop_discovery = dlsym(plugin_handle,
+  <PREFIX>_client_stop_discovery = dlsym(plugin_handle,
       "aitt_plugin_client_stop_discovery");
-  if (!plugin_client_stop_discovery) {
+  if (!<PREFIX>_client_stop_discovery) {
     LOGE("Failed to find plugin_client_stop_discovery");
     return false;
   }
 
-  plugin_client_connect = dlsym(plugin_handle,
+  <PREFIX>_client_connect = dlsym(plugin_handle,
       "aitt_plugin_client_connect");
-  if (!plugin_client_connect) {
+  if (!<PREFIX>_client_connect) {
     LOGE("Failed to find plugin_client_connect");
     return false;
   }
 
-  plugin_client_disconnect = dlsym(plugin_handle,
+  <PREFIX>_client_disconnect = dlsym(plugin_handle,
       "aitt_plugin_client_disconnect");
-  if (!plugin_client_disconnect) {
+  if (!<PREFIX>_client_disconnect) {
     LOGE("Failed to find plugin_client_disconnect");
     return false;
   }
 
-  plugin_client_send_data = dlsym(plugin_handle,
+  <PREFIX>_client_send_data = dlsym(plugin_handle,
       "aitt_plugin_client_send_data");
-  if (!(*plugin_client_send_data)) {
+  if (!<PREFIX>_client_send_data) {
     LOGE("Failed to find plugin_client_send_data");
     return false;
   }
 
-  plugin_client_send_payload_async = dlsym(plugin_handle,
+  <PREFIX>_client_send_payload_async = dlsym(plugin_handle,
       "aitt_plugin_client_send_payload_async");
-  if (!plugin_client_send_payload_async) {
+  if (!<PREFIX>_client_send_payload_async) {
     LOGE("Failed to init plugin_client_send_payload_async");
     return false;
   }
 
-  plugin_client_add_connection_result_cb = dlsym(plugin_handle,
+  <PREFIX>_client_add_connection_result_cb = dlsym(plugin_handle,
       "aitt_plugin_client_add_connection_result_cb");
-  if (!plugin_client_add_connection_result_cb) {
+  if (!<PREFIX>_client_add_connection_result_cb) {
     LOGE("Failed to find plugin_client_add_connection_result_cb");
     return false;
   }
 
-  plugin_client_add_payload_received_cb = dlsym(plugin_handle,
+  <PREFIX>_client_add_payload_received_cb = dlsym(plugin_handle,
         "aitt_plugin_client_add_payload_received_cb");
-  if (!plugin_client_add_payload_received_cb) {
+  if (!<PREFIX>_client_add_payload_received_cb) {
     LOGE("Failed to find plugin_client_add_payload_received_cb");
     return false;
   }
 
-  plugin_client_add_disconnected_cb = dlsym(plugin_handle,
+  <PREFIX>_client_add_disconnected_cb = dlsym(plugin_handle,
       "aitt_plugin_client_add_disconnected_cb");
-  if (!plugin_client_add_disconnected_cb) {
+  if (!<PREFIX>_client_add_disconnected_cb) {
     LOGE("Failed to find plugin_client_add_disconnected_cb");
     return false;
   }
@@ -429,86 +429,93 @@ static bool __load_client_channel() {
 constexpr const char CB_BODY_SERVER[] =
 R"__c_cb(
 static bool __load_server_channel() {
-  plugin_server_create = dlsym(plugin_handle, "aitt_plugin_server_create");
-  if (!plugin_server_create) {
+  <PREFIX>_server_create = dlsym(plugin_handle, "aitt_plugin_server_create");
+  if (!<PREFIX>_server_create) {
     LOGE("Failed to find plugin_server_create");
     return false;
   }
 
-  plugin_server_add_connection_result_cb = dlsym(plugin_handle,
+  <PREFIX>_server_add_connection_result_cb = dlsym(plugin_handle,
       "aitt_plugin_server_add_connection_result_cb");
-  if (!plugin_server_add_connection_result_cb) {
+  if (!<PREFIX>_server_add_connection_result_cb) {
     LOGE("Failed to find plugin_server_add_connection_result_cb");
     return false;
   }
 
-  plugin_server_add_payload_received_cb = dlsym(plugin_handle,
+  <PREFIX>_server_add_payload_received_cb = dlsym(plugin_handle,
       "aitt_plugin_server_add_payload_received_cb");
-  if (!plugin_server_add_payload_received_cb) {
+  if (!<PREFIX>_server_add_payload_received_cb) {
     LOGE("Failed to find plugin_server_add_payload_received_cb");
     return false;
   }
 
-  plugin_server_add_disconnected_cb = dlsym(plugin_handle,
+  <PREFIX>_server_add_disconnected_cb = dlsym(plugin_handle,
       "aitt_plugin_server_add_disconnected_cb");
-  if (!plugin_server_add_disconnected_cb) {
+  if (!<PREFIX>_server_add_disconnected_cb) {
     LOGE("Failed to find plugin_server_add_disconnected_cb");
     return false;
   }
 
-  plugin_server_set_data_received_cb = dlsym(plugin_handle,
+  <PREFIX>_server_set_data_received_cb = dlsym(plugin_handle,
       "aitt_plugin_server_set_data_received_cb");
-  if (!plugin_server_set_data_received_cb) {
+  if (!<PREFIX>_server_set_data_received_cb) {
     LOGE("Failed to find plugin_server_set_data_received_cb");
     return false;
   }
 
-  plugin_server_listen = dlsym(plugin_handle, "aitt_plugin_server_listen");
-  if (!plugin_server_listen) {
+  <PREFIX>_server_listen = dlsym(plugin_handle, "aitt_plugin_server_listen");
+  if (!<PREFIX>_server_listen) {
     LOGE("Failed to find plugin_server_listen");
     return false;
   }
 
-  plugin_server_foreach_connected_peer_info = dlsym(plugin_handle,
+  <PREFIX>_server_foreach_connected_peer_info = dlsym(plugin_handle,
       "aitt_plugin_server_foreach_connected_peer_info");
-  if (!(*plugin_server_foreach_connected_peer_info)) {
-    LOGE("Failed to find plugin_server_foreach_connected_peer_info");
+  if (!<PREFIX>_server_foreach_connected_peer_info) {
+    LOGE("Failed to find <PREFIX>_server_foreach_connected_peer_info");
     return false;
   }
 
-  plugin_server_accept = dlsym(plugin_handle, "aitt_plugin_server_accept");
-  if (!plugin_server_accept) {
+  <PREFIX>_server_accept = dlsym(plugin_handle, "aitt_plugin_server_accept");
+  if (!<PREFIX>_server_accept) {
     LOGE("Failed to init plugin_server_accept");
     return false;
   }
 
-  plugin_server_reject = dlsym(plugin_handle, "aitt_plugin_server_reject");
-  if (!plugin_server_reject) {
+  <PREFIX>_server_reject = dlsym(plugin_handle, "aitt_plugin_server_reject");
+  if (!<PREFIX>_server_reject) {
     LOGE("Failed to find plugin_server_reject");
     return false;
   }
 
-  plugin_server_set_display_name = dlsym(plugin_handle,
+  <PREFIX>_server_set_display_name = dlsym(plugin_handle,
         "aitt_plugin_server_set_display_name");
-  if (!plugin_server_set_display_name) {
+  if (!<PREFIX>_server_set_display_name) {
     LOGE("Failed to find plugin_server_set_display_name");
     return false;
   }
 
-  plugin_server_send_payload_async = dlsym(plugin_handle,
+  <PREFIX>_server_send_payload_async = dlsym(plugin_handle,
       "aitt_plugin_server_send_payload_async");
-  if (!plugin_server_send_payload_async) {
+  if (!<PREFIX>_server_send_payload_async) {
     LOGE("Failed to find plugin_server_send_payload_async");
     return false;
   }
 
-  plugin_server_destroy = dlsym(plugin_handle,
+  <PREFIX>_server_destroy = dlsym(plugin_handle,
       "aitt_plugin_server_destroy");
-  if (!plugin_server_destroy) {
+  if (!<PREFIX>_server_destroy) {
     LOGE("Failed to find plugin_server_destroy");
     return false;
   }
 
+  <PREFIX>_server_disconnect = dlsym(plugin_handle,
+      "aitt_plugin_server_disconnect");
+  if (!<PREFIX>_server_disconnect) {
+    LOGE("Failed to find plugin_server_disconnect");
+    return false;
+  }
+
   return true;
 }
 )__c_cb";
index 972b92caf410fd6d748b9ca6186be3dd6c04d117..63261e5aa02228b70a6dab5aa3db5e9a179e9b87 100644 (file)
@@ -28,33 +28,33 @@ AittPluginInternalHeaderGen::AittPluginInternalHeaderGen(std::shared_ptr<Documen
 void AittPluginInternalHeaderGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
 
-  stream << CB_HEADER_START;
-  stream << CB_HEADER_DEF_COMMON;
+  stream << tidl::ReplaceAll(CB_HEADER_START, "<PREFIX>", GetHandlePrefix());
+  stream << tidl::ReplaceAll(CB_HEADER_DEF_COMMON, "<PREFIX>", GetHandlePrefix());
 
   switch (GetType()) {
     case 1:
     {
-      stream << CB_HEADER_DEF_CLIENT;
-      stream << CB_HEADER_FUN_CLIENT;
+      stream << tidl::ReplaceAll(CB_HEADER_DEF_CLIENT, "<PREFIX>", GetHandlePrefix());
+      stream << tidl::ReplaceAll(CB_HEADER_FUN_CLIENT, "<PREFIX>", GetHandlePrefix());
       break;
     }
     case 2:
     {
-      stream << CB_HEADER_DEF_SERVER;
-      stream << CB_HEADER_FUN_SERVER;
+      stream << tidl::ReplaceAll(CB_HEADER_DEF_SERVER, "<PREFIX>", GetHandlePrefix());
+      stream << tidl::ReplaceAll(CB_HEADER_FUN_SERVER, "<PREFIX>", GetHandlePrefix());
       break;
     }
     case 3:
     {
-      stream << CB_HEADER_DEF_GROUP;
-      stream << CB_HEADER_FUN_GROUP;
+      stream << tidl::ReplaceAll(CB_HEADER_DEF_GROUP, "<PREFIX>", GetHandlePrefix());
+      stream << tidl::ReplaceAll(CB_HEADER_FUN_GROUP, "<PREFIX>", GetHandlePrefix());
       break;
     }
     default:
       break;
   }
-  stream << CB_HEADER_FUN_COMMOM;
 
+  stream << tidl::ReplaceAll(CB_HEADER_FUN_COMMOM, "<PREFIX>", GetHandlePrefix());
 }
 
 void AittPluginInternalHeaderGen::OnFiniGen(std::ofstream& stream) {
index b11e589577200704f9dc1c29cd47c457be136eb4..3b753821f837ae2ccfa8949ec3d8ae917d3798fe 100644 (file)
@@ -40,173 +40,174 @@ typedef enum _transfer_status_e {
 typedef enum _payload_type_e {
   AITT_PLUGIN_PAYLOAD_TYPE_DATA, /**< Data type payload **/
   AITT_PLUGIN_PAYLOAD_TYPE_FILE, /**< File type payload **/
-} plugin_payload_type_e;
+} <PREFIX>_payload_type_e;
 
 typedef enum _connection_status_e {
   CONNECTION_STATUS_OK, /**< Connection is ok **/
   CONNECTION_STATUS_REJECTED, /**< Connection is rejected **/
   CONNECTION_STATUS_ERROR, /**< Connection error occurs **/
-} plugin_connection_status_e;
+} <PREFIX>_connection_status_e;
 )__c_cb";
 
 constexpr const char CB_HEADER_DEF_COMMON[] =
 R"__c_cb(
-typedef void *plugin_peer_info_h;
-typedef void *plugin_connection_result_h;
-typedef void *plugin_payload_h;
-typedef void *plugin_payload_async_result_h;
+typedef void *<PREFIX>_peer_info_h;
+typedef void *<PREFIX>_connection_result_h;
+typedef void *<PREFIX>_payload_h;
+typedef void *<PREFIX>_payload_async_result_h;
 )__c_cb";
 
 constexpr const char CB_HEADER_DEF_SERVER[] =
 R"__c_cb(
-typedef void *plugin_server_h;
+typedef void *<PREFIX>_server_h;
 
-typedef void (*plugin_server_connection_result_cb)(
-    const char *service_name, const plugin_peer_info_h peer_info,
-    const plugin_connection_result_h result, void *user_data);
-typedef void (*plugin_server_payload_received_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, const plugin_payload_h payload,
+typedef void (*<PREFIX>_server_connection_result_cb)(
+    const char *service_name, const <PREFIX>_peer_info_h peer_info,
+    const <PREFIX>_connection_result_h result, void *user_data);
+typedef void (*<PREFIX>_server_payload_received_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, const <PREFIX>_payload_h payload,
     transfer_status_e status, void *user_data);
-typedef void (*plugin_server_connection_request_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, void *user_data);
-typedef void (*plugin_server_disconnected_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, void *user_data);
-typedef void (*plugin_server_data_received_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, const unsigned char *data,
+typedef void (*<PREFIX>_server_connection_request_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_server_disconnected_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_server_data_received_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, const unsigned char *data,
     unsigned int data_size, unsigned char **return_data,
     unsigned int *return_data_size, void *user_data);
-typedef bool (*plugin_server_connected_peer_info_cb)(
-    const plugin_peer_info_h peer_info, void *user_data);
-typedef void (*plugin_server_payload_async_result_cb)(
-    const plugin_payload_async_result_h result, void *user_data);
+typedef bool (*<PREFIX>_server_connected_peer_info_cb)(
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_server_payload_async_result_cb)(
+    const <PREFIX>_payload_async_result_h result, void *user_data);
 )__c_cb";
 
 constexpr const char CB_HEADER_DEF_GROUP[] =
 R"__c_cb(
-typedef void *plugin_group_h;
+typedef void *<PREFIX>_group_h;
 
-typedef void (*plugin_group_payload_received_cb)(const char *topic_name,
-    const plugin_peer_info_h peer_info, plugin_payload_h payload,
+typedef void (*<PREFIX>_group_payload_received_cb)(const char *topic_name,
+    const <PREFIX>_peer_info_h peer_info, <PREFIX>_payload_h payload,
     void *user_data);
-typedef void (*plugin_group_joined_cb)(const char *topic_name,
-    const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_group_joined_cb)(const char *topic_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
 
-typedef void (*plugin_group_left_cb)(const char *topic_name,
-    const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_group_left_cb)(const char *topic_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
 )__c_cb";
 
 constexpr const char CB_HEADER_DEF_CLIENT[] =
 R"__c_cb(
-typedef void *plugin_client_h;
-
-typedef void (*plugin_client_server_discovered_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, void *user_data);
-typedef void (*plugin_client_connection_result_cb)(
-    const char *service_name, const plugin_peer_info_h peer_info,
-    const plugin_connection_result_h result, void *user_data);
-typedef void (*plugin_client_payload_async_result_cb)(
-    const plugin_payload_async_result_h result, void *user_data);
-typedef void (*plugin_client_payload_received_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, const plugin_payload_h payload,
+typedef void *<PREFIX>_client_h;
+
+typedef void (*<PREFIX>_client_server_discovered_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_client_connection_result_cb)(
+    const char *service_name, const <PREFIX>_peer_info_h peer_info,
+    const <PREFIX>_connection_result_h result, void *user_data);
+typedef void (*<PREFIX>_client_payload_async_result_cb)(
+    const <PREFIX>_payload_async_result_h result, void *user_data);
+typedef void (*<PREFIX>_client_payload_received_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, const <PREFIX>_payload_h payload,
     transfer_status_e status, void *user_data);
-typedef void (*plugin_client_disconnected_cb)(const char *service_name,
-    const plugin_peer_info_h peer_info, void *user_data);
+typedef void (*<PREFIX>_client_disconnected_cb)(const char *service_name,
+    const <PREFIX>_peer_info_h peer_info, void *user_data);
 )__c_cb";
 
 constexpr const char CB_HEADER_FUN_GROUP[] =
 R"__c_cb(
-int (*plugin_group_create)(plugin_group_h *, const char *,
+int (*<PREFIX>_group_create)(<PREFIX>_group_h *, const char *,
     const char *, int , const char *, const char *,
     const char *, int);
-int (*plugin_group_destroy)(plugin_group_h);
-int (*plugin_group_subscribe)(plugin_group_h);
-int (*plugin_group_unsubscribe)(plugin_group_h);
-int (*plugin_group_publish)(plugin_group_h, plugin_payload_h);
-int (*plugin_group_add_payload_received_cb)(plugin_group_h,
-    plugin_group_payload_received_cb, void *);
-int (*plugin_group_add_joined_cb)(plugin_group_h,
-    plugin_group_joined_cb, void *);
-int (*plugin_group_add_left_cb)(plugin_group_h,
-  plugin_group_left_cb, void *);
+int (*<PREFIX>_group_destroy)(<PREFIX>_group_h);
+int (*<PREFIX>_group_subscribe)(<PREFIX>_group_h);
+int (*<PREFIX>_group_unsubscribe)(<PREFIX>_group_h);
+int (*<PREFIX>_group_publish)(<PREFIX>_group_h, <PREFIX>_payload_h);
+int (*<PREFIX>_group_add_payload_received_cb)(<PREFIX>_group_h,
+    <PREFIX>_group_payload_received_cb, void *);
+int (*<PREFIX>_group_add_joined_cb)(<PREFIX>_group_h,
+    <PREFIX>_group_joined_cb, void *);
+int (*<PREFIX>_group_add_left_cb)(<PREFIX>_group_h,
+  <PREFIX>_group_left_cb, void *);
 )__c_cb";
 
 constexpr const char CB_HEADER_FUN_CLIENT[] =
 R"__c_cb(
-int (*plugin_client_create)(plugin_client_h *, const char *,
+int (*<PREFIX>_client_create)(<PREFIX>_client_h *, const char *,
     const char *, int , const char *, const char *,
     const char *, int);
-int (*plugin_client_destroy)(plugin_client_h);
-int (*plugin_client_try_discovery)(plugin_client_h,
-    plugin_client_server_discovered_cb, void *);
-int (*plugin_client_stop_discovery)(plugin_client_h);
-int (*plugin_client_connect)(plugin_client_h, const plugin_peer_info_h);
-int (*plugin_client_disconnect)(plugin_client_h);
-int (*plugin_client_send_data)(plugin_client_h, unsigned char *,
+int (*<PREFIX>_client_destroy)(<PREFIX>_client_h);
+int (*<PREFIX>_client_try_discovery)(<PREFIX>_client_h,
+    <PREFIX>_client_server_discovered_cb, void *);
+int (*<PREFIX>_client_stop_discovery)(<PREFIX>_client_h);
+int (*<PREFIX>_client_connect)(<PREFIX>_client_h, const <PREFIX>_peer_info_h);
+int (*<PREFIX>_client_disconnect)(<PREFIX>_client_h);
+int (*<PREFIX>_client_send_data)(<PREFIX>_client_h, unsigned char *,
     unsigned int, int, unsigned char **, unsigned int *);
-int (*plugin_client_send_payload_async)(plugin_client_h,
-    plugin_payload_h, plugin_client_payload_async_result_cb, void *);
-int (*plugin_client_add_connection_result_cb)(plugin_client_h,
-    plugin_client_connection_result_cb, void *);
-int (*plugin_client_add_payload_received_cb)(plugin_client_h,
-    plugin_client_payload_received_cb, void *);
-int (*plugin_client_add_disconnected_cb)(plugin_client_h,
-    plugin_client_disconnected_cb, void *);
+int (*<PREFIX>_client_send_payload_async)(<PREFIX>_client_h,
+    <PREFIX>_payload_h, <PREFIX>_client_payload_async_result_cb, void *);
+int (*<PREFIX>_client_add_connection_result_cb)(<PREFIX>_client_h,
+    <PREFIX>_client_connection_result_cb, void *);
+int (*<PREFIX>_client_add_payload_received_cb)(<PREFIX>_client_h,
+    <PREFIX>_client_payload_received_cb, void *);
+int (*<PREFIX>_client_add_disconnected_cb)(<PREFIX>_client_h,
+    <PREFIX>_client_disconnected_cb, void *);
 )__c_cb";
 
 constexpr const char CB_HEADER_FUN_SERVER[] =
 R"__c_cb(
-int (*plugin_server_create)(plugin_server_h *, const char *,
+int (*<PREFIX>_server_create)(<PREFIX>_server_h *, const char *,
     const char *, const char *, int ,const char *, const char *, const char *, int);
-int (*plugin_server_add_connection_result_cb)(plugin_server_h,
-    plugin_server_connection_result_cb, void *);
-int (*plugin_server_add_payload_received_cb)(plugin_server_h,
-    plugin_server_payload_received_cb, void *);
-int (*plugin_server_add_disconnected_cb)(plugin_server_h,
-    plugin_server_disconnected_cb, void *);
-int (*plugin_server_set_data_received_cb)(plugin_server_h,
-    plugin_server_data_received_cb , void *);
-int (*plugin_server_destroy)(plugin_server_h);
-int (*plugin_server_listen)(plugin_server_h,
-    plugin_server_connection_request_cb, void *);
-int (*plugin_server_foreach_connected_peer_info)(plugin_server_h,
-    plugin_server_connected_peer_info_cb, void *);
-int (*plugin_server_accept)(plugin_server_h, const plugin_peer_info_h);
-int (*plugin_server_reject)(plugin_server_h,const plugin_peer_info_h,
+int (*<PREFIX>_server_add_connection_result_cb)(<PREFIX>_server_h,
+    <PREFIX>_server_connection_result_cb, void *);
+int (*<PREFIX>_server_add_payload_received_cb)(<PREFIX>_server_h,
+    <PREFIX>_server_payload_received_cb, void *);
+int (*<PREFIX>_server_add_disconnected_cb)(<PREFIX>_server_h,
+    <PREFIX>_server_disconnected_cb, void *);
+int (*<PREFIX>_server_set_data_received_cb)(<PREFIX>_server_h,
+    <PREFIX>_server_data_received_cb , void *);
+int (*<PREFIX>_server_destroy)(<PREFIX>_server_h);
+int (*<PREFIX>_server_listen)(<PREFIX>_server_h,
+    <PREFIX>_server_connection_request_cb, void *);
+int (*<PREFIX>_server_foreach_connected_peer_info)(<PREFIX>_server_h,
+    <PREFIX>_server_connected_peer_info_cb, void *);
+int (*<PREFIX>_server_accept)(<PREFIX>_server_h, const <PREFIX>_peer_info_h);
+int (*<PREFIX>_server_reject)(<PREFIX>_server_h,const <PREFIX>_peer_info_h,
     const char *);
-int (*plugin_server_set_display_name)(plugin_server_h, const char *);
-int (*plugin_server_send_payload_async)(plugin_server_h,
-    plugin_peer_info_h, plugin_payload_h,
-    plugin_server_payload_async_result_cb, void *);
+int (*<PREFIX>_server_set_display_name)(<PREFIX>_server_h, const char *);
+int (*<PREFIX>_server_send_payload_async)(<PREFIX>_server_h,
+    <PREFIX>_peer_info_h, <PREFIX>_payload_h,
+    <PREFIX>_server_payload_async_result_cb, void *);
+int (*<PREFIX>_server_disconnect)(<PREFIX>_server_h, <PREFIX>_peer_info_h);
 )__c_cb";
 
 constexpr const char CB_HEADER_FUN_COMMOM[] =
 R"__c_cb(
-int (*plugin_payload_create)(plugin_payload_h *, plugin_payload_type_e);
-int (*plugin_payload_destroy)(plugin_payload_h);
-int (*plugin_payload_get_type)(plugin_payload_h, plugin_payload_type_e *);
-int (*plugin_payload_get_data)(plugin_payload_h, unsigned char **, unsigned int *);
-int (*plugin_payload_set_data)(plugin_payload_h, const unsigned char *, unsigned int);
-int (*plugin_payload_save_as_file)(plugin_payload_h, const char *);
-int (*plugin_payload_get_received_file_name)(plugin_payload_h, char **);
-int (*plugin_payload_get_received_bytes)(plugin_payload_h, uint64_t *);
-int (*plugin_payload_get_total_bytes)(plugin_payload_h, uint64_t *);
-int (*plugin_payload_set_file_path)(plugin_payload_h, const char *);
-int (*plugin_payload_get_payload_id)(plugin_payload_h, char **);
-
-int (*plugin_peer_info_clone)(const plugin_peer_info_h, plugin_peer_info_h *);
-int (*plugin_peer_info_destroy)(plugin_peer_info_h);
-int (*plugin_peer_info_get_device_id)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_device_name)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_device_platform)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_device_platform_version)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_device_type)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_app_id)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_app_version)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_uuid)(plugin_peer_info_h, char **);
-int (*plugin_peer_info_get_display_name)(plugin_peer_info_h, char **);
-
-int (*plugin_connection_result_get_status)(const plugin_connection_result_h, plugin_connection_status_e *);
-int (*plugin_connection_result_get_reason)(const plugin_connection_result_h, char **reason);
+int (*<PREFIX>_payload_create)(<PREFIX>_payload_h *, <PREFIX>_payload_type_e);
+int (*<PREFIX>_payload_destroy)(<PREFIX>_payload_h);
+int (*<PREFIX>_payload_get_type)(<PREFIX>_payload_h, <PREFIX>_payload_type_e *);
+int (*<PREFIX>_payload_get_data)(<PREFIX>_payload_h, unsigned char **, unsigned int *);
+int (*<PREFIX>_payload_set_data)(<PREFIX>_payload_h, const unsigned char *, unsigned int);
+int (*<PREFIX>_payload_save_as_file)(<PREFIX>_payload_h, const char *);
+int (*<PREFIX>_payload_get_received_file_name)(<PREFIX>_payload_h, char **);
+int (*<PREFIX>_payload_get_received_bytes)(<PREFIX>_payload_h, uint64_t *);
+int (*<PREFIX>_payload_get_total_bytes)(<PREFIX>_payload_h, uint64_t *);
+int (*<PREFIX>_payload_set_file_path)(<PREFIX>_payload_h, const char *);
+int (*<PREFIX>_payload_get_payload_id)(<PREFIX>_payload_h, char **);
+
+int (*<PREFIX>_peer_info_clone)(const <PREFIX>_peer_info_h, <PREFIX>_peer_info_h *);
+int (*<PREFIX>_peer_info_destroy)(<PREFIX>_peer_info_h);
+int (*<PREFIX>_peer_info_get_device_id)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_device_name)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_device_platform)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_device_platform_version)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_device_type)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_app_id)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_app_version)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_uuid)(<PREFIX>_peer_info_h, char **);
+int (*<PREFIX>_peer_info_get_display_name)(<PREFIX>_peer_info_h, char **);
+
+int (*<PREFIX>_connection_result_get_status)(const <PREFIX>_connection_result_h, <PREFIX>_connection_status_e *);
+int (*<PREFIX>_connection_result_get_reason)(const <PREFIX>_connection_result_h, char **reason);
 )__c_cb";
 
 #endif  // IDLC_C_AITT_PLUGIN_GEN_INTERNAL_HEADER_GEN_CB_H_
index 984a4af137982ef599625f9e562263025a9d1c61..e40afdce077e006743ec2a415942f3a33ab73c15 100644 (file)
@@ -19,6 +19,7 @@
 #include "idlc/gen_aitt_plugin/aitt_plugin_c_transportable.h"
 #include "idlc/gen_aitt_plugin/aitt_plugin_cs_transportable.h"
 #include "idlc/gen_aitt_plugin/aitt_plugin_java_transportable.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_cpp_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"
@@ -28,8 +29,8 @@ namespace tidl {
 AIttPluginLoader::AIttPluginLoader(const std::string& plugin_path) {
   if (plugin_path.empty()) {
     C_.reset(new AittPluginCTransportable());
-//    Cpp_.reset(new DefaultCppTransportable());
     Cs_.reset(new AittPluginCsTransportable());
+    Cpp_.reset(new AittPluginCppTransportable());
     Java_.reset(new AittPluginJavaTransportable());
   } else {
     // TODO
index 1a72427e352a49c42a6338c509ba814c0c9fb072..954d567bdf3c97c2416ed3f019ea3c6d9e747ddb 100644 (file)
@@ -451,6 +451,7 @@ void CCionBodyGeneratorBase::GenCommonFuntions(std::ofstream& stream) {
 
   ReplaceAll(code,"<PREFIX>", GetHandlePrefix())
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
       .Out(stream);
 }
 
@@ -780,6 +781,8 @@ void CCionBodyGeneratorBase::GenFilePayloadSend(std::ofstream& stream, bool is_p
     code = ReplaceAll(code, "<FILE_PAYLOAD_SENDER_DEF>", def);
     code = ReplaceAll(code, "<FILE_PAYLOAD_SEND>",
         GetTransportable().C().GenClientFileSend("value", "client"));
+    code = ReplaceAll(code, "<PREFIX>", GetHandlePrefix());
+
   } else {
     std::string def(
         ReplaceAll(CB_INTERFACE_METHOD_FILE_PAYLOAD_SENDER_SERVER_DEF,
@@ -789,10 +792,12 @@ void CCionBodyGeneratorBase::GenFilePayloadSend(std::ofstream& stream, bool is_p
     code = ReplaceAll(code, "<FILE_PAYLOAD_SEND>",
         GetTransportable().C().GenServerFileSend("value",
             "server", "peer_info"));
+    code = ReplaceAll(code, "<PREFIX>", GetHandlePrefix());
   }
 
   code = ReplaceAll(code)
              .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+             .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
              .Change("<MODULE_PREFIX>", GetMoudlePrefix());
 
   stream << SmartIndent(code);
index 39d219c96f58ed6441e31fb2f6f95cc5152ad8eb..dc72940b8e432eace95287e9c7468b5ff3e32e92 100644 (file)
@@ -364,6 +364,7 @@ void CCionGeneratorBase::GenIncludeDefaultHeaders(std::ofstream& stream,
 
   str = ReplaceAll(str, "<INCLUDE>", GetTransportable().C().GenInclude(body, GetType()));
   str = ReplaceAll(str, "<PREFIX>", GetHandlePrefix());
+  str = ReplaceAll(str, "<FILENAME>", GetFileNamespace());
   stream << str;
 }
 
@@ -461,12 +462,21 @@ std::string CCionGeneratorBase::GetErrorValue(const BaseType& type) {
 std::string CCionGeneratorBase::GetMoudlePrefix() {
   std::string prefix = GetTransportable().C().GenModulePrefix();
 
-  if (!HasNamespace() || !IsGeneratedAPI())
+  if (!HasNamespace()|| !IsGeneratedAPI())
     return prefix;
 
   return prefix + "_" + GetFileNamespace();
 }
 
+std::string CCionGeneratorBase::GetInternalHandlePrefix() {
+  std::string prefix = GetHandlePrefix();
+
+  if (!HasNamespace())
+    return prefix;
+
+  return prefix + "_internal";
+}
+
 std::string CCionGeneratorBase::GetHandlePrefix() {
   std::string prefix;
   switch(static_cast<tidl::Options::Type>(GetType())) {
index 2e0a4a4ff2b31588b78dd80bcd4e4e8e16aaad0a..abb9c2c97d1b314eccf1a5372561eb8bec4222bf 100644 (file)
@@ -58,6 +58,7 @@ class CCionGeneratorBase : public CionPluginBase {
   void GenGNUSourceDefinition(std::ofstream& stream);
   std::string GetHandlePrefix();
   std::string GetMoudlePrefix();
+  std::string GetInternalHandlePrefix();
   std::string RemoveLastSpaces(const std::string& str);
 
  private:
index 3ab33a9f386f56c9174e60ba07d15c07631b392a..ea207222317612eec8fc491d3b1bc6dcc85f7c02 100644 (file)
@@ -63,6 +63,7 @@ void CCionGroupBodyGen::GenInterfaceDef(std::ofstream& stream,
       .Change("<NAME>", iface.GetID())
       .Change("<SECURITY_T>", GetTransportable().C().GenSecurityType())
       .Change("<GROUP_T>", GetTransportable().C().GenGroupType())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
       .Transform([&](std::string code) {
         return SmartIndent(code);
       })
@@ -215,6 +216,7 @@ void CCionGroupBodyGen::GenInterfaceBase(std::ofstream& stream,
       .Change("<GROUP_DESTROY>", GetTransportable().C().GenGroupDestroy())
       .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
       .Change("<PREFIX>", prefix)
       .Transform([&](std::string str) {
         return SmartIndent(str);
@@ -465,6 +467,7 @@ std::string CCionGroupBodyGen::GenMethodAsyncBase(const Interface& iface,
       .Change("<PAYLOAD_T>", GetTransportable().C().GenPayloadType(true))
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Change("<GROUP_PUBLISH>", GetTransportable().C().GenGroupPublish())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
       .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
   return code;
 }
index 346d0abc64a20ca3d621482c458860f6672f4f91..4153fa4f575fe12d655c626d0458d5108f07db4f 100644 (file)
@@ -92,12 +92,13 @@ void CCionProxyBodyGen::GenInterfaceDelegateDef(std::ofstream& stream,
 void CCionProxyBodyGen::GenInterfaceBaseDef(std::ofstream& stream,
     const Interface& iface) {
   ReplaceAll(CB_INTERFACE_BASE_DEF, {
-      { "<PREFIX>", GetHandlePrefix() },
       { "<NAME>", iface.GetID() },
       { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
       { "<CLIENT_T>", GetTransportable().C().GenClientType() },
       { "<MODULE_PREFIX>", GetMoudlePrefix() },
-      { "<SECURITY_T>", GetTransportable().C().GenSecurityType() }
+      { "<SECURITY_T>", GetTransportable().C().GenSecurityType() },
+      { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+      { "<PREFIX>", GetHandlePrefix() }
   })
   .Transform([&](std::string code) {
     return SmartIndent(code);
@@ -171,6 +172,7 @@ void CCionProxyBodyGen::GenInterfaceBase(std::ofstream& stream,
       .Change("<PAYLOAD_GET_DATA>", GetTransportable().C().GenPayloadGetData())
       .Change("<CLIENT_DESTROY>", GetTransportable().C().GenClientDestroy())
       .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Change("<PREFIX>", prefix)
       .Transform([&](std::string code) {
@@ -510,7 +512,6 @@ std::string CCionProxyBodyGen::GenMethodAsyncBase(const Interface& iface,
   std::string method_name = decl.GetID();
 
   std::string code(ReplaceAll(CB_INTERFACE_METHOD_ASYNC_BASE)
-      .Change("<PREFIX>", prefix)
       .Change("<NAME>", name)
       .Change("<METHOD_NAME>", method_name)
       .Change("<METHOD_PARAMS>", GenMethodParams(iface, decl))
@@ -529,7 +530,9 @@ std::string CCionProxyBodyGen::GenMethodAsyncBase(const Interface& iface,
           GetTransportable().C().GenClientSendAsync(
               "h->client", "pl_", "data_size_"))
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
-      .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+      .Change("<PREFIX>", prefix));
 
   return code;
 }
@@ -614,7 +617,6 @@ std::string CCionProxyBodyGen::GenMethodBase(const Interface& iface,
 
   std::string code(ReplaceAll(CB_INTERFACE_METHOD_BASE)
       .Change("<RETURN_TYPE>", GetReturnTypeString(decl.GetType()))
-      .Change("<PREFIX>", prefix)
       .Change("<NAME>", name)
       .Change("<METHOD_NAME>", method_name)
       .Change("<METHOD_PARAMS>", GenMethodParams(iface, decl))
@@ -635,7 +637,9 @@ std::string CCionProxyBodyGen::GenMethodBase(const Interface& iface,
           "h->client", "data_", "data_size_",
           "return_data_", "return_data_size_"))
       .Change("<MODULE_PREFIX>", GetMoudlePrefix())
-      .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix()));
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+      .Change("<PREFIX>", prefix));
   return code;
 }
 
index 36488b3f51bb299c8c80d79c7b978dc36e44f65c..060b45fc3cc45fdc47f1e158922647f1ad374989 100644 (file)
@@ -202,10 +202,11 @@ void CCionStubBodyGen::GenInterfaceDelegateDef(std::ofstream& stream,
 void CCionStubBodyGen::GenInterfaceBaseDef(std::ofstream& stream,
     const Interface& iface) {
   std::string code(ReplaceAll(CB_INTERFACE_BASE_DEF, {
-      { "<PREFIX>", GetHandlePrefix() },
       { "<NAME>", iface.GetID() },
       { "<SERVER_T>", GetTransportable().C().GenServerType() },
-      { "<SECURITY_T>", GetTransportable().C().GenSecurityType() }
+      { "<SECURITY_T>", GetTransportable().C().GenSecurityType() },
+      { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+      { "<PREFIX>", GetHandlePrefix() }
   }));
 
   stream << SmartIndent(code);
@@ -366,6 +367,7 @@ void CCionStubBodyGen::GenInterfaceDelegateBase(std::ofstream& stream,
               .GenPeerInfoClone("peer_info", "&h->peer_info") },
       { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
       { "<MODULE_PREFIX>", GetMoudlePrefix() },
+      { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
       { "<PREFIX>", GetHandlePrefix() }
   }));
 
@@ -631,6 +633,7 @@ void CCionStubBodyGen::GenInterfaceMethodHandlerBase(std::ofstream& stream,
       { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
       { "<PEER_INFO_T>", GetTransportable().C().GenPeerInfoType() },
       { "<MODULE_PREFIX>", GetMoudlePrefix() },
+      { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
       { "<PREFIX>", GetHandlePrefix() }
   }));
 
@@ -699,6 +702,7 @@ void CCionStubBodyGen::GenInterfaceBase(std::ofstream& stream,
       { "<SERVER_FOREACH_CONNECTED_PEER_INFO>", GetTransportable().C().GenServerForeachConnectedPeerInfo(iface.GetID()) },
       { "<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix() },
       { "<MODULE_PREFIX>", GetMoudlePrefix() },
+      { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
       { "<PREFIX>", GetHandlePrefix() }
   }));
 
index b72fefeb45ecfee4f45a491a30b448bab735c742..bb9837bd04a74cb371989f335f4277935ae3d84d 100644 (file)
@@ -17,7 +17,9 @@
 #include <ctime>
 #include <vector>
 #include <utility>
+#include <algorithm>
 
+#include "idlc/options.h"
 #include "idlc/gen_cion/cpp_cion_gen_base.h"
 
 namespace {
@@ -595,7 +597,7 @@ std::string CppCionGeneratorBase::ConvertTypeToDeserializer(
       ret += n + " ";
       if (IsDelegateType(type)) {
         ret += id + "(new " + type.ToString()
-            + "(std::weak_ptr<ServiceBase>(b), stub->cion_server_));\n";
+            + "(std::weak_ptr<ServiceBase>(b), stub->server_));\n";
       } else {
         ret += id + ";\n";
       }
@@ -631,8 +633,10 @@ void CppCionGeneratorBase::GenBodyCallback(std::ofstream& stream,
     GenTemplate(std::string(ReplaceAll(CB_CALLBACK_FILE_PAYLOAD_SEND, {
             { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
             { "<FILE_PAYLOAD_SEND>", GetTransportable().Cpp()
-                .GenServerFileSend("path", "cion_server_", "peer") },
-            { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() }
+                .GenServerFileSend("path", "server_", "peer") },
+            { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
+            { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         })),
         stream,
       [&]()->std::string {
@@ -644,7 +648,9 @@ void CppCionGeneratorBase::GenBodyCallback(std::ofstream& stream,
     GenTemplate(std::string(ReplaceAll(CB_CALLBACK_INVOKE_METHOD, {
             { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
             { "<SERVER_SEND_ASYNC>", GetTransportable().Cpp()
-                .GenServerSendAsync("cion_server_", "", "pl", "size") }
+                .GenServerSendAsync("server_", "", "pl", "size") },
+            { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         })), stream,
       [&]()->std::string {
         return iface.GetID();
@@ -750,6 +756,8 @@ void CppCionGeneratorBase::GenHeaderCallback(std::ofstream& stream,
       })
       .Change("<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType())
       .Change("<SERVER_T>", GetTransportable().Cpp().GenServerType())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Out(stream);
 }
 
@@ -771,6 +779,46 @@ std::string CppCionGeneratorBase::GenSecurity(const Interface& iface) {
   return security_path;
 }
 
+std::string CppCionGeneratorBase::GetMoudlePrefix() {
+  std::string prefix = GetTransportable().Cpp().GenModulePrefix();
+
+  if (!HasNamespace() || !IsGeneratedAPI())
+    return prefix;
+
+  return prefix + "_" + GetFileNamespace();
+}
+
+std::string CppCionGeneratorBase::GetInternalHandlePrefix() {
+  std::string prefix = GetHandlePrefix();
+
+  if (!HasNamespace())
+    return prefix;
+
+  return prefix + "_internal";
+}
+
+std::string CppCionGeneratorBase::GetHandlePrefix() {
+  std::string prefix;
+  switch(static_cast<tidl::Options::Type>(GetType())) {
+  case tidl::Options::Type::TYPE_STUB:
+    prefix = GetTransportable().Cpp().GenStubPrefix();
+    break;
+  case tidl::Options::Type::TYPE_PROXY:
+    prefix = GetTransportable().Cpp().GenProxyPrefix();
+    break;
+  case tidl::Options::Type::TYPE_GROUP:
+    prefix = GetTransportable().Cpp().GenGroupPrefix();
+    break;
+  default:
+    break;
+  }
+
+  if (!HasNamespace())
+    return prefix;
+
+  return prefix + "_" + GetFileNamespace();
+}
+
 void CppCionGeneratorBase::GenVersion(std::ofstream& stream) {
   GenTemplate(CB_VERSION, stream,
     [&]()->std::string {
@@ -779,14 +827,88 @@ void CppCionGeneratorBase::GenVersion(std::ofstream& stream) {
 }
 
 void CppCionGeneratorBase::GenLogTag(std::ofstream& stream, std::string id) {
-  GenTemplate(CB_LOG_TAG, stream,
-      [&]()->std::string {
-        return id;
-      });
+  std::string tag = std::move(id);
+  std::transform(tag.begin(), tag.end(), tag.begin(), ::toupper);
+  std::string code(ReplaceAll(CB_LOG_TAG, "<LOG_TAG>", tag));
+  stream << code;
 }
 
 void CppCionGeneratorBase::GenLogDefinition(std::ofstream& stream) {
   stream << CB_LOG_DEF;
 }
 
+void CppCionGeneratorBase::GenCommonBase(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderBase())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenCommonHandles(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderCommonHandle())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenClientHandles(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderClientHandle())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenServerHandles(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderServerHandle())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenGroupHandles(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderGroupHandle())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenFileHandle(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderPayloadHandle())
+      .Change("<ERROR_PREFIX>", GetTransportable().C().GenErrorPrefix())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenFileBase(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderPayloadBase())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenConnectionHandle(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderConnectionHandle())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenConnectionBase(std::ofstream& stream) {
+  ReplaceAll(GetTransportable().Cpp().GenHeaderConnectionBase())
+      .Change("<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Out(stream);
+}
+
+void CppCionGeneratorBase::GenCommonFunctions(std::ofstream& stream) {
+  std::string code = GetTransportable().Cpp().GenBodyPeerInfoBase();
+  if(GetType() != 3) {
+    code += GetTransportable().Cpp().GenBodyConnectionBase();
+    code += GetTransportable().Cpp().GenBodyPayloadBase();
+  }
+
+  ReplaceAll(code,"<PREFIX>", GetHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Out(stream);
+}
+
 }  // namespace tidl
index 166de85329051aa6e36bdd5ad51a25461925a9aa..d7ba76bea2d7321d9a06e31916c08061dda9407a 100644 (file)
@@ -62,6 +62,20 @@ class CppCionGeneratorBase : public CionPluginBase {
   std::string GetParameters(const Parameters& ps);
   void GenLogTag(std::ofstream& stream, std::string id);
   void GenLogDefinition(std::ofstream& stream);
+  std::string GetMoudlePrefix();
+  std::string GetHandlePrefix();
+  std::string GetInternalHandlePrefix();
+
+  void GenCommonBase(std::ofstream& stream);
+  void GenCommonHandles(std::ofstream& stream);
+  void GenClientHandles(std::ofstream& stream);
+  void GenServerHandles(std::ofstream& stream);
+  void GenGroupHandles(std::ofstream& stream);
+  void GenFileHandle(std::ofstream& stream);
+  void GenFileBase(std::ofstream& stream);
+  void GenConnectionHandle(std::ofstream& stream);
+  void GenConnectionBase(std::ofstream& stream);
+  void GenCommonFunctions(std::ofstream& stream);
 
  private:
   void GenSetter(std::ofstream& stream, const Element& ele);
index 160eac36279498171a78ee1dabc3deb4eac08775..e5858f6499d70c87caf5fb6aa3e8201cfad5d8f4 100644 (file)
@@ -173,10 +173,10 @@ R"__cpp_cb(
 
 const char CB_CALLBACK_CTOR_STUB[] =
 R"__cpp_cb(
-    <CLS_NAME>(std::weak_ptr<ServiceBase> service, <SERVER_T> cion_server)
+    <CLS_NAME>(std::weak_ptr<ServiceBase> service, <SERVER_T> <PREFIX>_server)
         : CallbackBase(static_cast<int>(DelegateId::<CLS_NAME>), false) {
       service_ = std::move(service);
-      cion_server_ = cion_server;
+      server_ = <PREFIX>_server;
     }
 )__cpp_cb";
 
@@ -197,7 +197,7 @@ R"__cpp_cb(
 
     std::weak_ptr<ServiceBase> service_;
     bool valid_ = true;
-    <SERVER_T> cion_server_;
+    <SERVER_T> server_;
 )__cpp_cb";
 
 const char CB_CALLBACK_FILE_PAYLOAD_SEND[] = R"__cpp_cb(
@@ -225,9 +225,9 @@ $$
   unsigned int size;
   char *data;
 
-  int cion_ret_ = rpc_port_parcel_get_raw(p, (void **)&data, &size);
-  if (cion_ret_ != RPC_PORT_ERROR_NONE) {
-      _E("Failed to get raw. error(%d)", cion_ret_);
+  int ret_ = rpc_port_parcel_get_raw(p, (void **)&data, &size);
+  if (ret_ != RPC_PORT_ERROR_NONE) {
+      _E("Failed to get raw. error(%d)", ret_);
       rpc_port_parcel_destroy(p);
       throw InvalidIOException();
   }
@@ -252,7 +252,7 @@ R"__cpp_cb(
 #undef LOG_TAG
 #endif
 
-#define LOG_TAG "$$"
+#define LOG_TAG "<LOG_TAG>"
 )__cpp_cb";
 
 const char CB_LOG_DEF[] =
index 5b7140806cf251be541c4baaea8d5d589a2c7664..d0c57e67add2f3ad51184ddc719bdeafc78fc5d5 100644 (file)
@@ -39,11 +39,17 @@ void CppCionGroupBodyGen::OnInitGen(std::ofstream& stream) {
   stream << "#include <stdlib.h>" << NLine(1)
          << "#include <assert.h>" << NLine(1)
          << "#include <dlog.h>" << NLine(1)
-         <<  NLine(1)
+         << NLine(1)
+         << ReplaceAll(GetTransportable().Cpp().GenInclude(GetType()),
+                "<FILENAME>", GetFileNamespace())
+         << NLine(2)
          << "#include \"" << header_file << "\"" << NLine(2);
-  GenLogTag(stream, "CION_GROUP");
+  GenLogTag(stream, GetTransportable().Cpp().GenGroupPrefix());
   GenLogDefinition(stream);
   stream << NLine(1);
+  GenCommonFunctions(stream);
+  stream << NLine(1);
+
   GenNamespace(stream);
 }
 
@@ -51,7 +57,7 @@ void CppCionGroupBodyGen::OnFiniGen(std::ofstream& stream) {
 }
 
 void CppCionGroupBodyGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -69,7 +75,7 @@ void CppCionGroupBodyGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace rpc_port" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionGroupBodyGen::GenInterfaces(std::ofstream& stream) {
@@ -97,8 +103,10 @@ void CppCionGroupBodyGen::GenConstructor(std::ofstream& stream,
       .Change("<SET_SECURITY>", GenSecurity(iface))
       .Change("<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType())
       .Change("<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType())
-      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType())
+      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType(false))
       .Change("<GROUP_T>", GetTransportable().Cpp().GenGroupType())
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Out(stream);
 }
 
@@ -106,7 +114,8 @@ void CppCionGroupBodyGen::GenDestructor(std::ofstream& stream,
     const Interface& iface) {
   stream << ReplaceAll(CB_DTOR, {
           { "<CLS_NAME>", iface.GetID() },
-          { "<GROUP_DESTROY>", GetTransportable().Cpp().GenGroupDestroy() }
+          { "<GROUP_DESTROY>", GetTransportable().Cpp().GenGroupDestroy() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() }
       }) << NLine(1);
 }
 
@@ -122,7 +131,9 @@ void CppCionGroupBodyGen::GenCionPayloadReceivedEvent(std::ofstream& stream,
           { "<ERROR_NONE>", GetTransportable().Cpp().GenErrorNone() },
           { "<PAYLOAD_TYPE_DATA>",
               GetTransportable().Cpp().GenPayloadTypeData() },
-          { "<PAYLOAD_GET_DATA>", GetTransportable().Cpp().GenPayloadGetData() }
+          { "<PAYLOAD_GET_DATA>", GetTransportable().Cpp().GenPayloadGetData() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix()},
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix()}
       });
 
   for (const auto& i : iface.GetDeclarations()) {
@@ -197,7 +208,9 @@ void CppCionGroupBodyGen::GenInvocation(std::ofstream& stream,
            << NLine(2);
     stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, {
         { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
-        { "<GROUP_PUBLISH>", GetTransportable().Cpp().GenGroupPublish() }
+        { "<GROUP_PUBLISH>", GetTransportable().Cpp().GenGroupPublish() },
+        { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+        { "<MODULE_PREFIX>", GetMoudlePrefix() }
     }) << NLine(1);
   }, false, false);
   stream << " while (false);" << NLine(1);
index dfac993a34a56f621b546ed515b65af0116e7946..b24b6c72be38692908b0157e29cbf71ed187536e 100644 (file)
@@ -54,7 +54,7 @@ void <CLS_NAME>::OnPayloadReceivedCB(const <PEER_INFO_T> peer_info,
   int ret;
   <PAYLOAD_GET_TYPE>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_type. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_type. error(%d)", ret);
     return;
   }
 
@@ -67,7 +67,7 @@ void <CLS_NAME>::OnPayloadReceivedCB(const <PEER_INFO_T> peer_info,
   unsigned int size;
   <PAYLOAD_GET_DATA>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_data. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_data. error(%d)", ret);
     return;
   }
 
@@ -93,7 +93,9 @@ R"__cpp_cb(
 
 const char CB_GROUP_INTERFACE_CTOR[] =
 R"__cpp_cb(
-<CLS_NAME>::<CLS_NAME>(std::string topic) : topic_name_(std::move(topic)) {
+<CLS_NAME>::<CLS_NAME>(std::string topic, const std::string broker_ip, int broker_port,
+    const std::string user_name, const std::string password, const std::string my_ip,
+    int protocols) : topic_name_(std::move(topic)) {
   <GROUP_CREATE>
 }
 )__cpp_cb";
index 6cb9ff01b4dbd91fd02978701fced13cbf153713..189dae485e9ac433071a10ba645e6c727ea65108 100644 (file)
@@ -27,7 +27,14 @@ CppCionGroupHeaderGen::CppCionGroupHeaderGen(std::shared_ptr<Document> doc, std:
 
 void CppCionGroupHeaderGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
+
   stream << CB_HEADER;
+
+  GenCommonHandles(stream);
+  GenGroupHandles(stream);
+  GenFileHandle(stream);
+  GenConnectionHandle(stream);
+  GenCommonBase(stream);
   GenNamespace(stream);
 }
 
@@ -35,7 +42,7 @@ void CppCionGroupHeaderGen::OnFiniGen(std::ofstream& stream) {
 }
 
 void CppCionGroupHeaderGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -50,7 +57,7 @@ void CppCionGroupHeaderGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace cion" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionGroupHeaderGen::GenExceptions(std::ofstream& stream) {
@@ -74,7 +81,8 @@ void CppCionGroupHeaderGen::GenInterface(std::ofstream& stream,
     stream << " public:" << NLine(1);
     stream << ReplaceAll(CB_PUBLIC_MEMBERS, {
             { "<CLS_NAME>", iface.GetID() },
-            { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() }
+            { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         })
            << NLine(1);
     GenMethods(stream, iface);
@@ -84,8 +92,10 @@ void CppCionGroupHeaderGen::GenInterface(std::ofstream& stream,
     stream << ReplaceAll(CB_PRIVATE_MEMBERS, {
             { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
             { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
-            { "<CLIENT_T>", GetTransportable().Cpp().GenClientType() },
-            { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() }
+            { "<GROUP_T>", GetTransportable().Cpp().GenGroupType() },
+            { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() },
+            { "<PREFIX>", GetHandlePrefix() },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         });
   }, false, false);
   stream << ";" << NLine(1);
@@ -109,8 +119,10 @@ void CppCionGroupHeaderGen::GenMethodHandlers(std::ofstream& stream,
 
   for (const auto& i : decls) {
     stream << Tab(1) << "virtual " << ConvertTypeToString(i->GetType()) << " On"
-           << i->GetID() << ReplaceAll("(const <PEER_INFO_T> peer_info, ",
-              "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType());
+           << i->GetID() << ReplaceAll("(const <PEER_INFO_T> peer_info, ", {
+             { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
+             { "<MODULE_PREFIX>", GetMoudlePrefix() }
+        });
     GenParameters(stream, i->GetParameters());
     stream << ") = 0;" << NLine(1);
   }
index 7382e6de73eca55ac3c9b58642c32b3ecd2e6936..a51d0fef4e8e035d5a39be844ce1c2a789fc0d2f 100644 (file)
@@ -39,7 +39,9 @@ R"__cpp_cb(  /// <summary>
   /// <exception cref="InvalidIOException">
   /// Thrown when internal I/O error happen.
   /// </exception>
-  explicit <CLS_NAME>(std::string topic_name);
+  explicit <CLS_NAME>(std::string topic_name, const std::string broker_ip, int broker_port,
+    const std::string user_name, const std::string password, const std::string my_ip,
+    int protocols);
 
   /// <summary>
   /// Destructor for this class
@@ -61,8 +63,8 @@ R"__cpp_cb(  /// <summary>
 const char CB_PRIVATE_MEMBERS[] =
 R"__cpp_cb(  void OnPayloadReceivedCB(const <PEER_INFO_T> peer_info,
       const <PAYLOAD_T> payload);
-  <CLIENT_T> cion_group_ = nullptr;
-  <SECURITY_T> cion_security_ = nullptr;
+  <GROUP_T> group_ = nullptr;
+  <SECURITY_T>
   std::string topic_name_;
   std::recursive_mutex mutex_;
 )__cpp_cb";
@@ -71,7 +73,6 @@ const char CB_HEADER[] =
 R"__cpp_cb(
 #pragma once
 
-#include <cion.h>
 #include <rpc-port-parcel.h>
 
 #include <atomic>
index 2de06d2cc462ff17a9819a4bb1c9cbfe9f8acde6..6c5846b2d4a4e38a7d6efc0926366c8d47b9e20e 100644 (file)
@@ -38,11 +38,17 @@ void CppCionProxyBodyGen::OnInitGen(std::ofstream& stream) {
   stream << "#include <stdlib.h>" << NLine(1)
          << "#include <assert.h>" << NLine(1)
          << "#include <dlog.h>" << NLine(1)
-         <<  NLine(1)
+         << NLine(1)
+         << ReplaceAll(GetTransportable().Cpp().GenInclude(GetType()),
+                "<FILENAME>", GetFileNamespace())
+         << NLine(2)
          << "#include \"" << header_file << "\"" << NLine(2);
-  GenLogTag(stream, "CION_PROXY");
+  GenLogTag(stream, GetTransportable().Cpp().GenProxyPrefix());
   GenLogDefinition(stream);
   stream << NLine(1);
+  GenCommonFunctions(stream);
+  stream << NLine(1);
+
   GenNamespace(stream);
 }
 
@@ -50,7 +56,7 @@ void CppCionProxyBodyGen::OnFiniGen(std::ofstream& stream) {
 }
 
 void CppCionProxyBodyGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -68,7 +74,7 @@ void CppCionProxyBodyGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace rpc_port" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionProxyBodyGen::GenInterfaces(std::ofstream& stream) {
@@ -93,11 +99,13 @@ void CppCionProxyBodyGen::GenInterface(std::ofstream& stream,
 void CppCionProxyBodyGen::GenConstructor(std::ofstream& stream,
                                      const Interface& iface) {
   ReplaceAll(CB_PROXY_INTERFACE_CTOR)
-      .Change("$$", iface.GetID())
       .Change("<CLIENT_CREATE>", GetTransportable().Cpp().GenClientCreate())
+      .Change("$$", iface.GetID())
       .Change("<SET_SECURITY>", GenSecurity(iface))
       .Change("<CLIENT_T>", GetTransportable().Cpp().GenClientType())
-      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType())
+      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType(false))
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Out(stream);
 }
 
@@ -106,7 +114,9 @@ void CppCionProxyBodyGen::GenDestructor(std::ofstream& stream,
   GenTemplate(std::string(ReplaceAll(CB_DTOR, {
           { "<PEER_INFO_DESTROY>",
               GetTransportable().Cpp().GenPeerInfoDestroy("peer_") },
-          { "<CLIENT_DESTROY>", GetTransportable().Cpp().GenClientDestroy() }
+          { "<CLIENT_DESTROY>", GetTransportable().Cpp().GenClientDestroy() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() }
       })), stream,
     [&]()->std::string {
       return iface.GetID();
@@ -118,21 +128,24 @@ void CppCionProxyBodyGen::GenDestructor(std::ofstream& stream,
 
 void CppCionProxyBodyGen::GenHelperMethods(std::ofstream& stream,
                                        const Interface& iface) {
+  std::string client = "client_";
   stream << ReplaceAll(CB_PROXY_HELPER_METHODS, {
           { "##", iface.GetID() },
           { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
           { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
           { "<PAYLOAD_TRANSFER_STATUS_T>",
-              GetTransportable().Cpp().GenPayloadTransferStatusType() },
+              GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
+          { "<PAYLOAD_ASYNC_RESULT_T>",
+              GetTransportable().Cpp().GenPayloadAsyncResultType() },
           { "<CLIENT_TRY_CONNECT>",
               GetTransportable().Cpp().GenClientTryConnect(
-                  "cion_client_", "peer_") },
+                  client , "peer_") },
           { "<CLIENT_DISCONNECT>", GetTransportable().Cpp()
-              .GenClientDisconnect("cion_client_") },
+              .GenClientDisconnect(client) },
           { "<CLIENT_TRY_DISCOVERY>", GetTransportable().Cpp()
-              .GenClientTryDiscovery("cion_client_") },
+              .GenClientTryDiscovery(client) },
           { "<CLIENT_STOP_DISCOVERY>", GetTransportable().Cpp()
-              .GenClientStopDiscovery("cion_client_") },
+              .GenClientStopDiscovery(client) },
           { "<PAYLOAD_TYPE_E>", GetTransportable().Cpp().GenPayloadTypeEnum() },
           { "<PAYLOAD_GET_TYPE>",
               GetTransportable().Cpp().GenPayloadGetType() },
@@ -146,7 +159,14 @@ void CppCionProxyBodyGen::GenHelperMethods(std::ofstream& stream,
           { "<PEER_INFO_CLONE>", GetTransportable().Cpp()
               .GenPeerInfoClone("peer_info", "&cl->peer_") },
           { "<PEER_INFO_GET_APPID>", GetTransportable().Cpp()
-              .GenPeerInfoGetAppID("peer_info", "&app_id") }
+              .GenPeerInfoGetAppID("peer_info", "&app_id") },
+          { "<PREFIX>", GetHandlePrefix() },
+          { "<ERROR_PREFIX>", GetTransportable().Cpp()
+              .GenErrorPrefix() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix()},
+          { "<CONNECTION_RESULT_PREFIX>", GetTransportable().Cpp()
+              .GenConnectionResultPrefix() }
       }) << NLine(1);
 }
 
@@ -185,8 +205,10 @@ void CppCionProxyBodyGen::GenFilePayloadSend(std::ofstream& stream,
     const Interface& iface) {
   GenTemplate(std::string(ReplaceAll(CB_PROXY_FILE_PAYLOAD_SEND, {
           { "<FILE_PAYLOAD_SEND>", GetTransportable().Cpp()
-              .GenClientFileSend("path", "cion_client_") },
-          { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() }
+              .GenClientFileSend("path", "client_") },
+          { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() }
       })), stream,
     [&]()->std::string {
       return iface.GetID();
@@ -225,15 +247,20 @@ void CppCionProxyBodyGen::GenInvocation(std::ofstream& stream,
     if (!l.empty())
       stream << AddIndent(TAB_SIZE * 2, l);
     if (decl.GetMethodType() == Declaration::MethodType::SYNC)
-      stream << ReplaceAll(CB_INVOCATION_SYNC_MID, "<CLIENT_SEND>",
-          GetTransportable().Cpp().GenClientSend("cion_client_", "data",
-              "size", "return_data", "return_data_size")) << NLine(1);
+      stream << ReplaceAll(CB_INVOCATION_SYNC_MID, {
+              { "<CLIENT_SEND>",
+                    GetTransportable().Cpp().GenClientSend("client_", "data",
+                  "size", "return_data", "return_data_size") },
+              { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() }
+          }) << NLine(1);
     else if (decl.GetMethodType() == Declaration::MethodType::ASYNC)
       stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, {
               { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
               { "<CLIENT_SEND_ASYNC>",
                   GetTransportable().Cpp().GenClientSendAsync(
-                      "cion_client_", "pl", "size") }
+                      "client_", "pl", "size") },
+              { "<MODULE_PREFIX>", GetMoudlePrefix() },
+              { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() }
           }) << NLine(1);
   }, false, false);
   stream << " while (false);" << NLine(1);
index c3fd274280975939e308d129efd8be3a1e48bee3..9356be5f0b4d4ce375966c6655c9d44553c30db4 100644 (file)
@@ -152,19 +152,19 @@ void ##::StopDiscovery() {
 }
 
 void ##::OnConnectionResultCB(const char *service_name,
-      const <PEER_INFO_T> peer_info, const cion_connection_result_h result,
+      const <PEER_INFO_T> peer_info, const <MODULE_PREFIX>_connection_result_h result,
       void *user_data) {
   ## *cl = static_cast<##*>(user_data);
-  cion_connection_status_e status;
-  int ret = cion_connection_result_get_status(result, &status);
-  if (ret != CION_ERROR_NONE) {
-    _E("Failed to cion_connection_result_get_status. error(%d)", ret);
+  <MODULE_PREFIX>_connection_status_e status;
+  int ret = <MODULE_PREFIX>_connection_result_get_status(result, &status);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("Failed to <MODULE_PREFIX>_connection_result_get_status. error(%d)", ret);
     return;
   }
 
-  if (status == CION_CONNECTION_STATUS_OK)
+  if (static_cast<int>(status) == <CONNECTION_RESULT_PREFIX>CONNECTION_STATUS_OK)
     cl->listener_->OnConnected();
-  else if (status == CION_CONNECTION_STATUS_REJECTED)
+  else if (static_cast<int>(status) == <CONNECTION_RESULT_PREFIX>CONNECTION_STATUS_REJECTED)
     cl->listener_->OnRejected();
 }
 
@@ -180,8 +180,8 @@ void ##::OnDiscoveredCB(const char *service_name,
   ## *cl = static_cast<##*>(user_data);
   char *app_id;
   int ret = <PEER_INFO_GET_APPID>
-  if (ret != CION_ERROR_NONE) {
-    _E("Failed to cion_peer_info_get_app_id. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_peer_info_get_app_id. error(%d)", ret);
     return;
   }
 
@@ -189,8 +189,8 @@ void ##::OnDiscoveredCB(const char *service_name,
       app_id, std::free);
   if (std::string(app_id) == cl->target_appid_) {
     ret = <PEER_INFO_CLONE>
-    if (ret != CION_ERROR_NONE) {
-      _E("Failed to cion_peer_info_clone. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("Failed to <INTERNAL_PREFIX>_peer_info_clone. error(%d)", ret);
       return;
     }
 
@@ -198,7 +198,7 @@ void ##::OnDiscoveredCB(const char *service_name,
   }
 }
 
-void ##::OnPayloadAsyncResultCB(const cion_payload_async_result_h result,
+void ##::OnPayloadAsyncResultCB(const <PAYLOAD_ASYNC_RESULT_T> result,
     void* user_data) {
 }
 
@@ -209,8 +209,8 @@ void ##::OnPayloadReceivedCB(const char *service_name,
   ## *cl = static_cast<##*>(user_data);
   char *app_id;
   int ret = <PEER_INFO_GET_APPID>
-  if (ret != CION_ERROR_NONE) {
-    _E("Failed to cion_peer_info_get_app_id. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_peer_info_get_app_id. error(%d)", ret);
     return;
   }
 
@@ -224,7 +224,7 @@ void ##::OnPayloadReceivedCB(const char *service_name,
   <PAYLOAD_TYPE_E> type;
   <PAYLOAD_GET_TYPE>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_type. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_type. error(%d)", ret);
     return;
   }
 
@@ -237,7 +237,7 @@ void ##::OnPayloadReceivedCB(const char *service_name,
   unsigned int size;
   <PAYLOAD_GET_DATA>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_data. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_data. error(%d)", ret);
     return;
   }
 
@@ -259,7 +259,9 @@ void ##::OnPayloadReceivedCB(const char *service_name,
 const char CB_PROXY_INTERFACE_CTOR[] =
 R"__cpp_cb(
 $$::$$(IEventListener* listener, const std::string& service_name,
-    const std::string& target_appid)
+    const std::string& target_appid, const std::string& broker_ip, int broker_port,
+    const std::string& user_name, const std::string& password, const std::string& my_ip,
+    int protocols)
     : listener_(listener), service_name_(service_name),
     target_appid_(target_appid) {
   <CLIENT_CREATE>
index c23071fab768a5dd7c794783b39a879a6dc3305d..397c1c2d1401dade604a1c51caa2294ca5169fa8 100644 (file)
@@ -28,7 +28,15 @@ CppCionProxyHeaderGen::CppCionProxyHeaderGen(std::shared_ptr<Document> doc,
 
 void CppCionProxyHeaderGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
+
   stream << CB_HEADER;
+
+  GenCommonHandles(stream);
+  GenClientHandles(stream);
+  GenFileHandle(stream);
+  GenConnectionHandle(stream);
+  GenCommonBase(stream);
+  GenFileBase(stream);
   GenNamespace(stream);
 }
 
@@ -36,7 +44,7 @@ void CppCionProxyHeaderGen::OnFiniGen(std::ofstream& stream) {
 }
 
 void CppCionProxyHeaderGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -51,7 +59,7 @@ void CppCionProxyHeaderGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace cion" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionProxyHeaderGen::GenExceptions(std::ofstream& stream) {
@@ -77,7 +85,8 @@ void CppCionProxyHeaderGen::GenInterface(std::ofstream& stream,
             { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
             { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
             { "<PAYLOAD_TRANSFER_STATUS_T>",
-                GetTransportable().Cpp().GenPayloadTransferStatusType() }
+                GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         })), stream,
       [&]()->std::string {
         return iface.GetID();
@@ -94,8 +103,12 @@ void CppCionProxyHeaderGen::GenInterface(std::ofstream& stream,
             { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
             { "<CLIENT_T>", GetTransportable().Cpp().GenClientType() },
             { "<PAYLOAD_TRANSFER_STATUS_T>",
-                GetTransportable().Cpp().GenPayloadTransferStatusType() },
-            { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() }
+                GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
+            { "<PAYLOAD_ASYNC_RESULT_T>",
+                GetTransportable().Cpp().GenPayloadAsyncResultType() },
+            { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() },
+            { "<PREFIX>", GetHandlePrefix() },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() }
         });
   }, false, false);
   stream << ";" << NLine(1);
index 02281abae21005d735850e8f9202014b2ecfd352..965680b53854a2200abce78099ff36e03c78c901 100644 (file)
@@ -67,7 +67,9 @@ R"__cpp_cb(
   /// Thrown when internal I/O error happen.
   /// </exception>
   explicit $$(IEventListener* listener, const std::string& service_name,
-      const std::string& target_appid);
+      const std::string& target_appid, const std::string& broker_ip, int broker_port,
+    const std::string& user_name, const std::string& password, const std::string& my_ip,
+    int protocols);
 
   /// <summary>
   /// Destructor for this class
@@ -99,7 +101,7 @@ R"__cpp_cb(
   void Disconnect();
 
   /// <summary>
-  /// Tries to discover a Cion server.
+  /// Tries to discover a server.
   /// </summary>
   /// <privilege>http://tizen.org/privilege/d2d.datasharing</privilege>
   /// <privilege>http://tizen.org/privilege/internet</privilege>
@@ -128,21 +130,21 @@ R"__cpp_cb(  void ProcessReceivedEvent(rpc_port_parcel_h parcel);
   void FilePayloadSend(std::string path);
 
   static void OnConnectionResultCB(const char *service_name,
-      const <PEER_INFO_T> peer_info, const cion_connection_result_h result,
+      const <PEER_INFO_T> peer_info, const <MODULE_PREFIX>_connection_result_h result,
       void *user_data);
   static void OnDisconnectedCB(const char *service_name,
       const <PEER_INFO_T> peer_info, void *user_data);
   static void OnDiscoveredCB(const char *service_name,
       const <PEER_INFO_T> peer_info, void *user_data);
-  static void OnPayloadAsyncResultCB(const cion_payload_async_result_h result,
+  static void OnPayloadAsyncResultCB(const <PAYLOAD_ASYNC_RESULT_T> result,
       void *user_data);
   static void OnPayloadReceivedCB(const char *service_name,
       const <PEER_INFO_T> peer_info, const <PAYLOAD_T> payload,
       <PAYLOAD_TRANSFER_STATUS_T> status,
       void *user_data);
 
-  <CLIENT_T> cion_client_ = nullptr;
-  <SECURITY_T> cion_security_ = nullptr;
+  <CLIENT_T> client_ = nullptr;
+  <SECURITY_T>
   <PEER_INFO_T> peer_ = nullptr;
   IEventListener* listener_;
   std::string service_name_;
@@ -155,7 +157,6 @@ const char CB_HEADER[] =
 R"__cpp_cb(
 #pragma once
 
-#include <cion.h>
 #include <rpc-port-parcel.h>
 
 #include <string>
index 34c1b516eb215571eb532a0e3ff41248c865bfe4..474d5515ffe6aad5e1746beaac17fce135c3d01e 100644 (file)
@@ -41,17 +41,23 @@ void CppCionStubBodyGen::OnInitGen(std::ofstream& stream) {
          << "#include <libgen.h>" << NLine(1)
          << "#include <dlog.h>" << NLine(1)
          << NLine(1)
+         << ReplaceAll(GetTransportable().Cpp().GenInclude(GetType()),
+                "<FILENAME>", GetFileNamespace())
+         << NLine(2)
          << "#include \"" << header_file << "\"" << NLine(2);
-  GenLogTag(stream, "CION_STUB");
+  GenLogTag(stream, GetTransportable().Cpp().GenStubPrefix());
   GenLogDefinition(stream);
   stream << NLine(1);
+  GenCommonFunctions(stream);
+  stream << NLine(1);
+
   GenNamespace(stream);
 }
 
 void CppCionStubBodyGen::OnFiniGen(std::ofstream& stream) {}
 
 void CppCionStubBodyGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -69,7 +75,7 @@ void CppCionStubBodyGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace cion" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionStubBodyGen::GenInterfaces(std::ofstream& stream) {
@@ -96,7 +102,11 @@ void CppCionStubBodyGen::GenServiceBase(std::ofstream& stream,
   GenTemplate(std::string(ReplaceAll(CB_CTOR_SERVICE_BASE, {
           { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
           { "<PEER_INFO_CLONE>", GetTransportable().Cpp()
-              .GenPeerInfoClone("peer", "&peer_") }
+              .GenPeerInfoClone("peer", "&peer_") },
+          { "<ERROR_PREFIX>", GetTransportable().Cpp()
+              .GenErrorPrefix() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() }
       })), stream,
     [&]()->std::string {
       return iface.GetID();
@@ -107,11 +117,13 @@ void CppCionStubBodyGen::GenServiceBase(std::ofstream& stream,
 void CppCionStubBodyGen::GenConstructor(std::ofstream& stream,
                                     const Interface& iface) {
   ReplaceAll(CB_CTOR_FRONT)
-      .Change("##", iface.GetID())
       .Change("<SERVER_REGISTER>", GetTransportable().Cpp().GenServerRegister())
+      .Change("##", iface.GetID())
       .Change("<SET_SECURITY>", GenSecurity(iface))
       .Change("<SERVER_T>", GetTransportable().Cpp().GenServerType())
-      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType())
+      .Change("<SECURITY_T>", GetTransportable().Cpp().GenSecurityType(false))
+      .Change("<INTERNAL_PREFIX>", GetInternalHandlePrefix())
+      .Change("<MODULE_PREFIX>", GetMoudlePrefix())
       .Out(stream);
 }
 
@@ -137,7 +149,7 @@ void CppCionStubBodyGen::GenDefaultMethods(std::ofstream& stream,
           { "<SERVER_LISTEN>",
               GetTransportable().Cpp().GenServerListen() },
           { "<SERVER_DISCONNECT>", GetTransportable().Cpp()
-              .GenServerDisconnect("cion_server_", "p") },
+              .GenServerDisconnect("server_", "p") },
           { "<PEER_INFO_GET_APPID1>", GetTransportable().Cpp()
               .GenPeerInfoGetAppID("peer_info", "&peer_app_id") },
           { "<PEER_INFO_GET_APPID2>", GetTransportable().Cpp()
@@ -145,7 +157,12 @@ void CppCionStubBodyGen::GenDefaultMethods(std::ofstream& stream,
           { "<PEER_INFO_GET_UUID1>", GetTransportable().Cpp()
               .GenPeerInfoGetUUID("peer_info", "&peer_uuid") },
           { "<PEER_INFO_GET_UUID2>", GetTransportable().Cpp()
-              .GenPeerInfoGetUUID("s->get()->GetPeer()", "&service_uuid") }
+              .GenPeerInfoGetUUID("s->get()->GetPeer()", "&service_uuid") },
+          { "<PREFIX>", GetHandlePrefix() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+          { "<ERROR_PREFIX>", GetTransportable().Cpp()
+              .GenErrorPrefix() }
       });
 }
 
@@ -166,7 +183,11 @@ void CppCionStubBodyGen::GenCionDataReceivedEvent(std::ofstream& stream,
             { "<PEER_INFO_GET_UUID1>", GetTransportable().Cpp()
                 .GenPeerInfoGetUUID("peer_info", "&peer_uuid") },
             { "<PEER_INFO_GET_UUID2>", GetTransportable().Cpp()
-                .GenPeerInfoGetUUID("s->GetPeer()", "&service_uuid") }
+                .GenPeerInfoGetUUID("s->GetPeer()", "&service_uuid") },
+            { "<MODULE_PREFIX>", GetMoudlePrefix() },
+            { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+            { "<ERROR_PREFIX>", GetTransportable().Cpp()
+              .GenErrorPrefix() }
         })), stream,
       [&]()->std::string {
       return iface.GetID();
@@ -213,7 +234,7 @@ void CppCionStubBodyGen::GenCionPayloadReceivedEvent(std::ofstream& stream,
           { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
           { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
           { "<PAYLOAD_TRANSFER_STATUS_T>",
-              GetTransportable().Cpp().GenPayloadTransferStatusType() },
+              GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
           { "<PAYLOAD_TYPE_E>", GetTransportable().Cpp().GenPayloadTypeEnum() },
           { "<PAYLOAD_GET_TYPE>",
               GetTransportable().Cpp().GenPayloadGetType() },
@@ -231,7 +252,11 @@ void CppCionStubBodyGen::GenCionPayloadReceivedEvent(std::ofstream& stream,
           { "<PEER_INFO_GET_UUID1>", GetTransportable().Cpp()
               .GenPeerInfoGetUUID("peer_info", "&peer_uuid") },
           { "<PEER_INFO_GET_UUID2>", GetTransportable().Cpp()
-              .GenPeerInfoGetUUID("s->GetPeer()", "&service_uuid") }
+              .GenPeerInfoGetUUID("s->GetPeer()", "&service_uuid") },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+          { "<ERROR_PREFIX>", GetTransportable().Cpp()
+              .GenErrorPrefix() }
       })), stream,
     [&]()->std::string {
       return iface.GetID();
@@ -358,9 +383,11 @@ void CppCionStubBodyGen::GenFilePayloadSend(std::ofstream& stream,
     const Interface& iface) {
   GenTemplate(std::string(ReplaceAll(CB_FILE_PAYLOAD_SEND, {
           { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
-            { "<FILE_PAYLOAD_SEND>", GetTransportable().Cpp()
-                .GenServerFileSend("path", "cion_server_", "peer") },
-          { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() }
+          { "<FILE_PAYLOAD_SEND>", GetTransportable().Cpp()
+                .GenServerFileSend("path", "server_", "peer") },
+          { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
+          { "<INTERNAL_PREFIX>", GetInternalHandlePrefix() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() }
       })), stream,
     [&]()->std::string {
       return iface.GetID();
index 84c5b586780abcbed98b6ff290b449b2de8c5327..fcf421ceb96d0893fe10876fab17fbdf46de41fa 100644 (file)
@@ -19,7 +19,9 @@
 
 const char CB_CTOR_FRONT[] =
 R"__cpp_cb(
-##::##(const std::string& service_name, const std::string& display_name) {
+##::##(const std::string& service_name, const std::string& display_name,
+    const std::string& broker_ip, int broker_port, const std::string& user_name,
+    const std::string& password, const std::string& my_ip, int protocols) {
   <SERVER_REGISTER>
 }
 )__cpp_cb";
@@ -60,7 +62,7 @@ void ##::SetOndemandLaunchEnable(bool enabled) {
 }
 
 void ##::OnConnectionResultCB(const char *service_name,
-      const <PEER_INFO_T> peer_info, const cion_connection_result_h result,
+      const <PEER_INFO_T> peer_info, const <MODULE_PREFIX>_connection_result_h result,
       void *user_data) {
 }
 
@@ -69,16 +71,16 @@ void ##::OnDisconnectedCB(const char *service_name,
   ##* stub = static_cast<##*>(user_data);
   char* peer_app_id = nullptr;
   int ret = <PEER_INFO_GET_APPID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
     return;
   }
   auto perr_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
 
   char* peer_uuid = nullptr;
   ret = <PEER_INFO_GET_UUID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
     return;
   }
   auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
@@ -86,16 +88,16 @@ void ##::OnDisconnectedCB(const char *service_name,
   for (auto s = stub->services_.begin(); s != stub->services_.end(); s++) {
     char* service_app_id = nullptr;
     ret = <PEER_INFO_GET_APPID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
       return;
     }
     auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
 
     char* service_uuid = nullptr;;
     ret = <PEER_INFO_GET_UUID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
       return;
     }
     auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
@@ -213,8 +215,8 @@ const char CB_CTOR_SERVICE_BASE[] =
 R"__cpp_cb($$::ServiceBase::ServiceBase(<PEER_INFO_T> peer)
     : active_object_(new ActiveObject()) {
   int ret = <PEER_INFO_CLONE>
-  if (ret != CION_ERROR_NONE) {
-    _E("Failed to cion_peer_info_clone. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("Failed to <INTERNAL_PREFIX>_peer_info_clone. error(%d)", ret);
     return;
   }
 })__cpp_cb";
@@ -238,16 +240,16 @@ void $$::OnPayloadReceivedCB(const char *service_name,
   rpc_port_parcel_h p;
   char* peer_app_id = nullptr;
   int ret = <PEER_INFO_GET_APPID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
     return;
   }
   auto peer_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
 
   char* peer_uuid = nullptr;;
   ret = <PEER_INFO_GET_UUID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
     return;
   }
   auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
@@ -255,16 +257,16 @@ void $$::OnPayloadReceivedCB(const char *service_name,
   for (auto& s : stub->services_) {
     char* service_app_id = nullptr;
     ret = <PEER_INFO_GET_APPID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
       return;
     }
     auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
 
     char* service_uuid = nullptr;
     ret = <PEER_INFO_GET_UUID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
       return;
     }
     auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
@@ -284,7 +286,7 @@ void $$::OnPayloadReceivedCB(const char *service_name,
   <PAYLOAD_TYPE_E> type;
   <PAYLOAD_GET_TYPE>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_type. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_type. error(%d)", ret);
     return;
   }
 
@@ -297,7 +299,7 @@ void $$::OnPayloadReceivedCB(const char *service_name,
   unsigned int size;
   <PAYLOAD_GET_DATA>
   if (ret != <ERROR_NONE>) {
-    _E("Failed to cion_payload_get_data. error(%d)", ret);
+    _E("Failed to <INTERNAL_PREFIX>_payload_get_data. error(%d)", ret);
     return;
   }
 
@@ -335,16 +337,16 @@ void $$::OnDataReceivedCB(const char *service_name,
   rpc_port_parcel_h p;
   char* peer_app_id = nullptr;
   int ret = <PEER_INFO_GET_APPID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
     return;
   }
   auto peer_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(peer_app_id, std::free);
 
   char* peer_uuid = nullptr;
   ret = <PEER_INFO_GET_UUID1>
-  if (ret != CION_ERROR_NONE) {
-    _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+  if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+    _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
     return;
   }
   auto peer_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(peer_uuid, std::free);
@@ -352,16 +354,16 @@ void $$::OnDataReceivedCB(const char *service_name,
   for (auto& s : stub->services_) {
     char* service_app_id = nullptr;
     ret = <PEER_INFO_GET_APPID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_app_id() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_app_id() is failed. error(%d)", ret);
       return;
     }
     auto service_app_id_auto = std::unique_ptr<char, decltype(std::free)*>(service_app_id, std::free);
 
     char* service_uuid = nullptr;
     ret = <PEER_INFO_GET_UUID2>
-    if (ret != CION_ERROR_NONE) {
-      _E("cion_peer_info_get_uuid() is failed. error(%d)", ret);
+    if (ret != <ERROR_PREFIX>_ERROR_NONE) {
+      _E("<INTERNAL_PREFIX>_peer_info_get_uuid() is failed. error(%d)", ret);
       return;
     }
     auto service_uuid_auto = std::unique_ptr<char, decltype(std::free)*>(service_uuid, std::free);
index fe17b74f14e77753c2f3f78e66d7fd58498cdd3c..1edca754b3c6504e33903a459b5f67e728542914 100644 (file)
@@ -28,7 +28,15 @@ CppCionStubHeaderGen::CppCionStubHeaderGen(std::shared_ptr<Document> doc,
 
 void CppCionStubHeaderGen::OnInitGen(std::ofstream& stream) {
   GenVersion(stream);
+
   stream << CB_HEADER;
+
+  GenCommonHandles(stream);
+  GenServerHandles(stream);
+  GenFileHandle(stream);
+  GenConnectionHandle(stream);
+  GenCommonBase(stream);
+  GenFileBase(stream);
   GenNamespace(stream);
 }
 
@@ -36,7 +44,7 @@ void CppCionStubHeaderGen::OnFiniGen(std::ofstream& stream) {
 }
 
 void CppCionStubHeaderGen::GenNamespace(std::ofstream& stream) {
-  stream << "namespace cion ";
+  stream << "namespace " << GetTransportable().Cpp().GenNamespace() << " ";
   GenBrace(stream, 0, [&]() {
     stream << "namespace " << GetFileNamespace() << " ";
     GenBrace(stream, 0, [&]() {
@@ -54,7 +62,7 @@ void CppCionStubHeaderGen::GenNamespace(std::ofstream& stream) {
     }, false, false);
     stream << "  // namespace " + GetFileNamespace() + NLine(1);
   }, false, false);
-  stream << "  // namespace cion" + NLine(1);
+  stream << "  // namespace " + GetTransportable().Cpp().GenNamespace() + NLine(1);
 }
 
 void CppCionStubHeaderGen::GenExceptions(std::ofstream& stream) {
@@ -101,8 +109,10 @@ void CppCionStubHeaderGen::GenPrivate(std::ofstream& stream,
         { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
         { "<SERVER_T>", GetTransportable().Cpp().GenServerType() },
         { "<PAYLOAD_TRANSFER_STATUS_T>",
-            GetTransportable().Cpp().GenPayloadTransferStatusType() },
-        { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() }
+            GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
+        { "<SECURITY_T>", GetTransportable().Cpp().GenSecurityType() },
+        { "<PREFIX>", GetHandlePrefix() },
+        { "<MODULE_PREFIX>", GetMoudlePrefix() }
     });
 }
 
@@ -112,7 +122,8 @@ void CppCionStubHeaderGen::GenServiceBase(std::ofstream& stream,
           { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
           { "<PAYLOAD_T>", GetTransportable().Cpp().GenPayloadType() },
           { "<PAYLOAD_TRANSFER_STATUS_T>",
-              GetTransportable().Cpp().GenPayloadTransferStatusType() }
+              GetTransportable().Cpp().GenPayloadTransferStatusType(false) },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() },
       });
   auto& decls = iface.GetDeclarations();
 
@@ -127,13 +138,18 @@ void CppCionStubHeaderGen::GenServiceBase(std::ofstream& stream,
     stream << ") = 0;" << NLine(1);
   }
 
-  stream << ReplaceAll(CB_SERVICE_BASE_BACK, "<PEER_INFO_T>",
-      GetTransportable().Cpp().GenPeerInfoType()) << NLine(2);
+  stream << ReplaceAll(CB_SERVICE_BASE_BACK, {
+          { "<PEER_INFO_T>", GetTransportable().Cpp().GenPeerInfoType() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() }
+      }) << NLine(2);
 }
 
 void CppCionStubHeaderGen::GenPublicMethods(std::ofstream& stream,
                                         const Interface& iface) {
-  stream << ReplaceAll(CB_PUBLIC_METHODS, "##", iface.GetID());
+  stream << ReplaceAll(CB_PUBLIC_METHODS, {
+          { "##", iface.GetID() },
+          { "<MODULE_PREFIX>", GetMoudlePrefix() }
+      });
 }
 
 }  // namespace tidl
index b5945776cf6a6ed02742ac27179d462c279a2c61..c5bda5a961de4018f6705b454126f4787b544213 100644 (file)
@@ -32,7 +32,7 @@ R"__cpp_cb(
   void FilePayloadSend(std::string path, <PEER_INFO_T> peer);
 
   static void OnConnectionResultCB(const char *service_name,
-      const <PEER_INFO_T> peer_info, const cion_connection_result_h result,
+      const <PEER_INFO_T> peer_info, const <MODULE_PREFIX>_connection_result_h result,
       void *user_data);
   static void OnDisconnectedCB(const char *service_name,
       const <PEER_INFO_T> peer_info, void *user_data);
@@ -49,8 +49,8 @@ R"__cpp_cb(
 
   std::shared_ptr<ServiceBase::Factory> service_factory_;
   std::list<std::shared_ptr<ServiceBase>> services_;
-  <SECURITY_T> cion_security_ = nullptr;
-  <SERVER_T> cion_server_ = nullptr;
+  <SECURITY_T>
+  <SERVER_T> server_ = nullptr;
 )__cpp_cb";
 
 const char CB_SERVICE_BASE_FRONT[] =
@@ -141,7 +141,9 @@ R"__cpp_cb(
   /// <exception cref="InvalidIOException">
   /// Thrown when internal I/O error happen.
   /// </exception>
-  ##(const std::string& service_name, const std::string& display_name);
+  ##(const std::string& service_name, const std::string& display_name,
+    const std::string& broker_ip, int broker_port, const std::string& user_name,
+    const std::string& password, const std::string& my_ip, int protocols);
   ~##();
 
   /// <summary>
@@ -161,20 +163,20 @@ R"__cpp_cb(
   /// <summary>
   /// Accepts client apps
   /// </summary>
-  /// <param name="service">The service object to accept cion client</param>
+  /// <param name="service">The service object to accept <MODULE_PREFIX> client</param>
   void Accept(std::shared_ptr<ServiceBase> service);
 
   /// <summary>
   /// Rejects client apps
   /// </summary>
-  /// <param name="service">The service object to reject cion client</param>
+  /// <param name="service">The service object to reject <MODULE_PREFIX> client</param>
   /// <param name="reason">The reason message for rejection</param>
   void Reject(std::shared_ptr<ServiceBase> service, std::string reason);
 
   /// <summary>
   /// Disconnects client apps
   /// </summary>
-  /// <param name="service">The service object to disconnect cion client</param>
+  /// <param name="service">The service object to disconnect <MODULE_PREFIX> client</param>
   void Disconnect(std::shared_ptr<ServiceBase> service);
 
   /// <summary>
@@ -352,7 +354,6 @@ R"__cpp_cb(
 
 #include <bundle.h>
 #include <rpc-port-parcel.h>
-#include <cion.h>
 
 #include <memory>
 #include <string>
index 20e49113985c8ab34d9ad036e1e71e88d05cf752..1c6e48c8e067fd383c92bf48c59072d3f700bd9b 100644 (file)
@@ -24,7 +24,7 @@ namespace tidl {
 class CppTransportable {
  public:
   virtual ~CppTransportable() = default;
-  virtual std::string GenInclude() const = 0;
+  virtual std::string GenInclude(int type = 0) const = 0;
   virtual std::string GenClientSendAsync(std::string client,
       std::string payload, std::string size) const = 0;
   virtual std::string GenClientSend(std::string client, std::string data,
@@ -37,12 +37,13 @@ class CppTransportable {
   virtual std::string GenClientFileSend(std::string path,
       std::string client) const = 0;
   virtual std::string GenGroupType() const = 0;
-  virtual std::string GenPayloadTransferStatusType() const = 0;
+  virtual std::string GenPayloadTransferStatusType(bool internal_type = false) const = 0;
+  virtual std::string GenPayloadAsyncResultType() const = 0;
   virtual std::string GenPeerInfoType() const = 0;
   virtual std::string GenPeerInfoDestroy(std::string peer) const = 0;
   virtual std::string GenPayloadType() const = 0;
   virtual std::string GenClientType() const = 0;
-  virtual std::string GenSecurityType() const = 0;
+  virtual std::string GenSecurityType(bool definition = true) const = 0;
   virtual std::string GenServerType() const = 0;
   virtual std::string GenClientTryConnect(std::string client,
       std::string peer) const = 0;
@@ -82,6 +83,25 @@ class CppTransportable {
       std::string appid) const = 0;
   virtual std::string GenPeerInfoGetUUID(std::string peer,
       std::string uuid) const = 0;
+  virtual std::string GenHeaderBase() const = 0;
+  virtual std::string GenHeaderPayloadHandle() const = 0;
+  virtual std::string GenHeaderCommonHandle() const = 0;
+  virtual std::string GenHeaderClientHandle() const = 0;
+  virtual std::string GenHeaderServerHandle() const = 0;
+  virtual std::string GenHeaderGroupHandle() const = 0;
+  virtual std::string GenHeaderConnectionHandle() const = 0;
+  virtual std::string GenHeaderPayloadBase() const = 0;
+  virtual std::string GenHeaderConnectionBase() const = 0;
+  virtual std::string GenBodyPayloadBase() const = 0;
+  virtual std::string GenBodyConnectionBase() const = 0;
+  virtual std::string GenBodyPeerInfoBase() const = 0;
+  virtual std::string GenProxyPrefix() const = 0;
+  virtual std::string GenStubPrefix() const = 0;
+  virtual std::string GenGroupPrefix() const = 0;
+  virtual std::string GenModulePrefix() const = 0;
+  virtual std::string GenErrorPrefix() const = 0;
+  virtual std::string GenNamespace() const = 0;
+  virtual std::string GenConnectionResultPrefix() const = 0;
 };
 
 }  // namespace tidl
index 302036a9ab26c7ec398b3635deb40c6fc4ce7379..8f1d0f59f38694b94f189d827b32b72f42969d4e 100644 (file)
@@ -122,15 +122,15 @@ R"__cpp_cb(<SECURITY_T> security;
   }
 
   cion_security_ = security_auto.release();
-  cion_server_ = server_auto.release();
+  server_ = server_auto.release();
 )__cpp_cb";
 
 
 
 constexpr const char __SERVER_UNREGISTER[] =
 R"__cpp_cb(
-  if (cion_server_ != nullptr)
-    cion_server_destroy(cion_server_);
+  if (server_ != nullptr)
+    cion_server_destroy(server_);
 
   if (cion_security_ != nullptr)
     cion_security_destroy(cion_security_);
@@ -138,7 +138,7 @@ R"__cpp_cb(
 
 constexpr const char __SERVER_ACCEPT[] =
 R"__cpp_cb(auto p = service->GetPeer();
-  int ret = cion_server_accept(cion_server_, p);
+  int ret = cion_server_accept(server_, p);
   if (ret != CION_ERROR_NONE) {
     _E("Failed to cion_server_accept. error(%d)", ret);
     throw InvalidIOException();
@@ -150,7 +150,7 @@ R"__cpp_cb(auto p = service->GetPeer();
 
 constexpr const char __SERVER_REJECT[] =
 R"__cpp_cb(auto p = service->GetPeer();
-  int ret = cion_server_reject(cion_server_, p, reason.c_str());
+  int ret = cion_server_reject(server_, p, reason.c_str());
   if (ret != CION_ERROR_NONE) {
     _E("Failed to cion_server_reject. error(%d)", ret);
     throw InvalidIOException();
@@ -158,7 +158,7 @@ R"__cpp_cb(auto p = service->GetPeer();
 )__cpp_cb";
 
 constexpr const char __SERVER_SET_DISPLAY_NAME[] =
-R"__cpp_cb(int ret = cion_server_set_display_name(cion_server_, display_name.c_str());
+R"__cpp_cb(int ret = cion_server_set_display_name(server_, display_name.c_str());
   if (ret != CION_ERROR_NONE) {
     _E("Failed to cion_server_set_display_name. error(%d)", ret);
     InvalidIOException();
@@ -252,25 +252,25 @@ R"__cpp_cb(
 )__cpp_cb";
 
 constexpr const char __SERVER_SEND_ASYNC[] =
-R"__cpp_cb(cion_ret_ = cion_payload_create(&<PAYLOAD>, CION_PAYLOAD_TYPE_DATA);
-  if (cion_ret_ != CION_ERROR_NONE) {
-    _E("Failed to cion_payload_create : %d", cion_ret_);
+R"__cpp_cb(ret_ = cion_payload_create(&<PAYLOAD>, CION_PAYLOAD_TYPE_DATA);
+  if (ret_ != CION_ERROR_NONE) {
+    _E("Failed to cion_payload_create : %d", ret_);
     rpc_port_parcel_destroy(p);
     return;
   }
 
-  cion_ret_ = cion_payload_set_data(<PAYLOAD>, (const unsigned char*)data, <SIZE>);
-  if (cion_ret_ != CION_ERROR_NONE) {
-    _E("Failed to cion_payload_set_data : %d", cion_ret_);
+  ret_ = cion_payload_set_data(<PAYLOAD>, (const unsigned char*)data, <SIZE>);
+  if (ret_ != CION_ERROR_NONE) {
+    _E("Failed to cion_payload_set_data : %d", ret_);
     rpc_port_parcel_destroy(p);
     cion_payload_destroy(<PAYLOAD>);
     return;
   }
 
-  cion_ret_ = cion_server_send_payload_async(<SERVER>, service_.lock()->GetPeer(), <PAYLOAD>, nullptr, nullptr);
+  ret_ = cion_server_send_payload_async(<SERVER>, service_.lock()->GetPeer(), <PAYLOAD>, nullptr, nullptr);
   cion_payload_destroy(<PAYLOAD>);
-  if (cion_ret_ != CION_ERROR_NONE) {
-    _E("Failed to cion_client_send_payload_async : %d", cion_ret_);
+  if (ret_ != CION_ERROR_NONE) {
+    _E("Failed to cion_client_send_payload_async : %d", ret_);
     rpc_port_parcel_destroy(p);
     return;
   }
@@ -292,7 +292,7 @@ R"__c_cb(ret = cion_payload_create(&pl, CION_PAYLOAD_TYPE_DATA);
       throw InvalidIOException();
     }
 
-    ret = cion_group_publish(cion_group_, pl);
+    ret = cion_group_publish(group_, pl);
     cion_payload_destroy(pl);
     if (ret != CION_ERROR_NONE) {
       _E("Failed to cion_group_publish : %d", ret);
@@ -346,7 +346,7 @@ R"__c_cb(<SECURITY_T> security;
   }
 
   cion_security_ = security_auto.release();
-  cion_client_ = client_auto.release();
+  client_ = client_auto.release();
 )__c_cb";
 
 constexpr const char __GROUP_CREATE[] =
@@ -423,15 +423,15 @@ R"__c_cb(<SECURITY_T> security;
   }
 
   cion_security_ = security_auto.release();
-  cion_group_ = group_auto.release();
+  group_ = group_auto.release();
 )__c_cb";
 
 constexpr const char __GROUP_DESTROY[] =
-R"__c_cb(if (cion_group_ != nullptr) {
-    int ret = cion_group_unsubscribe(cion_group_);
+R"__c_cb(if (group_ != nullptr) {
+    int ret = cion_group_unsubscribe(group_);
     if (ret != CION_ERROR_NONE)
       _E("Failed to unsubscribe. error(%d)", ret);
-      cion_group_destroy(cion_group_);
+      cion_group_destroy(group_);
   }
 
   if (cion_security_ != nullptr)
@@ -440,8 +440,8 @@ R"__c_cb(if (cion_group_ != nullptr) {
 
 constexpr const char __CLIENT_DESTROY[] =
 R"__c_cb(
-  if (cion_client_ != nullptr)
-    cion_client_destroy(cion_client_);
+  if (client_ != nullptr)
+    cion_client_destroy(client_);
 
   if (cion_security_ != nullptr)
     cion_security_destroy(cion_security_);
@@ -475,7 +475,7 @@ const char __PEER_INFO_CLONE[] =
   "cion_peer_info_clone(<SRC_PEER>, <DEST_PEER>);";
 
 constexpr const char __SERVER_SET_ONDEMAND_LAUNCH_ENABLED[] =
-R"__c_cb(int ret = cion_server_set_on_demand_launch_enabled(cion_server_, enabled);
+R"__c_cb(int ret = cion_server_set_on_demand_launch_enabled(server_, enabled);
   if (ret != CION_ERROR_NONE) {
     _E("Failed to cion_server_set_on_demand_launch_enabled. error(%d)", ret);
     switch(ret) {
@@ -489,7 +489,7 @@ R"__c_cb(int ret = cion_server_set_on_demand_launch_enabled(cion_server_, enable
 )__c_cb";
 
 constexpr const char __SERVER_LISTEN[] =
-R"__c_cb(int ret = cion_server_listen(cion_server_, OnConnectionRequestCB, this);
+R"__c_cb(int ret = cion_server_listen(server_, OnConnectionRequestCB, this);
   if (ret != CION_ERROR_NONE) {
     _E("Failed to cion_server_listen. error(%d)", ret);
     switch(ret) {
@@ -520,7 +520,7 @@ constexpr const char __PEER_INFO_GET_UUID[] =
 
 namespace tidl {
 
-std::string DefaultCppTransportable::GenInclude() const {
+std::string DefaultCppTransportable::GenInclude(int type) const {
   return "#include <cion.h>";
 }
 
@@ -572,10 +572,14 @@ std::string DefaultCppTransportable::GenGroupType() const {
   return "cion_group_h";
 }
 
-std::string DefaultCppTransportable::GenPayloadTransferStatusType() const {
+std::string DefaultCppTransportable::GenPayloadTransferStatusType(bool internal_type) const {
   return "cion_payload_transfer_status_e";
 }
 
+std::string DefaultCppTransportable::GenPayloadAsyncResultType() const {
+  return "cion_payload_async_result_h";
+}
+
 std::string DefaultCppTransportable::GenPeerInfoType() const {
   return "cion_peer_info_h";
 }
@@ -586,6 +590,54 @@ std::string DefaultCppTransportable::GenPeerInfoDestroy(
       { "<PEER>", peer } }));
 }
 
+std::string DefaultCppTransportable::GenHeaderBase() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderPayloadHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderCommonHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderClientHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderServerHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderGroupHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderConnectionHandle() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderPayloadBase() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenHeaderConnectionBase() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenBodyPayloadBase() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenBodyConnectionBase() const {
+  return "";
+}
+
+std::string DefaultCppTransportable::GenBodyPeerInfoBase() const {
+  return "";
+}
+
 std::string DefaultCppTransportable::GenPayloadType() const {
   return "cion_payload_h";
 }
@@ -594,14 +646,45 @@ std::string DefaultCppTransportable::GenClientType() const {
   return "cion_client_h";
 }
 
-std::string DefaultCppTransportable::GenSecurityType() const {
-  return "cion_security_h";
+std::string DefaultCppTransportable::GenSecurityType(bool definition) const {
+  if (definition)
+    return "cion_security_h  cion_security_ = nullptr;";
+  else
+    return "cion_security_h";
 }
 
 std::string DefaultCppTransportable::GenServerType() const {
   return "cion_server_h";
 }
 
+std::string DefaultCppTransportable::GenProxyPrefix() const {
+  return "cion_proxy";
+}
+
+std::string DefaultCppTransportable::GenStubPrefix() const {
+  return "cion_stub";
+}
+
+std::string DefaultCppTransportable::GenGroupPrefix() const {
+  return "cion_group";
+}
+
+std::string DefaultCppTransportable::GenModulePrefix() const {
+  return "cion";
+}
+
+std::string DefaultCppTransportable::GenErrorPrefix() const {
+  return "CION";
+}
+
+std::string DefaultCppTransportable::GenConnectionResultPrefix() const {
+  return "CION_";
+}
+
+std::string DefaultCppTransportable::GenNamespace() const {
+  return "cion";
+}
+
 std::string DefaultCppTransportable::GenClientTryConnect(std::string client,
     std::string peer) const {
   return std::string(ReplaceAll(__CLIENT_TRY_CONNECT, {
index 56b0ba5dd1cf8b5639d3b2d2a03a55e498661634..dae42f43f1584118c4f3d9a4c1c34894d51a9db1 100644 (file)
@@ -26,7 +26,7 @@ namespace tidl {
 class DefaultCppTransportable : public CppTransportable {
  public:
   virtual ~DefaultCppTransportable() = default;
-  std::string GenInclude() const override;
+  std::string GenInclude(int type = 0) const override;
   std::string GenClientSendAsync(std::string client,
       std::string payload, std::string size) const override;
   std::string GenClientSend(std::string client, std::string data,
@@ -39,12 +39,13 @@ class DefaultCppTransportable : public CppTransportable {
   std::string GenClientFileSend(std::string path,
       std::string client) const override;
   std::string GenGroupType() const override;
-  std::string GenPayloadTransferStatusType() const override;
+  std::string GenPayloadTransferStatusType(bool internal_type = false) const override;
+  std::string GenPayloadAsyncResultType() const override;
   std::string GenPeerInfoType() const override;
   std::string GenPeerInfoDestroy(std::string peer) const override;
   std::string GenPayloadType() const override;
   std::string GenClientType() const override;
-  std::string GenSecurityType() const override;
+  std::string GenSecurityType(bool definition = true) const override;
   std::string GenServerType() const override;
   std::string GenClientTryConnect(std::string client,
       std::string peer) const override;
@@ -84,6 +85,25 @@ class DefaultCppTransportable : public CppTransportable {
       std::string appid) const override;
   std::string GenPeerInfoGetUUID(std::string peer,
       std::string uuid) const override;
+  std::string GenHeaderBase() const override;
+  std::string GenHeaderPayloadHandle() const override;
+  std::string GenHeaderCommonHandle() const override;
+  std::string GenHeaderClientHandle() const override;
+  std::string GenHeaderServerHandle() const override;
+  std::string GenHeaderGroupHandle() const override;
+  std::string GenHeaderConnectionHandle() const override;
+  std::string GenHeaderPayloadBase() const override;
+  std::string GenHeaderConnectionBase() const override;
+  std::string GenBodyPayloadBase() const override;
+  std::string GenBodyConnectionBase() const override;
+  std::string GenBodyPeerInfoBase() const override;
+  std::string GenProxyPrefix() const override;
+  std::string GenStubPrefix() const override;
+  std::string GenGroupPrefix() const override;
+  std::string GenModulePrefix() const override;
+  std::string GenErrorPrefix() const override;
+  std::string GenConnectionResultPrefix() const override;
+  std::string GenNamespace() const override;
 };
 
 }  // namespace tidl
index 7a4cbb5540b0fb4a31c98d3d469e60541a92d552..b6046f68223acb0a8a56d67ba55c5511574e09f7 100644 (file)
@@ -58,6 +58,7 @@
 #include "idlc/gen_aitt_plugin/aitt_plugin_loader.h"
 #include "idlc/gen_aitt_plugin/aitt_plugin_cs_base_gen.h"
 #include "idlc/gen_aitt_plugin/aitt_plugin_cs_interop_gen.h"
+#include "idlc/gen_aitt_plugin/aitt_plugin_cpp_transportable.h"
 
 #include "idlc/options.h"
 
@@ -131,30 +132,56 @@ void GenerateStubCodes(std::shared_ptr<tidl::Options> options,
     case tidl::Options::LANGUAGE_TYPE_C:
     {
       tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
       internal_header.SetType(static_cast<int>(options->GetType()));
-      internal_header.Run("aitt_plugin_stub_internal.h");
+      internal_header.Run(options->GetOutput() + "_internal.h");
 
       tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
       internal_body.EnableNamespace(options->HasNamespace());
+                internal_body.EnableGeneratedAPI(true);
       internal_body.SetType(static_cast<int>(options->GetType()));
-      internal_body.Run("aitt_plugin_stub_internal.c");
+      internal_body.Run(options->GetOutput() + "_internal.c");
 
       tidl::CCionStubHeaderGen stub_header(ps.GetDoc(), trans);
       stub_header.EnableNamespace(options->HasNamespace());
+                stub_header.EnableGeneratedAPI(true);
       stub_header.SetType(static_cast<int>(options->GetType()));
-      stub_header.EnableGeneratedAPI(true);
       stub_header.Run(options->GetOutput() + ".h");
 
       tidl::CCionStubBodyGen stub_body(ps.GetDoc(), options, trans);
       stub_body.EnableNamespace(options->HasNamespace());
+                stub_body.EnableGeneratedAPI(true);
       stub_body.SetType(static_cast<int>(options->GetType()));
-      stub_body.EnableGeneratedAPI(true);
       stub_body.Run(options->GetOutput() + ".c");
 
       break;
     }
     case tidl::Options::LANGUAGE_TYPE_CPP:
     {
+      tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
+      internal_header.SetType(static_cast<int>(options->GetType()));
+      internal_header.Run(options->GetOutput() + "_internal.h");
+
+      tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+      internal_body.EnableNamespace(options->HasNamespace());
+      internal_body.EnableGeneratedAPI(true);
+      internal_body.SetType(static_cast<int>(options->GetType()));
+      internal_body.Run(options->GetOutput() + "_internal.c");
+
+      tidl::CppCionStubHeaderGen stub_header(ps.GetDoc(), options, trans);
+      stub_header.SetType(static_cast<int>(options->GetType()));
+      stub_header.EnableGeneratedAPI(true);
+      stub_header.EnableNamespace(options->HasNamespace());
+      stub_header.Run(options->GetOutput() + ".h");
+
+      tidl::CppCionStubBodyGen stub_body(ps.GetDoc(), options, trans);
+      stub_body.SetType(static_cast<int>(options->GetType()));
+      stub_body.EnableGeneratedAPI(true);
+      stub_body.EnableNamespace(options->HasNamespace());
+      stub_body.Run(options->GetOutput() + ".cc");
       break;
     }
     case tidl::Options::LANGUAGE_TYPE_CSHARP:
@@ -291,29 +318,55 @@ void GenerateProxyCodes(std::shared_ptr<tidl::Options> options,
     case tidl::Options::LANGUAGE_TYPE_C:
     {
       tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
       internal_header.SetType(static_cast<int>(options->GetType()));
-      internal_header.Run("aitt_plugin_proxy_internal.h");
+      internal_header.Run(options->GetOutput() + "_internal.h");
 
       tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
       internal_body.EnableNamespace(options->HasNamespace());
+      internal_body.EnableGeneratedAPI(true);
       internal_body.SetType(static_cast<int>(options->GetType()));
-      internal_body.Run("aitt_plugin_proxy_internal.c");
+      internal_body.Run(options->GetOutput() + "_internal.c");
 
       tidl::CCionProxyHeaderGen proxy_header(ps.GetDoc(), trans);
       proxy_header.EnableNamespace(options->HasNamespace());
-      proxy_header.SetType(static_cast<int>(options->GetType()));
       proxy_header.EnableGeneratedAPI(true);
+      proxy_header.SetType(static_cast<int>(options->GetType()));
       proxy_header.Run(options->GetOutput() + ".h");
 
       tidl::CCionProxyBodyGen proxy_body(ps.GetDoc(), options, trans);
       proxy_body.EnableNamespace(options->HasNamespace());
-      proxy_body.SetType(static_cast<int>(options->GetType()));
       proxy_body.EnableGeneratedAPI(true);
+      proxy_body.SetType(static_cast<int>(options->GetType()));
       proxy_body.Run(options->GetOutput() + ".c");
       break;
     }
     case tidl::Options::LANGUAGE_TYPE_CPP:
     {
+      tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.SetType(static_cast<int>(options->GetType()));
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
+      internal_header.Run(options->GetOutput() + "_internal.h");
+
+      tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+      internal_body.SetType(static_cast<int>(options->GetType()));
+      internal_body.EnableNamespace(options->HasNamespace());
+      internal_body.EnableGeneratedAPI(true);
+      internal_body.Run(options->GetOutput() + "_internal.c");
+
+      tidl::CppCionProxyHeaderGen proxy_header(ps.GetDoc(), trans);
+      proxy_header.EnableNamespace(options->HasNamespace());
+      proxy_header.EnableGeneratedAPI(true);
+      proxy_header.SetType(static_cast<int>(options->GetType()));
+      proxy_header.Run(options->GetOutput() + ".h");
+
+      tidl::CppCionProxyBodyGen proxy_body(ps.GetDoc(), trans);
+      proxy_body.EnableNamespace(options->HasNamespace());
+      proxy_body.EnableGeneratedAPI(true);
+      proxy_body.SetType(static_cast<int>(options->GetType()));
+      proxy_body.Run(options->GetOutput() + ".cc");
       break;
     }
     case tidl::Options::LANGUAGE_TYPE_CSHARP:
@@ -449,22 +502,27 @@ void GenerateGroupCodes(std::shared_ptr<tidl::Options> options,
     case tidl::Options::LANGUAGE_TYPE_C:
     {
       tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
       internal_header.SetType(static_cast<int>(options->GetType()));
-      internal_header.Run("aitt_plugin_group_internal.h");
+      internal_header.Run(options->GetOutput() + "_internal.h");
 
       tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
       internal_body.EnableNamespace(options->HasNamespace());
+      internal_body.EnableGeneratedAPI(true);
       internal_body.SetType(static_cast<int>(options->GetType()));
-      internal_body.Run("aitt_plugin_group_internal.c");
+      internal_body.Run(options->GetOutput() + "_internal.c");
 
       tidl::CCionGroupHeaderGen group_header(ps.GetDoc(), trans);
       group_header.EnableNamespace(options->HasNamespace());
+      group_header.EnableGeneratedAPI(true);
       group_header.SetType(static_cast<int>(options->GetType()));
       group_header.EnableGeneratedAPI(true);
       group_header.Run(options->GetOutput() + ".h");
 
       tidl::CCionGroupBodyGen group_body(ps.GetDoc(), options, trans);
       group_body.EnableNamespace(options->HasNamespace());
+      group_body.EnableGeneratedAPI(true);
       group_body.SetType(static_cast<int>(options->GetType()));
       group_body.EnableGeneratedAPI(true);
       group_body.Run(options->GetOutput() + ".c");
@@ -472,6 +530,29 @@ void GenerateGroupCodes(std::shared_ptr<tidl::Options> options,
     }
     case tidl::Options::LANGUAGE_TYPE_CPP:
     {
+      tidl::AittPluginInternalHeaderGen internal_header(ps.GetDoc(), trans);
+      internal_header.SetType(static_cast<int>(options->GetType()));
+      internal_header.EnableNamespace(options->HasNamespace());
+      internal_header.EnableGeneratedAPI(true);
+      internal_header.Run(options->GetOutput() + "_internal.h");
+
+      tidl::AittPluginInternalBodyGen internal_body(ps.GetDoc(), trans);
+      internal_body.SetType(static_cast<int>(options->GetType()));
+      internal_body.EnableNamespace(options->HasNamespace());
+      internal_body.EnableGeneratedAPI(true);
+      internal_body.Run(options->GetOutput() + "_internal.c");
+
+      tidl::CppCionGroupHeaderGen group_header(ps.GetDoc(), trans);
+      group_header.SetType(static_cast<int>(options->GetType()));
+      group_header.EnableNamespace(options->HasNamespace());
+      group_header.EnableGeneratedAPI(true);
+      group_header.Run(options->GetOutput() + ".h");
+
+      tidl::CppCionGroupBodyGen group_body(ps.GetDoc(), trans);
+      group_body.SetType(static_cast<int>(options->GetType()));
+      group_body.EnableNamespace(options->HasNamespace());
+      group_body.EnableGeneratedAPI(true);
+      group_body.Run(options->GetOutput() + ".cc");
       break;
     }
     case tidl::Options::LANGUAGE_TYPE_CSHARP:
index ed2dd0d40c1a438f2797f2585151748162d06498..2e6819ba178b08ef2da8312faa63af2741fbe82b 100644 (file)
@@ -23,6 +23,8 @@ SET(CMAKE_EXE_LINKER_FLAGS "-pie -Wl,--as-needed")
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} TIDL_BUILD_TESTS_SRCS)
 
 SET(TIDL_GEN_SRCS
+  BufferAittPluginProxy.cc
+  BufferAittPluginStub.cc
   BufferAittPluginProxyC.c
   BufferAittPluginStubC.c
   BufferCionProxy.cc
@@ -33,6 +35,8 @@ SET(TIDL_GEN_SRCS
   BufferProxyC.c
   BufferStub.cc
   BufferStubC.c
+  DataPortAittPluginProxy.cc
+  DataPortAittPluginStub.cc
   DataPortAittPluginProxyC.c
   DataPortAittPluginStubC.c
   DataPortCionProxy.cc
@@ -43,6 +47,8 @@ SET(TIDL_GEN_SRCS
   DataPortProxyC.c
   DataPortStub.cc
   DataPortStubC.c
+  ExCionAittPluginProxy.cc
+  ExCionAittPluginStub.cc
   ExCionAittPluginProxyC.c
   ExCionAittPluginStubC.c
   ExCionCionProxy.cc
@@ -53,6 +59,8 @@ SET(TIDL_GEN_SRCS
   ExProxyC.c
   ExStub.cc
   ExStubC.c
+  FooAittPluginProxy.cc
+  FooAittPluginStub.cc
   FooAittPluginProxyC.c
   FooAittPluginStubC.c
   FooCionProxy.cc
@@ -63,6 +71,8 @@ SET(TIDL_GEN_SRCS
   FooProxyC.c
   FooStub.cc
   FooStubC.c
+  MessageAittPluginProxy.cc
+  MessageAittPluginStub.cc
   MessageAittPluginProxyC.c
   MessageAittPluginStubC.c
   MessageCionProxy.cc
@@ -72,6 +82,7 @@ SET(TIDL_GEN_SRCS
   MessageProxy.cc
   MessageProxyC.c
   MessageStub.cc
+  FooPubsubAittPluginGroup.cc
   FooPubsubAittPluginGroupC.c
   FooPubsubGroup.cc
   FooPubsubGroupC.c
index f409fd4d66880212834f2a981b136a490fc7ad35..b0ad0fadc54caca45d6bfbf667b82ae52f6762be 100755 (executable)
@@ -86,11 +86,17 @@ GenerateTIDL() {
     INPUT="${FILES_CION[index]}.tidl"
 
     OUTPUT="${FILES_CION[index]}AittPluginProxyC"
-
     ${TIDLC} -b -p -n -a -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
 
     OUTPUT="${FILES_CION[index]}AittPluginStubC"
     ${TIDLC} -b -s -n -a -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+
+    OUTPUT="${FILES_CION[index]}AittPluginProxy"
+    ${TIDLC} -b -p -n -a -l C++ -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+
+    OUTPUT="${FILES_CION[index]}AittPluginStub"
+    ${TIDLC} -b -s -n -a -l C++ -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+
   done
 
   for index in ${!FILES_FOR_GROUP[*]}; do
@@ -100,6 +106,9 @@ GenerateTIDL() {
 
     OUTPUT="${FILES_FOR_GROUP[index]}AittPluginGroupC"
     ${TIDLC} -b -a -n -g -l C -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
+
+    OUTPUT="${FILES_FOR_GROUP[index]}AittPluginGroup"
+    ${TIDLC} -b -a -n -g -l C++ -i ${SCRIPT_DIR}/tidl/${INPUT} -o ${TARGET_DIR}/${OUTPUT}
   done
 }