void Show_Key_Status (HC_KEY key, char *status)
 Helps to maintain lists of valid keys. More...
void Show_Key_Type (HC_KEY key, char *type)
 Returns the type of object referenced by a key. More...

Detailed Description

Function Documentation

◆ Show_Key_Status()

void Show_Key_Status ( HC_KEY  key,
char *  status 

Helps to maintain lists of valid keys.

key- Numeric identifier pointing to an object in the database.
status- valid: key has not been renumbered. global: key has been globally renumbered. local: key has been locally renumbered. invalid: key has been deleted. Returned to caller. Passed by reference always.


This function can be used to indicate whether a key has been deleted or renumbered.

Indirect Keys vs. Direct Keys

HOOPS uses two types of internal keys to identify objects in the database: direct keys and indirect keys. All internal keys have 1 as the value of the most significant bit (making it look like a negative value).
An indirect key can be identified by the second most significant bit in the key value (it's an indirect key if the second MSB is 1). Indirect keys maintain information about status, whereas direct keys can be ephemeral and may not be available after the database is modified.

Indirect Keys

For most applications, there is an inexhaustible supply of indirect keys. For 32-bit systems, there are approximately 10^9 indirect keys (precisely 2^30). When that number is exhausted, old keys will then be reused. In this case Show_Key_Status() will return the results for the newest key.
For 64-bit systems, there are approximately 4.6x10^18 indirect keys (precisely 2^62). Therefore indirect keys can be regarded as permanent. HC_Show_Key_Status will always return the precise result for a given indirect key, regardless of its age.

Direct Keys

Direct keys are generated by internal processes, such as static trees, and are most often encountered in search results. Direct keys are temporary and may be invalidated when the database is next modified. After that, HC_Show_Key_Status may show erroneous results.

◆ Show_Key_Type()

void Show_Key_Type ( HC_KEY  key,
char *  type 

Returns the type of object referenced by a key.

key- Unique numeric identifier pointing to an object in the database.
type- Classification of object referenced by key. Returned to caller. Passed by reference always.


You can find out what kind of object was chosen in a Show_Selection_Element() operation, or found by a Begin_Contents_Search(), or added to the database in a previous Insert or Open_Segment() by using this command.

The type returned can be either geometry or one of the various segment or include types.

The following is a table of geometry types that can be returned:

circle circular arc circular chord circular wedge
circular plane circular section cylinder ellipse
elliptical arc grid image line
area light distant light local light spot light
marker mesh cylinder nurbs curve
nurbs surface polygon polyline polycylinder
shell sphere text

The following is a table of segment types that can be returned:

segment include reference geometry style

Given the type returned by this function, you can use a Show routine such as Show_Line() to determine the details of the geometry, or Show_Segment() to determine the name of the segment pointed to by key. The status field can be valid (normal), local or global (renumbered).


If key is invalid, unpredictable results will ensue. Don't rely on HOOPS being able to protect you from invalid keys.


See also
Show_Existence, Show_Owner, Begin_Contents_Search, Get_Selection, Insert_Line, Open_Segment, Show_Polyline, Show_Shell, Show_Marker.