OCAF: how to assign the GUID of a driver

Hi, All,

I am studying the ocaf example, and want to develop drivers, but I am not clear how the GUID of a driver, for example, in the box driver:

const Standard_GUID& TOcafFunction_BoxDriver::GetID() {
static Standard_GUID anID("22D22E51-D69A-11d4-8F1A-0060B0EE18E8");
return anID;

How I know to assign its ID is "22D22E51-D69A-11d4-8F1A-0060B0EE18E8" or others. I know it should be a string of 37 characters.

Thanks in advances!

Chris

Marco Matt's picture

When you develop a custom driver you have to assign a unique identifier.

On linux (and windows) you use "uuigen" to generate an ID.

Wang Chris's picture

Hi, Macro,

Thanks for your reply. I am not so clear what you said. You mean the ID can randomly be assigned by me, then the windows will aotuomatically geneate it using Uuidgen when I put it like " static Standard_GUID anID("22D22E51-D69A-11d4-8F1A-0060B0EE18E8")?

Thanks!

Sharjith Naramparambath's picture

You have to generate a UUID using the GUIDGEN.exe or uuidgen.exe utility shipped with Visual Studio. It will randomly create a uuid which you have to simply copy and paste. GUIDGEN.exe is a GUI based tool which generates it interactively and allows to copy the uuid to clipboard. uuidgen.exe is a command line based tool. Then use the newly generated id as the identifier of your driver. You have to do this for every driver you create of your own. Remember to use the one of the above format only -- UUIDGEN.exe provides different formats. Since it is such a large alphanumeric combination generated based on the mac address and system time of the pc there is very very very little chance that the identifier would not be a unique one -- so you don't have to worry.

Hope this helps

Regards
N. Sharjith

Wang Chris's picture

Thanks a lot, Sharjith!

Regards
Chris