You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Jens Geyer <je...@hotmail.com> on 2011/09/28 22:42:19 UTC

Tutorial question

Hi *,

I ran into an issue which I think is wrong, at least from my understanding 
of the matter.

In the tutorial, we find:


service Calculator extends shared.SharedService {
   void ping(),
   i32 add(1:i32 num1, 2:i32 num2),
   i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch),
   oneway void zip()
}

which extends

service SharedService {
  SharedStruct getStruct(1: i32 key)
}


The generated server skeleton class CalculatorHandler inherits ONLY from 
CalculatorIf, which correctly inherits from SharedServiceIf, and thus the 
CalculatorHandler looks like this (less interesting stuff omitted):

class CalculatorHandler : virtual public CalculatorIf {
 public:
  CalculatorHandler();

  void ping();
  int32_t add(const int32_t num1, const int32_t num2);
  int32_t calculate(const int32_t logid, const Work& w);
  void zip();
};

But - and here's what I believe is wrong - shouldn't the class also 
implement the getStruct() member? Otherwise the inheritance from 
SharedService seems not to make much sense, doesn't it?

In contrast, the CalculatorNull class inherits from SharedServiceNull as one 
would expect and therefore *has* an getStruct() member.

JensG