Archicad 28 C++ API
Loading...
Searching...
No Matches
API_Guid Struct Reference

Represents a GS::Guid in the API layer. More...

#include <API_Guid.hpp>

Public Member Functions

ULong GenerateHashValue () const
 Generate a hash value that's why API_Guid can be used with GS::HashTable.
 

Detailed Description

Represents a GS::Guid in the API layer.

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 that 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: ```cpp 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::Guid s. There's also a macro called APINULLGuid for the API_Guid representation of the GS::NULLGuid constant. From Archicad 12 you are able to use API_Guid for GS::HashTable key because it has GenerateHashValue method.

Member Function Documentation

◆ GenerateHashValue()

ULong API_Guid::GenerateHashValue ( ) const
inline

Generate a hash value that's why API_Guid can be used with GS::HashTable.

Returns
Generated hash value.