You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2014/01/04 23:46:50 UTC
[jira] [Commented] (THRIFT-2304) Move client assignments from
construtor in method
[ https://issues.apache.org/jira/browse/THRIFT-2304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13862433#comment-13862433 ]
Hudson commented on THRIFT-2304:
--------------------------------
FAILURE: Integrated in Thrift #982 (See [https://builds.apache.org/job/Thrift/982/])
THRIFT-2304 cpp:Move client assignments from construtor in method (roger: rev cf8b6264348c5df232f7a81e6a5463b3763943ab)
* compiler/cpp/src/generate/t_cpp_generator.cc
> Move client assignments from construtor in method
> -------------------------------------------------
>
> Key: THRIFT-2304
> URL: https://issues.apache.org/jira/browse/THRIFT-2304
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Compiler
> Affects Versions: 0.9.1
> Reporter: Martin Vogt
> Assignee: Roger Meier
> Priority: Trivial
> Attachments: setProto_Client-131231v1.patch
>
>
> The current generated client code in C++ look like this
> (namespace removed, for better formatting):
> {code}
> class MyServiceClient : virtual public MyServiceIf {
> public:
> MyServiceClient(shared_ptr< TProtocol> prot) :
> piprot_(prot),
> poprot_(prot) {
> iprot_ = prot.get();
> oprot_ = prot.get();
> }
> [...]
> {code}
> The member variables are assigned in the constructor.
> The patch puts the assignment into its own method:
> {code}
> class MyServiceClient : virtual public MyServiceIf {
> public:
> MyServiceClient(shared_ptr< TProtocol> prot) {
> setProtocol(prot);
> }
> [..]
> private:
> void setProtocol(shared_ptr< TProtocol> prot) {
> setProtocol(prot,prot);
> }
> void setProtocol(shared<:TProtocol> iprot,shared_ptr<TProtocol> oprot) {
> piprot_=iprot;
> poprot_=oprot;
> iprot_ = iprot.get();
> oprot_ = oprot.get();
> }
> {code}
> This allows to change the TProtocol instance, after the Client creation. (With removing the private field or using a virtual method in a Service base class)
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)