> For the complete documentation index, see [llms.txt](https://docs.optitrack.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optitrack.com/v3.4/developer-tools/camera-sdk/class-cuid.md).

# Class: cUID

### UID.h

Located in **\OptiTrack\CameraSDK\include**

```
//======================================================================================================
// Copyright 2012, NaturalPoint Inc.
//======================================================================================================
#pragma once

#include <iosfwd>
#include <functional>

#include "Core/BuildConfig.h"

#ifdef __PLATFORM__LINUX__
#include "Core/Platform.h"
#endif

namespace Core
{
    /// <summary>
    /// A platform-neutral 128-bit universal identifier. It is essentially guaranteed to never
    /// generate the same ID twice.
    /// </summary>
    class CORE_API cUID
    {
    public:
        using uint64 = unsigned long long int;

        /// <summary>
        /// Create a default UID. In order to create a UID that has a valid unique identifier you
        /// must call Generate().
        /// </summary>
        cUID() : mHighBits( 0 ), mLowBits( 0 ) { }

        cUID( uint64 high, uint64 low ) : mHighBits( high ), mLowBits( low ) { }

        /// <summary>
        /// Set the value of the UID from two long integer values. It is up to the caller to ensure that
        /// the resulting UID is unique.
        /// </summary>
        void SetValue( uint64 highBits, uint64 lowBits )
        {
            mHighBits = highBits;
            mLowBits = lowBits;
        }

        /// <summary>Get the low 64 bits of the UID.</summary>
        uint64 LowBits() const
        {
            return mLowBits;
        }

        /// <summary>Get the high 64 bits of the UID.</summary>
        uint64 HighBits() const
        {
            return mHighBits;
        }

        /// <summary>Returns true if the ID is valid (i.e. not equal to kInvalid).</summary>
        bool Valid() const
        {
            return !( mHighBits == 0 && mLowBits == 0 );
        }

        /// <summary>Generate a new UID value.</summary>
        static cUID Generate();

        //==============================================================================================
        // Comparison operators
        //==============================================================================================

        bool operator<( const cUID & rhs ) const
        {
            return ( ( mHighBits < rhs.mHighBits ) ? true : ( mHighBits == rhs.mHighBits ? ( mLowBits < rhs.mLowBits ) : false ) );
        }
        bool operator<=( const cUID & rhs ) const
        {
            return ( ( mHighBits < rhs.mHighBits ) ? true : ( mHighBits == rhs.mHighBits ? ( mLowBits <= rhs.mLowBits ) : false ) );
        }

        bool operator>( const cUID & rhs ) const
        {
            return !( *this <= rhs );
        }
        bool operator>=( const cUID & rhs ) const
        {
            return !( *this < rhs );
        }

        cUID operator^( const cUID &rhs ) const
        {
            return cUID( mHighBits ^ rhs.mHighBits, mLowBits ^ rhs.mLowBits );
        }

        // Inline these for performance.
        bool operator==( const cUID & rhs ) const
        {
            return ( ( mHighBits == rhs.mHighBits ) && ( mLowBits == rhs.mLowBits ) );
        }

        bool operator!=( const cUID & rhs ) const
        {
            return ( ( mHighBits != rhs.mHighBits ) || ( mLowBits != rhs.mLowBits ) );
        }

        //==============================================================================================
        // Constants
        //==============================================================================================

        static const cUID kInvalid;

    private:
        uint64 mHighBits;
        uint64 mLowBits;
    };

    //======================================================================================================
    // Operators
    //======================================================================================================
#if !defined(__PLATFORM__LINUX__) // The following methods are problematic to compile under Linux

    CORE_API std::ostream& operator<<( std::ostream& os, const Core::cUID& id );
    CORE_API std::istream& operator>>( std::istream& is, Core::cUID& id );

    CORE_API std::wostream& operator<<( std::wostream& os, const Core::cUID& id );
    CORE_API std::wistream& operator>>( std::wistream& is, Core::cUID& id );

#endif // !defined(__PLATFORM__LINUX__)
}

#if _MSC_VER > 1600 || defined(__PLATFORM__LINUX)
namespace std
{
    // Hash template specialization for cUID. Allows it to be used as a key for things like std::unordered_set.
    template<> struct hash<Core::cUID>
    {
        size_t operator()( const Core::cUID& s ) const
        {
            size_t h1( std::hash<unsigned long long>{}( s.HighBits() ) );
            size_t h2( std::hash<unsigned long long>{}( s.LowBits() ) );
            return ( h1 ^ ( h2 << 1 ) );
        }
    };
}
#endif
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.optitrack.com/v3.4/developer-tools/camera-sdk/class-cuid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
