pr_getuniqueidentity.rst (1285B)
1 PR_GetUniqueIdentity 2 ==================== 3 4 Asks the runtime to allocate a unique identity for a layer identified by 5 the layer's name. 6 7 8 Syntax 9 ------ 10 11 .. code:: 12 13 #include <prio.h> 14 15 PRDescIdentity PR_GetUniqueIdentity(const char *layer_name); 16 17 18 Parameter 19 ~~~~~~~~~ 20 21 The function has the following parameter: 22 23 ``layer_name`` 24 The string associated with the creation of a layer's identity. 25 26 27 Returns 28 ~~~~~~~ 29 30 The function returns one of the following values: 31 32 - If successful, the :ref:`PRDescIdentity` for the layer associated with 33 the string specified in the layer named ``layer_name``. 34 - If the function cannot allocate enough dynamic memory, it fails and 35 returns the value ``PR_INVALID_IO_LAYER`` with the error code 36 ``PR_OUT_OF_MEMORY_ERROR``. 37 38 39 Description 40 ----------- 41 42 A string may be associated with a layer when the layer is created. 43 :ref:`PR_GetUniqueIdentity` allocates a unique layer identity and 44 associates it with the string. The string can be subsequently passed to 45 :ref:`PR_CreateIOLayerStub` to create a new file descriptor of that layer. 46 47 Call :ref:`PR_GetUniqueIdentity` only once for any particular layer name. 48 If you're creating a custom I/O layer, cache the result, and then use 49 that cached result every time you call :ref:`PR_CreateIOLayerStub`.