Re: [boost] [database] - guid class

This would be a very useful addition to boost. I have written several myself over the years, but none of boost quality unfortunatly. Its one of those fundamental types you need all the time. There is no strong connection between databases and uuids though; They are used in several other contexts as well. So I think it should be a freestanding library including the value class and the algorithms needed to generate them. If you are willing to donate your code and possibly submit it as a boost library, I'll be happy to help out. so please upload what you have to the vault. / Jonas Persson -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Andy Tompkins Sent: den 8 februari 2006 20:37 To: boost_dev Subject: [boost] [database] - guid class I can not find a guid/uuid class. Is there a guid/uuid class out there? I develop with Windows and found the strut GUID in <guiddef.h>, but I am looking for a class that has the member functions one would expect with a value class (ie comparison, equality, ...). I created a simple guid class and I am wondering if any one else would find it useful. I have read on this list about a proposed database library and I believe that it should have a guid class. Andy Tompkins _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

"Persson Jonas (ext)" <jonas.persson.ext@siemens.com> wrote in news:F93183188404D811A196000BCD2338CA0B34E934@ELEMA18A:
This would be a very useful addition to boost. I have written several myself over the years, but none of boost quality unfortunatly. Its one of those fundamental types you need all the time. There is no strong connection between databases and uuids though; They are used in several other contexts as well. So I think it should be a freestanding library including the value class and the algorithms needed to generate them. If you are willing to donate your code and possibly submit it as a boost library, I'll be happy to help out. so please upload what you have to the vault.
/ Jonas Persson
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Andy Tompkins Sent: den 8 februari 2006 20:37 To: boost_dev Subject: [boost] [database] - guid class
I can not find a guid/uuid class. Is there a guid/uuid class out there?
I develop with Windows and found the strut GUID in <guiddef.h>, but I am looking for a class that has the member functions one would expect with a value class (ie comparison, equality, ...). I created a simple guid class and I am wondering if any one else would find it useful. I have read on this list about a proposed database library and I believe that it should have a guid class.
Andy Tompkins _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
I would be quite willing to donate my code. I would also be very glad for any help and insite you have. I will submit my code to the vault in a few days (after I 'boostify' it a tad). Thanks for your response! Andy.

A quick "me too" on a guid class. I've used them both in database and non-database contexts (e.g. distributed processing / networking transactions), and keep modifying and using one a co-worker wrote ten years ago. I think this is one of those low-level utilities that fit perfectly in Boost and would have many users. Cliff

I have uploaded my initial version to the root directory of boost vault in order that others can view and critique it. In the near future, I plan to add code so that it conforms to the requirements of boost. Andy.

On 2/13/06, Andy Tompkins <atompkins@fastmail.fm> wrote:
I have uploaded my initial version to the root directory of boost vault in order that others can view and critique it. In the near future, I plan to add code so that it conforms to the requirements of boost.
Overall the code looks pretty good. I do have a few minorquibbles: - Use forward slashes (/) in include paths, not backslashes. - The ostream inserter might make good use of the IO State Saver class (http://boost.org/libs/io/doc/ios_state.html) - I'd ditch the braces in the stream input and output operations (but I'm not a big GUID user so perhaps these are handy). Or perhaps this could be controlled using a custom manipulator. - Do the stream operators need the try/catch block? I assume these exist to handle the case where the stream has exceptions enabled. In the catch block, the exception is just re-thrown, so is your exception handling even necessary? - The guid::create method only works for Windows. Perhaps an implementation using Boost.Random could be provided for other platforms without "native" GUID creation? There is a class called "zuid_t" in the Adobe Open-Source Libraries ( http://opensource.adobe.com/classadobe_1_1zuid__t.html) which might be useful as a reference design. It makes use of MD5 to produce a seed state for "zuid_t" generation. -- Caleb Epstein caleb dot epstein at gmail dot com

Caleb Epstein <caleb.epstein <at> gmail.com> writes:
On 2/13/06, Andy Tompkins <atompkins <at> fastmail.fm> wrote:
I have uploaded my initial version to the root directory of boost vault in order that others can view and critique it. In the near future, I plan to add code so that it conforms to the requirements of boost.
Overall the code looks pretty good. I do have a few minorquibbles:
- Use forward slashes (/) in include paths, not backslashes.
Thanks, will do.
- The ostream inserter might make good use of the IO State Saver class (http://boost.org/libs/io/doc/ios_state.html)
Thanks, will do.
- I'd ditch the braces in the stream input and output operations (but I'm not a big GUID user so perhaps these are handy). Or perhaps this could be controlled using a custom manipulator.
I was unsure about your suggestion at first, but I now agree with you. I will make the output operator exclude the braces by default, and I will add a custom manipulator to include them. The input operator will work with or without braces.
- Do the stream operators need the try/catch block? I assume these exist to handle the case where the stream has exceptions enabled. In the catch block, the exception is just re-thrown, so is your exception handling even necessary?
I believe you are correct in that they are not necesssary. I will remove them, thanks.
- The guid::create method only works for Windows. Perhaps an implementation using Boost.Random could be provided for other platforms without "native" GUID creation?
There is a class called "zuid_t" in the Adobe Open-Source Libraries ( http://opensource.adobe.com/classadobe_1_1zuid__t.html) which might be useful as a reference design. It makes use of MD5 to produce a seed state for "zuid_t" generation.
I am currently creating a platform independent create method. Thanks for the link.
-- Caleb Epstein caleb dot epstein at gmail dot com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
I hope to put a new version in the boost vault soon. Thanks again for you comments. Andy Tompkins

Hi Andy, I've just downloaded your boost::guid class to perform some tests and verify its applicability in our development but I've noticed that with VC++ NET 7.1 IDE you have to specify the option /Zc:wchar_t during the compilation of guid.cpp file in order to run properly. This is my first feedback. I'm going to test it to give you more valuable feedbacks. Do you have any unit test of your implementation? Best regards Marc Viala
Andy Tompkins wrote:
I have uploaded my initial version to the root directory of boost vault in order that others can view and critique it. In the near future, I plan to add code so that it conforms to the requirements of boost.
Andy.

Marc VIALA <mviala <at> acticm.com> writes:
Hi Andy,
I've just downloaded your boost::guid class to perform some tests and verify its applicability in our development but I've noticed that with VC++ NET 7.1 IDE you have to specify the option /Zc:wchar_t during the compilation of guid.cpp file in order to run properly.
I here what you are saying and I haven't yet tried it out. I am creating bjam files so that one can compile it like and other boost library in the hopes that this will let user set it as they like.
This is my first feedback. I'm going to test it to give you more valuable feedbacks.
Do you have any unit test of your implementation?
I have created unit tests now and hope to put a new version in the boost vault soon.
Best regards
Marc Viala
Andy Tompkins wrote:
I have uploaded my initial version to the root directory of boost vault in order that others can view and critique it. In the near future, I plan to add code so that it conforms to the requirements of boost.
Andy.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks. Andy Tompkins

De : boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] De la part de Andy Tompkins Envoyé : vendredi 17 février 2006 16:57 À : boost@lists.boost.org Objet : Re: [boost] [database] - guid class
Marc VIALA <mviala <at> acticm.com> writes:
Hi Andy,
I've just downloaded your boost::guid class to perform some tests and
verify
its applicability in our development but I've noticed that with VC++ NET 7.1 IDE you have to specify the option /Zc:wchar_t during the compilation of guid.cpp file in order to run properly.
I here what you are saying and I haven't yet tried it out. I am creating bjam files so that one can compile it like and other boost library in the hopes that this will let user set it as they like.
This is my first feedback. I'm going to test it to give you more
valuable
feedbacks.
Do you have any unit test of your implementation?
I have created unit tests now and hope to put a new version in the boost vault soon.
Thanks for taking account my request. By the way, by looking more carefully your interface, I didn't see how to have a reading access to the raw struct of the guid: attribute guid;;_data, more precisely, to the raw data pointer: guid::_data.elems. This reading access could be useful for low level access. Does that make sense?

< snip >
By the way, by looking more carefully your interface, I didn't see how to have a reading access to the raw struct of the guid: attribute guid;;_data, more precisely, to the raw data pointer: guid::_data.elems. This reading access could be useful for low level access. Does that make sense?
This does make sense. I have added a constructor to initialize from raw data: template <ByteInputIterator> guid(ByteInputIterator first, ByteInputIterator last); and a function to get out the raw bytes: template <ByteOutputIterator> void output_bytes(ByteOutputIterator out) { std::copy(data_.begin(), data_.end(), out); } Is output_bytes what you are looking for? Andy.

< snip >
By the way, by looking more carefully your interface, I didn't see how to have a reading access to the raw struct of the guid: attribute guid;;_data, more precisely, to the raw data pointer: guid::_data.elems. This reading access could be useful for low level access. Does that make sense?
This does make sense. I have added a constructor to initialize from raw data:
template <ByteInputIterator> guid(ByteInputIterator first, ByteInputIterator last);
and a function to get out the raw bytes:
template <ByteOutputIterator> void output_bytes(ByteOutputIterator out) { std::copy(data_.begin(), data_.end(), out); }
Is output_bytes what you are looking for?
I'm just looking for the raw data pointer of the underlying implementation of boost::array; but your proposal is ok and if I follow you it will be possible to write: boost::guid id ; std::vector<char> bytes ; id.output_bytes(std::back_inserter(bytes)) ; But, in that case, it will not be possible to preallocate the output buffer size because there is no way to get the underlying buffer size (_data). Do you plan to return the buffer size. Thanks in advance. Marc Viala
participants (6)
-
Andy
-
Andy Tompkins
-
Caleb Epstein
-
Cliff Green
-
Marc VIALA
-
Persson Jonas (ext)