# Class Structure

```mermaid
classDiagram
    class UserDataManager {
        +String UserId
        +String TestingToken
        +String ServerApiAddress
        +Array UserTrainedModels
        +Signal TokenChanged
        +FetchUserIdFromApi()
        +FetchUserTrainedModels()
        +DownloadModelAsync()
        +ResetData()
        +SanitizeString()
        +ParseCommandLineArgs()
    }

    class Main {
        +int BenchmarkIterations
        +bool RunBenchmark
        +String ServerApiAddress
        +String TestingToken
        +GazeEstimation _gazeEstimation
        +Ui _ui
        +_Ready()
        +OnTokenChanged()
        +TestApiEndpoint()
    }

    class UI {
        +bool camera_enabled
        +bool submit_to_vrchat_osc
        +bool submit_to_openxr
        +bool submit_to_vrcft
        +bool submit_to_buffered_capture
        +bool submit_to_viewer
        +bool left_eye_enabled
        +bool right_eye_enabled
        +String user_id
        +String user_testing_token
        +String unique_username
        +Array model_names
        +Signal TokenChanged
        +Signal ModelSelected
        +_Ready()
        +_Process()
        +OnTokenChanged()
        +HandleModelSelection()
    }

    class GazeEstimation {
        +int BenchmarkIterations
        +bool RunBenchmark
        -NeuralNetwork _neuralNetwork
        +_Ready()
        +ProcessFrame()
        +RunBenchmarkTest()
        +OnModelSelected()
    }

    class NeuralNetwork {
        +String EncryptedModelPath
        -String _inputName
        -int _inputHeight
        -int _inputWidth
        -int _inputChannels
        +_Ready()
        +LoadModel()
        +ProcessFrame()
        +GetTopPredictions()
    }

    class EyeTrackingData {
        +float LeftEyeX
        +float LeftEyeY
        +float LeftEyeOpenness
        +float RightEyeX
        +float RightEyeY
        +float RightEyeOpenness
        +float Confidence
        +long Timestamp
    }

    class EyeData {
        +Vector2 LeftPos
        +Vector2 RightPos
        +float Timestamp
        +EyeData()
        +EyeData(Vector2, Vector2)
    }

    class EyeTrackingProducer {
        -List~IEyeTrackingObserver~ _observers
        +RegisterObserver()
        +RemoveObserver()
        #NotifyObservers()
    }

    class IEyeTrackingObserver {
        <<interface>>
        +OnEyeDataUpdate()
    }

    class EyeTrackingConsumer {
        +String Name
        +bool Enabled
        #EyeTrackingData LastData
        +OnEyeDataUpdate()
        #ProcessData()
        +Enable()
        +Disable()
    }

    class AsyncConsumer {
        -BlockingCollection~EyeTrackingData~ _queue
        -int _queueSize
        -Thread _workerThread
        -bool _running
        +Start()
        +Stop()
    }

    class MemmapConsumer {
        -MemoryMappedFile _sharedMem
        -MemoryMappedViewAccessor _accessor
        -bool _running
        +InitializeMemmap()
        #ProcessData()
        +Stop()
    }

    class AcquisitionManager {
        +int FrameRate
        +Camera3D VrCamera
        +XROrigin3D XrOrigin
        +Node3D Target
        +float Distance
        -float _frameInterval
        -CameraManager _cameraManager
        -bool _recording
        -DataRecorder _dataRecorder
        -Visualizer _visualizer
        -EyeDataProcessor _eyeProcessor
        -int _frameCount
        -EyeData _lastEyeData
        +_Ready()
        +_Process()
        +Start()
        +Stop()
        -ProcessFrame()
        -AcquisitionLoop()
        -RepositionRig()
    }

    class EyeDataProcessor {
        +float MaxEyeDataAge
        +ValidateEyeData()
    }

    class Visualizer {
        -bool _initialized
        +InitRerun()
        +UpdateVisualization()
        -DrawEyePositions()
    }

    class DataRecorder {
        +RecordFrame()
        +RecordEyeData()
        +Start()
    }

    class TestAcquisition {
        +Camera3D VrCamera
        +XROrigin3D XrOrigin
        +Node3D Target
        -AcquisitionManager _acquisitionManager
        -bool _isRecording
        -Timer _startTimer
        -Timer _stopTimer
        +_Ready()
        +_Process()
        -OnStartTimerTimeout()
        -OnStopTimerTimeout()
    }

    Main --> UI : contains
    Main --> GazeEstimation : contains
    GazeEstimation --> NeuralNetwork : contains
    Main ..> UserDataManager : uses
    UI ..> UserDataManager : uses
    GazeEstimation ..> UserDataManager : uses
    MemmapConsumer --|> AsyncConsumer : inherits
    AsyncConsumer --|> EyeTrackingConsumer : inherits
    EyeTrackingConsumer ..|> IEyeTrackingObserver : implements
    EyeTrackingProducer ..> EyeTrackingData : uses
    MemmapConsumer ..> EyeTrackingData : uses
    AcquisitionManager --> EyeDataProcessor : contains
    AcquisitionManager --> Visualizer : contains
    AcquisitionManager --> DataRecorder : contains
    TestAcquisition --> AcquisitionManager : contains
```

## Interaction Flow

```mermaid
flowchart LR
    Main -->|"Stores ServerApiAddress\nUpdates TestingToken\nFetches UserId"| UserDataManager
    UI -->|"Updates TestingToken\nFetches UserId and Models\nDownloads models"| UserDataManager
    GazeEstimation -->|"Accesses user models\nDownloads models"| UserDataManager
    MemmapConsumer -->|"Processes and shares"| EyeTrackingData
    AcquisitionManager -->|"Records and visualizes"| EyeTrackingData
    TestAcquisition -->|"Controls recording"| AcquisitionManager
```

The diagrams above show:
1. The class hierarchy and relationships between components
2. The interaction flow between different components and the UserDataManager
3. The key properties and methods of each class
4. The dependencies between components
5. The eye tracking data flow and processing pipeline
6. The test and acquisition management components

Note: These diagrams will render properly in Markdown viewers that support Mermaid (like GitHub, GitLab, or VS Code with Mermaid extension). 