API_​Guid

Represents a GS::Guid in the API layer.

    typedef struct {
        UInt32             time_low;
        unsigned short     time_mid;
        unsigned short     time_hi_and_version;
        unsigned char      clock_seq_hi_and_reserved;
        unsigned char      clock_seq_low;
        unsigned char      node[6];
    } API_Guid;

 

Remarks

API_Guid is essentially a GS::Guid. It has the same size and structure, and only exists because of certain C++ language limitations: namely that a union (like API_Element) cannot contain a class which has a constructor or destructor. Since API_Elem_Head needs to contain a Guid member, and it cannot be a GS::Guid, the API_Guid structure was introduced.

This means that you should treat API_Guid structures as GS::Guid in your code, and use the following provided functions to convert between the two:

inline GS::Guid& APIGuid2GSGuid (API_Guid& guid)
inline const GS::Guid& APIGuid2GSGuid (const API_Guid& guid)
inline API_Guid& GSGuid2APIGuid (GS::Guid& guid)
inline const API_Guid& GSGuid2APIGuid (const GS::Guid& guid)

All these functions do two things:

  • check that API_Guid and GS::Guid are the same size at compile time and
  • reinterpret_cast the input API_Guid reference to a GS::Guid reference, or vice versa.

There are comparison operators (==, !=, <, <=, >, >=) defined to compare API_Guids with each other or with GS::Guids.

There’s also a macro called APINULLGuid for the API_Guid respresentation of the GS::NULLGuid constant.

From Archicad 12 you are able to use API_Guid for GS::HashTable key because it has GenerateHashValue method. Featuring API 12

 

Requirements

Version: API 11.01 or later
Header: API_Guid.hpp

 

See Also

GS::Guid,
API Types