![]() |
ROC SDK
2.4.0
Scalable Face Recognition Software
|
Functions for managing Universally Unique Identifiers (UUIDs) and data hashes. More...
Data Structures | |
| struct | roc_uuid_string |
| Printable version of a roc_uuid. More... | |
| struct | roc_hash_string |
| Printable version of a roc_hash. More... | |
| struct | roc_uuid |
| 128-bit universally unique identifier. More... | |
| struct | roc_hash |
| 160-bit data hash. More... | |
Macros | |
| #define | ROC_NO_TIMESTAMP 0xFFFFFFFFFFFFFFFF |
| Default value for roc_template::timestamp, indicating the template was generated from a still image. More... | |
Typedefs | |
| typedef struct roc_uuid_string | roc_uuid_string |
| Printable version of a roc_uuid. More... | |
| typedef struct roc_hash_string | roc_hash_string |
| Printable version of a roc_hash. More... | |
| typedef struct roc_uuid | roc_uuid |
| 128-bit universally unique identifier. More... | |
| typedef roc_uuid | roc_template_id |
| Unique identifier for a template. | |
| typedef roc_uuid | roc_person_id |
| Unique identifier for a person, the set of templates for the same identity. | |
| typedef roc_uuid | roc_group_id |
| Unique identifier for a group, the set of people for which membership is the same. | |
| typedef roc_uuid | roc_camera_id |
| Unique identifier for a camera. More... | |
| typedef roc_uuid * | roc_uuid_array |
| typedef roc_uuid_array | roc_person_id_array |
| A dynamically allocated array of roc_person_id. More... | |
| typedef struct roc_hash | roc_hash |
| 160-bit data hash. More... | |
| typedef roc_hash | roc_media_id |
| roc_hash_calc_sha1 of the (encoded) source media file. More... | |
| typedef roc_hash | roc_archive_id |
| roc_hash_calc_sha1 of the (encoded) recorded output media file. More... | |
| typedef uint64_t | roc_time |
| Time in milliseconds. | |
Functions | |
| roc_uuid_string | roc_uuid_to_string (roc_uuid uuid) |
| Convert a UUID to a string. More... | |
| const char * | roc_uuid_string_cast (const roc_uuid_string *uuid) |
| Helper function for printing roc_uuid_string in languages that can't handle fixed-length character arrays intelligently. More... | |
| roc_uuid | roc_uuid_from_string (const char *str) |
| Obtain a UUID from a string. More... | |
| roc_uuid | roc_uuid_get_random () |
| Initialize a roc_uuid to a random value. More... | |
| roc_hash_string | roc_hash_to_string (roc_hash hash) |
| Convert a hash to a string. More... | |
| const char * | roc_hash_string_cast (const roc_hash_string *hash) |
| Helper function for printing roc_hash_string in languages that can't handle fixed-length character arrays intelligently. More... | |
| roc_hash | roc_hash_from_string (const char *str) |
| Convert a string to a roc_hash. More... | |
| roc_hash | roc_hash_calc_sha1 (const uint8_t *input_byte_array, size_t length) |
Compute the SHA-1 hash of a data buffer. More... | |
| roc_hash | roc_hash_calc_sha1_file (const char *file_path) |
Compute a SHA-1 hash of a file. More... | |
| roc_hash | roc_hash_get_random () |
| Initialize a roc_hash from a random value. More... | |
| unsigned int | qHash (const roc_uuid &a) |
| For Qt qHash interoperability. | |
| roc_uuid | roc_uuid_from_bytes (const uint8_t *input_byte_array, size_t length) |
| Initialize a roc_uuid from a byte array. More... | |
| roc_uuid | roc_uuid_from_int (uint64_t val) |
| Obtain a roc_uuid from an integer value. More... | |
| uint64_t | roc_uuid_to_int (roc_uuid uuid) |
| Obtain an integer value from a roc_uuid. More... | |
| roc_uuid | roc_uuid_get_null () |
| Obtain a roc_uuid set to all zeros. More... | |
| bool | roc_uuid_is_null (roc_uuid uuid) |
| Check if a roc_uuid is all zeros. More... | |
| bool | roc_uuid_is_equal (roc_uuid a, roc_uuid b) |
| Compare two UUIDs for equality. More... | |
| bool | roc_uuid_is_less_than (roc_uuid a, roc_uuid b) |
| Compare two UUIDs for order. More... | |
| void | roc_free_uuid_array (roc_uuid_array *uuid_array) |
| Deallocate a roc_uuid_array. More... | |
| roc_hash | roc_hash_from_bytes (const uint8_t *input_byte_array, size_t length) |
| Initialize a roc_hash from a byte array. More... | |
| roc_hash | roc_hash_get_null () |
| Obtain a roc_hash set to all zeros. More... | |
| bool | roc_hash_is_null (roc_hash hash) |
| Check if a roc_hash is all zeros. More... | |
| bool | roc_hash_is_equal (roc_hash a, roc_hash b) |
| Compare two hashes for equality. More... | |
| bool | roc_hash_is_less_than (roc_hash a, roc_hash b) |
| Compare two hashes for order. More... | |
| roc_hash | roc_hash_from_uuid (roc_uuid uuid) |
| Obtain a hash from a UUID. More... | |
| roc_uuid | roc_hash_to_uuid (roc_hash hash) |
| Convert from a roc_hash to a roc_uuid. More... | |
Functions for managing Universally Unique Identifiers (UUIDs) and data hashes.
Construct UUIDs with roc_uuid_get_random and convert them to/from strings with roc_uuid_to_string / roc_uuid_from_string.
Construct hashes with roc_hash_calc_sha1 and convert them to/from strings with roc_hash_to_string / roc_hash_from_string.
| struct roc_uuid_string |
Printable version of a roc_uuid.
The string format is the UUID RFC 4122 style {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} where x is a hex digit.
These strings are fixed-length and thus do not need to be manually freed.
| Data Fields | ||
|---|---|---|
| char | data[39] | NULL-terminated string. |
| struct roc_hash_string |
Printable version of a roc_hash.
Hexadecimal format. These strings are fixed-length and thus do not need to be manually freed.
| Data Fields | ||
|---|---|---|
| char | data[41] | NULL-terminated string. |
| struct roc_uuid |
128-bit universally unique identifier.
Public Member Functions | |
| bool | operator== (const roc_uuid &other) const |
| bool | operator!= (const roc_uuid &other) const |
| bool | operator< (const roc_uuid &other) const |
| operator bool () const | |
Data Fields | |
| uint8_t | data [16] |
| Internal 128-bit data buffer. | |
|
inline |
|
inline |
Negation of roc_uuid_is_equal.
|
inline |
|
inline |
Negation of roc_uuid_is_null.
| struct roc_hash |
160-bit data hash.
Public Member Functions | |
| bool | operator== (const roc_hash &other) const |
| bool | operator!= (const roc_hash &other) const |
| Negation of roc_hash_is_equal. | |
| bool | operator< (const roc_hash &other) const |
| operator bool () const | |
| Negation of roc_hash_is_null. | |
Data Fields | |
| uint8_t | data [20] |
| Internal 160-bit data buffer. | |
|
inline |
|
inline |
| #define ROC_NO_TIMESTAMP 0xFFFFFFFFFFFFFFFF |
Default value for roc_template::timestamp, indicating the template was generated from a still image.
Equal to 2^64 - 1.
| typedef struct roc_uuid_string roc_uuid_string |
Printable version of a roc_uuid.
The string format is the UUID RFC 4122 style {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} where x is a hex digit.
These strings are fixed-length and thus do not need to be manually freed.
| typedef struct roc_hash_string roc_hash_string |
Printable version of a roc_hash.
Hexadecimal format. These strings are fixed-length and thus do not need to be manually freed.
128-bit universally unique identifier.
| typedef roc_uuid roc_camera_id |
Unique identifier for a camera.
| typedef roc_uuid* roc_uuid_array |
A dynamically allocated array of roc_uuid.
Free after use with roc_free_uuid_array.
| typedef roc_uuid_array roc_person_id_array |
A dynamically allocated array of roc_person_id.
Free after use with roc_free_uuid_array.
160-bit data hash.
| typedef roc_hash roc_media_id |
roc_hash_calc_sha1 of the (encoded) source media file.
| typedef roc_hash roc_archive_id |
roc_hash_calc_sha1 of the (encoded) recorded output media file.
| roc_uuid_string roc_uuid_to_string | ( | roc_uuid | uuid | ) |
Convert a UUID to a string.
| [in] | uuid | Binary UUID representation to convert from. |
| const char* roc_uuid_string_cast | ( | const roc_uuid_string * | uuid | ) |
Helper function for printing roc_uuid_string in languages that can't handle fixed-length character arrays intelligently.
| roc_uuid roc_uuid_from_string | ( | const char * | str | ) |
Obtain a UUID from a string.
The string format should be as defined in roc_uuid_string. If the conversion fails, the result will be roc_uuid_get_null.
| [in] | str | String UUID representation to convert from. |
| roc_uuid roc_uuid_get_random | ( | ) |
Initialize a roc_uuid to a random value.
| roc_hash_string roc_hash_to_string | ( | roc_hash | hash | ) |
Convert a hash to a string.
| [in] | hash | Binary hash representation to convert from. |
| const char* roc_hash_string_cast | ( | const roc_hash_string * | hash | ) |
Helper function for printing roc_hash_string in languages that can't handle fixed-length character arrays intelligently.
| roc_hash roc_hash_from_string | ( | const char * | str | ) |
Convert a string to a roc_hash.
If the conversion fails, the result will be roc_hash_get_null.
str must be a 40 character hexadecimal string, as produced by roc_hash_to_string.| [in] | str | 40-character hexadecimal representation to convert from. |
| roc_hash roc_hash_calc_sha1 | ( | const uint8_t * | input_byte_array, |
| size_t | length | ||
| ) |
Compute the SHA-1 hash of a data buffer.
If length is 0, the returned hash will be roc_hash_get_null.
| [in] | input_byte_array | Data buffer to compute the hash of. |
| [in] | length | Length of input_byte_array in bytes. |
| roc_hash roc_hash_calc_sha1_file | ( | const char * | file_path | ) |
Compute a SHA-1 hash of a file.
If file_path does not exist, can't be read, or the file is empty then the returned hash will be roc_hash_get_null.
| [in] | file_path | File to compute the hash of. |
| roc_hash roc_hash_get_random | ( | ) |
Initialize a roc_hash from a random value.
| roc_uuid roc_uuid_from_bytes | ( | const uint8_t * | input_byte_array, |
| size_t | length | ||
| ) |
Initialize a roc_uuid from a byte array.
Initializes the UUID by copying the leading bytes of input_byte_array. If length is less than sixteen, the remaining bytes in uuid will be set to zero. If length is greater than sixteen, the trailing bytes of input_byte_array will be ignored.
| [in] | input_byte_array | Value to initialize the roc_uuid to. |
| [in] | length | Length of input_byte_array. |
| roc_uuid roc_uuid_from_int | ( | uint64_t | val | ) |
Obtain a roc_uuid from an integer value.
The leading eight bytes of the returned roc_uuid are set to val.
| [in] | val | Integer value to set the leading bytes of uuid to. |
| uint64_t roc_uuid_to_int | ( | roc_uuid | uuid | ) |
Obtain an integer value from a roc_uuid.
Returns the leading eight bytes of uuid as an unsigned integer.
| [in] | uuid | UUID to return the the leading bytes of of. |
| roc_uuid roc_uuid_get_null | ( | ) |
Obtain a roc_uuid set to all zeros.
| bool roc_uuid_is_null | ( | roc_uuid | uuid | ) |
Check if a roc_uuid is all zeros.
| [in] | uuid | UUID to check for all zeros. |
Compare two UUIDs for equality.
| [in] | a | First UUID to compare for equality. |
| [in] | b | Second UUID to compare for equality. |
Compare two UUIDs for order.
Returns true is
, false otherwise.
| [in] | a | First UUID to compare for order. |
| [in] | b | Second UUID to compare for order. |
| void roc_free_uuid_array | ( | roc_uuid_array * | uuid_array | ) |
Deallocate a roc_uuid_array.
| [in] | uuid_array | Array to deallocate. |
| roc_hash roc_hash_from_bytes | ( | const uint8_t * | input_byte_array, |
| size_t | length | ||
| ) |
Initialize a roc_hash from a byte array.
Initializes the hash by copying the leading bytes of input_byte_array. If length is less than twenty, the remaining bytes in hash will be set to zero. If length is greater than twenty, the trailing bytes of input_byte_array will be ignored.
| [in] | input_byte_array | Value to set the roc_hash to. |
| [in] | length | Length of input_byte_array. |
| roc_hash roc_hash_get_null | ( | ) |
Obtain a roc_hash set to all zeros.
| bool roc_hash_is_null | ( | roc_hash | hash | ) |
Check if a roc_hash is all zeros.
| [in] | hash | Hash to check for all zeros. |
Compare two hashes for equality.
| [in] | a | First hash to compare for equality. |
| [in] | b | Second hash to compare for equality. |
Compare two hashes for order.
Returns true is
, false otherwise.
| [in] | a | First hash to compare for order. |
| [in] | b | Second hash to compare for order. |
Obtain a hash from a UUID.
Sets the leading sixteen bytes of the resulting hash to uuid, and the trailing four bytes to zero.
| [in] | uuid | UUID to convert. |
Convert from a roc_hash to a roc_uuid.
Sets the resulting UUID to the leading 16 bytes of hash.
| [in] | hash | Hash to convert. |
1.8.15