//-------- This is tst.hh ------ #include #include #include #include #include class Counter; class SendCompressedBuffer; class B1 { std::complex c_; boost::scoped_ptr a_; void SendTypeNum(SendCompressedBuffer*) const; protected: void SendMemberData(SendCompressedBuffer*) const; public: template explicit B1(B* buf); void Send(SendCompressedBuffer* buf, bool = false) const { } void CalculateMarshallingSize(Counter& cntr) const; }; class B2 { flex_string str_; void SendTypeNum(SendCompressedBuffer*) const; protected: void SendMemberData(SendCompressedBuffer*) const; public: template explicit B2(B* buf); void Send(SendCompressedBuffer* buf, bool = false) const { } void CalculateMarshallingSize(Counter& cntr) const; }; class MI : public B1, public B2 { std::vector vec_; void SendTypeNum(SendCompressedBuffer*) const; protected: void SendMemberData(SendCompressedBuffer*) const; public: template explicit MI(B* buf); void Send(SendCompressedBuffer* buf, bool = false) const { } void CalculateMarshallingSize(Counter& cntr) const; }; //------- This is the middle file ------- Message (MI*) } //-------- Output --------- // Generated by the C++ Middleware Writer version 1.12 #include #include #include #include extern uint32_t msg_length_max; struct Message { void Send(SendCompressedBuffer* buf, const MI* abt1) { Counter cntr(msg_length_max); abt1->CalculateMarshallingSize(cntr); buf->Receive(&cntr.value_, sizeof(cntr.value_)); abt1->Send(buf, false); buf->Flush(); } template void Receive(B* buf, MI*& abt1) { abt1 = new MI(buf); } }; uint16_t const B1_num = 7001; uint16_t const MI_num = 7002; uint16_t const B2_num = 7003; template inline B1::B1(B* buf) { buf->Give(c_); boost::scoped_ptr P1(new uint32_t); buf->Give(*P1); a_.swap(P1); } inline void B1::CalculateMarshallingSize(Counter& cntr) const { cntr.Add(sizeof(c_)); cntr.Add(sizeof(uint32_t)); } inline void B1::SendMemberData(SendCompressedBuffer* buf) const { complexSend(buf, c_); buf->Receive(a_.get(), sizeof(uint32_t)); } inline void B1::SendTypeNum(SendCompressedBuffer* buf) const { buf->Receive(&B1_num, sizeof(B1_num)); } template inline B2::B2(B* buf) { stringReceive(buf, str_); } inline void B2::CalculateMarshallingSize(Counter& cntr) const { stringCount(cntr, str_); } inline void B2::SendMemberData(SendCompressedBuffer* buf) const { stringSend(buf, str_); } inline void B2::SendTypeNum(SendCompressedBuffer* buf) const { buf->Receive(&B2_num, sizeof(B2_num)); } template inline MI::MI(B* buf) : B1(buf), B2(buf) { unsigned int headCount[1]; buf->Give(headCount[0]); vec_.resize(vec_.size() + headCount[0]); buf->GiveBlock(&(*(vec_.end() - headCount[0])), headCount[0]); } inline void MI::CalculateMarshallingSize(Counter& cntr) const { B1::CalculateMarshallingSize(cntr); B2::CalculateMarshallingSize(cntr); cntr.Add(sizeof(uint32_t)); blockCount(cntr, vec_); } inline void MI::SendMemberData(SendCompressedBuffer* buf) const { unsigned int headCount; B1::SendMemberData(buf); B2::SendMemberData(buf); sendAsBlock(buf, vec_); } inline void MI::SendTypeNum(SendCompressedBuffer* buf) const { buf->Receive(&MI_num, sizeof(MI_num)); }