diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2018-09-14 18:39:47 +0900 |
---|---|---|
committer | HwanKyu Jhun <h.jhun@samsung.com> | 2018-09-17 00:52:33 +0000 |
commit | 0bb1703d1983b3d50d9b6d858522b05cd6427fe2 (patch) | |
tree | 0f861f76e7874eae26fdcb02228a0d5baa2f7cfc | |
parent | 62ae4e75b9dca694da3bbc1b8049037fd37b72b0 (diff) | |
download | tidl-0bb1703d1983b3d50d9b6d858522b05cd6427fe2.tar.gz tidl-0bb1703d1983b3d50d9b6d858522b05cd6427fe2.tar.bz2 tidl-0bb1703d1983b3d50d9b6d858522b05cd6427fe2.zip |
Modified C Generator
- Adds delegator dtor
Change-Id: I69f55d3735676d0b180dea7973d11e260916f334
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | idlc/c_gen/c_proxy_body_gen.cc | 7 | ||||
-rw-r--r-- | idlc/c_gen/c_proxy_body_gen.h | 3 | ||||
-rw-r--r-- | idlc/c_gen/c_proxy_body_gen_cb.h | 15 | ||||
-rw-r--r-- | idlc/c_gen/c_proxy_header_gen.cc | 1 | ||||
-rw-r--r-- | idlc/c_gen/c_proxy_header_gen_cb.h | 5 |
5 files changed, 31 insertions, 0 deletions
diff --git a/idlc/c_gen/c_proxy_body_gen.cc b/idlc/c_gen/c_proxy_body_gen.cc index 76aed88..85c7f11 100644 --- a/idlc/c_gen/c_proxy_body_gen.cc +++ b/idlc/c_gen/c_proxy_body_gen.cc @@ -99,6 +99,7 @@ void CProxyBodyGen::GenInterfaceDelegator(std::ofstream& stream, GenInterfaceDelegatorSerializer(stream, id, decl); GenInterfaceDelegatorDeserializer(stream, id, decl); GenInterfaceDelegatorConstructor(stream, id, decl); + GenInterfaceDelegatorDestructor(stream, id, decl); GenInterfaceDelegatorDisposer(stream, id, decl); GenInterfaceDelegatorInvoker(stream, id, decl); } @@ -208,6 +209,12 @@ void CProxyBodyGen::GenInterfaceDelegatorInvoker( })); } +void CProxyBodyGen::GenInterfaceDelegatorDestructor( + std::ofstream& stream, const std::string& id, const Declaration& decl) { + stream << SmartIndent(ReplaceAll( + CB_DELEGATE_DTOR, "##", id + "_" + decl.GetID())); +} + void CProxyBodyGen::GenInterfaceDelegatorTable(std::ofstream& stream, const Interface& inf) { const char block[] = diff --git a/idlc/c_gen/c_proxy_body_gen.h b/idlc/c_gen/c_proxy_body_gen.h index 341b112..04dd55e 100644 --- a/idlc/c_gen/c_proxy_body_gen.h +++ b/idlc/c_gen/c_proxy_body_gen.h @@ -81,6 +81,9 @@ class CProxyBodyGen : public CBodyGeneratorBase { void GenInterfaceDelegatorInvoker(std::ofstream& stream, const std::string& id, const Declaration& decl); + void GenInterfaceDelegatorDestructor(std::ofstream& stream, + const std::string& id, + const Declaration& decl); private: std::string GetMethodWriteString(const Interface& inf, diff --git a/idlc/c_gen/c_proxy_body_gen_cb.h b/idlc/c_gen/c_proxy_body_gen_cb.h index cd22b33..95a8714 100644 --- a/idlc/c_gen/c_proxy_body_gen_cb.h +++ b/idlc/c_gen/c_proxy_body_gen_cb.h @@ -130,6 +130,21 @@ int rpc_port_proxy_##_dispose(rpc_port_proxy_$$_h proxy, rpc_port_##_h delegate) } )__c_cb"; +const char CB_DELEGATE_DTOR[] = +R"__c_cb( +int rpc_port_proxy_##_destroy(rpc_port_##_h delegate) +{ + if (!delegate) { + _E("Invalid parameter"); + return -1; + } + + free(delegate); + + return 0; +} +)__c_cb"; + const char CB_DELEGATE_INVOKER[] = R"__c_cb( static void __$$_delegate_$$(GList **list, rpc_port_parcel_h parcel, int seq_id, int id) diff --git a/idlc/c_gen/c_proxy_header_gen.cc b/idlc/c_gen/c_proxy_header_gen.cc index 922de75..0ca669c 100644 --- a/idlc/c_gen/c_proxy_header_gen.cc +++ b/idlc/c_gen/c_proxy_header_gen.cc @@ -101,6 +101,7 @@ void CProxyHeaderGen::GenInterfaceDelegator(std::ofstream& stream, }); stream << ReplaceAll(CB_DELEGATE_CTOR, "##", id + "_" + decl.GetID()); + stream << ReplaceAll(CB_DELEGATE_DTOR, "##", id + "_" + decl.GetID()); stream << GenTemplateString( ReplaceAll(CB_DELEGATE_DISPOSER, "##", id + "_" + decl.GetID()), [&]()->std::string { diff --git a/idlc/c_gen/c_proxy_header_gen_cb.h b/idlc/c_gen/c_proxy_header_gen_cb.h index 0fd524b..4fe6daf 100644 --- a/idlc/c_gen/c_proxy_header_gen_cb.h +++ b/idlc/c_gen/c_proxy_header_gen_cb.h @@ -65,4 +65,9 @@ R"__c_cb( int rpc_port_proxy_##_dispose(rpc_port_proxy_$$_h proxy, rpc_port_##_h delegate); )__c_cb"; +const char CB_DELEGATE_DTOR[] = +R"__c_cb( +int rpc_port_##_destroy(rpc_port_##_h delegate); +)__c_cb"; + #endif // IDLC_C_GEN_C_PROXY_HEADER_GEN_CB_H_ |