qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stitcher <astitc...@redhat.com>
Subject Re: [c++]: messaging api, uuids and handles
Date Thu, 14 Jan 2010 16:05:42 GMT
On Thu, 2010-01-14 at 09:06 -0500, Alan Conway wrote:
> On 01/13/2010 11:04 AM, Andrew Stitcher wrote:
> > On Wed, 2010-01-13 at 10:52 -0500, Alan Conway wrote:
> >> On 01/13/2010 09:42 AM, Gordon Sim wrote:
> >>> I have an outstanding Jira (QPID-2323) to add support for uuids as a
> >>> value for a Variant in the 'new' API (it is wanted for QMF and seems
> >>> like it might be a generically useful type).
> >>>
> >>> The current Uuid class is in qpid::framing and has exposed dependencies
> >>> on things I don't want to be part of the API (such as boost::array and
> >>> qpid::framing::Buffer).
> >>>
> >>> My thought therefore is to create a copy of that class in the
> >>> qpid::messaging namespace, pimpled and cleaned up to avoid the undesired
> >>> dependencies. Does that sound like the right approach?
> >>
> >> I don't think it should be pimpled, it's a value type and the 16-byte
> >> representation will never change. I'd suggest a char[16] member and manually
> >> write the stuff that boost::array provides (copy, assign etc.)
> >
> > I think it's a toss up between these approaches, but I'd note that
> > pimpling will allow force you to make the interface explicit (including
> > the assigns/copies etc.) so that you should easily be able to move to
> > the other implementation. Although in that case the ABI would change,
> > but the effective API wouldn't.
> 
> I think the key point here is that a pimpl has reference semantics rather than 
> value semantics. I think UUID should have value semantics i.e.
>    Uuid x = ...;
>    UUid y = x;
>    // modifing y should not affect x
> With pimpl, modifying y *will* modify x since y is a reference to the same impl 
> as x,

Not if you have a copying assignment operator, which I think I included
above, In that case you get value semantics.

I agree Uuid should have value semantics, but you _can_ implement with a
pimpl.

Andrew



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message