From: Andrew on
Hello,

I need a uuid class. After a bit of googling I see that at some point
there was some work in boost for this but it looks like it will be a
while before it is generally available. It is not in 1.41.1. Does
anyone know if there is one available elsewhere? It must be portable
of course. The project I am currently working on uses the UUID stuff
from Microsoft (for RPC). I want to avoid such lock-in.

uuids are quite tricky to implement from scratch. I tried to do it
myself several years ago, using ideas from the uids in DCE. One of the
problems is in efficiently generating random numbers with a large
period. Plus, they have to be unique across machines where several
processes on several machines may be generating them simulataneously.
This will definately be the case for my app. I reckon this is why such
uids often incorporate elements of the IP or MAC address. That's
tricky to do in a portable and efficient way. Last time I did it I
wound up having to interrogate the ethervard card using int86
(uurrgghh) on windows and using ioctl for solaris (eeuuggh).

Regards,

Andrew Marlow

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: George Neuner on
On Thu, 10 Dec 2009 08:03:21 CST, Andrew
<marlow.andrew(a)googlemail.com> wrote:

>I need a uuid class. After a bit of googling I see that at some point
>there was some work in boost for this but it looks like it will be a
>while before it is generally available. It is not in 1.41.1. Does
>anyone know if there is one available elsewhere? It must be portable
>of course. The project I am currently working on uses the UUID stuff
>from Microsoft (for RPC). I want to avoid such lock-in.

I don't know offhand how portable it is, but the uuid implementation
that is in Linux's EXT2/EXT3 filesystem is used by a number of systems
that need global identifiers. See the e2fsprogs package.

George

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Michael Oswald on
>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-Original-Date: Fri, 11 Dec 2009 10:57:23 +0100
X-Submission-Address: c++-submit(a)netlab.cs.rpi.edu

Hello Andrew,


Andrew wrote:
> Hello,
> I need a uuid class. After a bit of googling I see that at some point
> there was some work in boost for this but it looks like it will be a
> while before it is generally available. It is not in 1.41.1. Does
> anyone know if there is one available elsewhere? It must be portable
> of course. The project I am currently working on uses the UUID stuff
> from Microsoft (for RPC). I want to avoid such lock-in.

You can have a look at Poco, which does have a portable UUID class. I
don't know if it suits you, but you can have a look:

http://pocoproject.org

Just look under Documentation in the Foundation classes.


lg,
Michael



--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Goran Pusic on
>
Content-Type: text/plain; charset=ISO-8859-1
X-Original-Date: Fri, 11 Dec 2009 03:32:07 -0800 (PST)
X-Submission-Address: c++-submit(a)netlab.cs.rpi.edu

On Dec 10, 3:03 pm, Andrew <marlow.and...(a)googlemail.com> wrote:
> Hello,
>
> I need a uuid class. After a bit of googling I see that at some point
> there was some work in boost for this but it looks like it will be a
> while before it is generally available. It is not in 1.41.1. Does
> anyone know if there is one available elsewhere? It must be portable
> of course. The project I am currently working on uses the UUID stuff
> from Microsoft (for RPC). I want to avoid such lock-in.
>
> uuids are quite tricky to implement from scratch. I tried to do it
> myself several years ago, using ideas from the uids in DCE. One of the
> problems is in efficiently generating random numbers with a large
> period. Plus, they have to be unique across machines where several
> processes on several machines may be generating them simulataneously.
> This will definately be the case for my app. I reckon this is why such
> uids often incorporate elements of the IP or MAC address. That's
> tricky to do in a portable and efficient way. Last time I did it I
> wound up having to interrogate the ethervard card using int86
> (uurrgghh) on windows and using ioctl for solaris (eeuuggh).
>

I wonder why do you need a class for that.

Also, I'd be amazed that you have a target system where you want an
UUID and that system doesn't already have function for that. It's
certainly one call away on a Unix clone (uuid_generate) and Windows
(CoCreateGUID).

Goran.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Joe Smith on

"Andrew" <marlow.andrew(a)googlemail.com> wrote in message
news:e8392674-e550-4625-9ca3-138a5d289c0e(a)c3g2000yqd.googlegroups.com...
> Hello,
>
> I need a uuid class. After a bit of googling I see that at some point
> there was some work in boost for this but it looks like it will be a
> while before it is generally available. It is not in 1.41.1. Does
> anyone know if there is one available elsewhere? It must be portable
> of course. The project I am currently working on uses the UUID stuff
> from Microsoft (for RPC). I want to avoid such lock-in.
>
> uuids are quite tricky to implement from scratch. I tried to do it
> myself several years ago, using ideas from the uids in DCE. One of the
> problems is in efficiently generating random numbers with a large
> period. Plus, they have to be unique across machines where several
> processes on several machines may be generating them simulataneously.
> This will definately be the case for my app. I reckon this is why such
> uids often incorporate elements of the IP or MAC address. That's
> tricky to do in a portable and efficient way. Last time I did it I
> wound up having to interrogate the ethervard card using int86
> (uurrgghh) on windows and using ioctl for solaris (eeuuggh).

UUIDs have a very specific format to reduce the possibility of collision.
Thus you should not be implementing them if you think they ever contain an
IP address.
(Hint they never do, but type A does use a MAC address). The only way to
create valid UUIDs
is standard C++ is to use the types bashed on hashing the name of the
object. That in turn requires a universally unique name, such as a URN.

Somewhat portable (i.e. portable to Windows, OS X, Linux, and perhaps some
Unices) do exist, one that Wikipedia points out is the class in Qt.
Otherwise, most of the rest of the solutions seem to be either Windows
specific or POSIX-specific.



--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]