Re: [LAD] Inter thread Communication: Design Approach

From: David Robillard <d@email-addr-hidden>
Date: Fri Sep 02 2011 - 18:22:01 EEST

On Thu, 2011-09-01 at 21:29 -0500, Gabriel Beddingfield wrote:
> On 09/01/2011 01:18 PM, David Robillard wrote:
> >
> > The main issue you'll find with going the C++/RTTI route is that #2 no
> > longer is possible, since virtual objects are not POD, so you can't
> > safely write them through a ringbuffer (or copy them around manually in
> > general).
> [snip]
>
> Correct me if I'm wrong... but...
>
> >> class event_two_t : public event_t
> >> {
> >> public:
> >> int type() { return int(EVENT_TWO); }
> >> uint32_t size() { return sizeof(event_two); }
> >>
> >> /* event-specific stuff */
> >> };
>
> The intention of the size() member function is to allow you to memcpy()
> the object without knowing its type. Is that not enough?

Because it uses inheritance, this object is not POD, so strictly
speaking no.

-dr

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Sep 2 20:15:02 2011

This archive was generated by hypermail 2.1.8 : Fri Sep 02 2011 - 20:15:02 EEST