Re: /bzr/squid3/trunk/ r10914: Added InstanceId to uniquely identify concurrent messages, transactions, etc.

From: Kinkie <gkinkie_at_gmail.com>
Date: Tue, 5 Oct 2010 11:43:02 +0200

Hi,
  I'm glad to see that you got around to implementing this - I had
toyed with it myself, but with inferior results.

On Mon, Oct 4, 2010 at 4:49 PM, Alex Rousskov
<rousskov_at_measurement-factory.com> wrote:

> + */
> +template <class Class>
> +class InstanceId
> +{
> +public:
> +    typedef unsigned int Value; ///< id storage type; \todo: parameterize?

Why not use uint32_t? It's defined, and it gives consistent wrapping results

> +
> +    InstanceId(): value(++Last ? Last : ++Last) {}

It seems that you don't like object-id 0. Is there any particular
reason for this?

> +
> +    operator Value() const { return value; }
> +    bool operator ==(const InstanceId &o) const { return value == o.value; }
> +    bool operator !=(const InstanceId &o) const { return !(*this == o); }

While these don't hurt, I can't really understand where they could be
useful. Are they?

Thanks,

-- 
    /kinkie
Received on Tue Oct 05 2010 - 09:43:08 MDT

This archive was generated by hypermail 2.2.0 : Tue Oct 05 2010 - 12:00:04 MDT