The c++ generator does generate interfaces. I think the file you are referring to is UserStorage_server.skeleton.cpp which the compiler generates. You do not need to modify this file. Instead, create your own implementation file that does something very similar.
I use the c++ generator heavily and I ignore the skeleton file in compiling and just create my own implementation file that implements the service interface. On Fri, Sep 28, 2012 at 1:29 PM, Nan Zhu <[email protected]> wrote: > Ted, Thank you for the answering > > any one using C++ can give me a help? > > Best, > > -- > Nan Zhu > School of Computer Science, > McGill University > > 在 2012年9月28日星期五,下午1:23,Ted Dunning 写道: > > I haven't used C++ with Thrift. In Java, the generator builds interfaces. > > > > On Fri, Sep 28, 2012 at 1:21 PM, Nan Zhu <[email protected] (mailto: > [email protected])> wrote: > > > > > Hi, Ted, > > > > > > Thanks for your replying, > > > > > > 18 class UserStorageHandler : virtual public UserStorageIf { > > > 19 public: > > > 20 UserStorageHandler() { > > > 21 // Your initialization goes here > > > 22 } > > > 23 > > > 24 void store(const UserProfile& user) { > > > 25 // Your implementation goes here > > > 26 printf("store\n"); > > > 27 } > > > 28 > > > 29 void retrieve(UserProfile& _return, const int32_t uid) { > > > 30 // Your implementation goes here > > > 31 printf("retrieve\n"); > > > 32 } > > > 33 > > > 34 }; > > > > > > > > > the above is the generated code, do you mean I should remove those {} > and > > > printf(), and change this generated cpp file as a header file, and then > > > implement the functions in a cpp? > > > > > > Best > > > > > > > > > -- > > > Nan Zhu > > > School of Computer Science, > > > McGill University > > > > > > 在 2012年9月28日星期五,下午1:13,Ted Dunning 写道: > > > > You should never modify the generated code by hand. Implement them > in a > > > > separate file. > > > > > > > > On Fri, Sep 28, 2012 at 1:07 PM, Nan Zhu <[email protected](mailto: > [email protected]) (mailto: > > > [email protected] (mailto:[email protected]))> wrote: > > > > > > > > > Hi, all > > > > > > > > > > I met a question during my development using Thrift > > > > > > > > > > e.g. at the beginning of the project, I generate the c++ code from > > > > > ".thrift" file, and then I work on those RPC callees to implement > them, > > > > > after that, I found I need to add another callee to the system, I > > > > > > > > > > > > > > > > > > > modify > > > > > the .thrift file and generate the C++ code again, > > > > > > > > > > how should I merge the new version of generated code with my > > > implemented > > > > > version? do I need to copy the related part manually(e.g. new > callee > > > > > declaration)? > > > > > > > > > > Thank you! > > > > > > > > > > Best, > > > > > > > > > > -- > > > > > Nan Zhu > > > > > School of Computer Science, > > > > > McGill University > > > > > > > > > > > > > > > > > > > > > > > >
