Cool. If you like, feel free to propose a modification to the standard code generator which makes the file descriptor pointer directly accessible, so that you don't have to have the extra lookup step.
On Thu, Mar 11, 2010 at 11:58 AM, Andrew Kimpton <[email protected]>wrote: > > > On Thu, Mar 11, 2010 at 2:27 PM, Kenton Varda <[email protected]> wrote: > >> On the first call to your descriptor() or GetDescriptor() method, you >> could look up the ServiceDescriptor in >> google::protobuf::DescriptorPool::generated_pool(). >> > > I think that's what my generated code is essentially now doing : > > In my generated service_subclass::descriptor() and ::GetDescriptor() > methods I call a 'protobuf_rpc_AssignDescriptorsOnce()' function that looks > like this : > > void protobuf_rpc_AssignDesc_test_5fservice_2eproto() { > const ::google::protobuf::FileDescriptor* file = > ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( > "test_service.proto"); > GOOGLE_CHECK(file != NULL); > TestingService_descriptor_ = file->service(0); > } > > GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_rpc_AssignDescriptors_once_); > inline void protobuf_rpc_AssignDescriptorsOnce() { > ::google::protobuf::GoogleOnceInit(&protobuf_rpc_AssignDescriptors_once_, > &protobuf_rpc_AssignDesc_test_5fservice_2eproto); > > Andrew 8-) > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
