# genicam/harvesters architecture

> Architecture diagram of the GitHub repository genicam/harvesters, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/genicam/harvesters
- Repository: https://github.com/genicam/harvesters

## Overview

##### Main Components

a) Core Components:
- Image Acquisition Engine (Harvester Core)
- GenTL Producer Interface
- GenICam Interface
- Buffer Management System
- Device Management System

b) Supporting Components:
- Logging System
- Utility Functions
- Test Framework

**Application Layer**

**Harvester Core Layer**

**Interface Layer (GenTL & GenICam)**

**Hardware Layer (Cameras/Devices)**

##### Component Relationships

- How the Harvester Core communicates with GenTL Producers
- Image data flow from devices through buffers
- Demonstrate the relationship between the core and its supporting modules

##### Specific Implementation Details

Key classes/modules (based on the file structure):
- ImageAcquirer (core.py)
- Port Management (port.py)
- Command Interface (command.py)
- Statistics Handler (statistics.py)
- Observer Pattern Implementation (observer.py, subject.py)

##### Design Elements

Use the following visual elements:
- Blue rectangles for core components
- Green rectangles for interfaces
- Yellow rectangles for supporting modules
- Red rectangles for external dependencies

##### Detailed Component Breakdown

**┌─ Harvester Core ─────────────────┐**
- ┌─ Device Management ─┐          │
- Device Discovery  │          │
- Device Control    │          │
- ┘          │
- ┌─ Buffer Management ─┐          │
- Image Acquisition │          │
- Buffer Handling   │          │
- ┘          │
- ┘

##### Technical Notes

Annotations for:
- Supported image formats
- Buffer management strategy
- Device discovery mechanism
- Error handling flow

##### Implementation Notes

- The modular design shown in src/harvesters/_private/core/
- The separation of concerns between core functionality and utilities
- The test framework integration
- The logging system architecture

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef interface fill:#90EE90,stroke:#333,stroke-width:2px
    classDef support fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef external fill:#FFB6C0,stroke:#333,stroke-width:2px
    
    %% Application Layer
    subgraph AppLayer["Application Layer"]
        App[Client Application]
    end

    %% Harvester Core Layer
    subgraph CoreLayer["Harvester Core Layer"]
        Core["Image Acquisition Engine"]:::core
        DeviceMgmt["Device Management"]:::core
        BufferMgmt["Buffer Management"]:::core
        PortMgmt["Port Management"]:::core
        CmdInterface["Command Interface"]:::core
        Stats["Statistics Handler"]:::core
    end

    %% Supporting Components Layer
    subgraph SupportLayer["Supporting Components"]
        Observer["Observer Pattern"]:::support
        Logger["Logging System"]:::support
        Utils["Utility Functions"]:::support
        TestFw["Test Framework"]:::support
        SysHelper["System Helper"]:::support
        Profiler["Performance Profiler"]:::support
    end

    %% Interface Layer
    subgraph InterfaceLayer["Interface Layer"]
        GenTL["GenTL Producer"]:::interface
        GenICam["GenICam Interface"]:::interface
    end

    %% Hardware Layer
    subgraph HWLayer["Hardware Layer"]
        Cameras["Cameras/Devices"]:::external
    end

    %% Relationships
    App --> Core
    Core --> DeviceMgmt
    Core --> BufferMgmt
    Core --> PortMgmt
    Core --> CmdInterface
    Core --> Stats
    
    DeviceMgmt --> GenTL
    BufferMgmt --> GenTL
    GenTL --> GenICam
    GenICam --> Cameras
    
    Core -.-> Observer
    Core -.-> Logger
    Core -.-> Utils
    TestFw -.-> Core
    Utils -.-> SysHelper
    Utils -.-> Profiler

    %% Click Events
    click Core "https://github.com/genicam/harvesters/blob/master/src/harvesters/core.py"
    click PortMgmt "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/port.py"
    click CmdInterface "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/command.py"
    click Stats "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/statistics.py"
    click Observer "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/observer.py"
    click Logger "https://github.com/genicam/harvesters/blob/master/src/harvesters/util/logging.py"
    click Utils "https://github.com/genicam/harvesters/tree/master/src/harvesters/util/"
    click TestFw "https://github.com/genicam/harvesters/tree/master/src/harvesters/test/"
    click SysHelper "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/helper/system.py"
    click Profiler "https://github.com/genicam/harvesters/blob/master/src/harvesters/_private/core/helper/profiler.py"

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        InterfaceComp["Interface Component"]:::interface
        SupportComp["Supporting Component"]:::support
        ExternalComp["External Component"]:::external
        direction TB
    end
```
