# alejandrotejero/invernadero architecture

> Architecture diagram of the GitHub repository alejandrotejero/invernadero, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alejandrotejero/invernadero
- Repository: https://github.com/alejandrotejero/invernadero

## Overview

#### Purpose and entry point
A terminal-based C++ greenhouse simulator. It authenticates users, exposes sensor readings/control through menus, and persists users and sensor data across runs. Program startup is `Ficheros/main.cpp`; the build target is defined in `Ficheros/Makefile`.

#### Application orchestration
`Administrador` is the likely system-level coordinator for greenhouse entities and operational actions, while `Interfaz` owns terminal interaction and menu navigation. `main` should construct/wire these services, then hand control to login/UI flow.
- `Ficheros/main.cpp`
- `Ficheros/Administrador.h`
- `Ficheros/Interfaz.h`

#### Authentication and user domain
Login is a boundary before access to the greenhouse interface. `Login` performs authentication against a user repository; `Usuario` represents user records, and `BDUsuarios` handles durable storage in the text file.
- `Ficheros/Login.cpp`
- `Ficheros/Usuario.h`
- `Ficheros/BDUsuarios.cpp`
- `Ficheros/users.txt`

#### Sensor model and specialization
The core domain is a polymorphic sensor set. `SensorCamara` appears to define the common sensor/camera abstraction; specialized types model temperature, humidity, air, lighting, RGB, and thermal capabilities. This permits the administrator/UI to work with a common sensor boundary while dispatching type-specific behavior.
- `Ficheros/SensorCamara.h`
- `Ficheros/STemp.h`
- `Ficheros/SHumedad.h`
- `Ficheros/SAire.h`
- `Ficheros/SIluminacion.h`
- `Ficheros/CRgb.h`
- `Ficheros/CTermica.h`

#### Readings persistence
`BDSensores` is the persistence boundary for sensor state/readings, backed by binary `sensors.dat`. Runtime sensor operations should flow from UI/administrator into the sensor objects, then through this repository for save/load rather than directly coupling domain classes to file formats.
- `Ficheros/BDSensores.h`
- `Ficheros/BDSensores.cpp`
- `Ficheros/sensors.dat`

#### Alarm handling
`Alarma` encapsulates alarm-related state or evaluation, separating exceptional greenhouse conditions from ordinary sensor representation. Sensor values likely feed alarm checks, whose results are presented through the interface or handled by the administrator.
- `Ficheros/Alarma.h`
- `Ficheros/Alarma.cpp`
- `Ficheros/Administrador.cpp`

#### Runtime and boundaries
The application is a native C++ executable compiled with `g++` via `make`; it has no indicated network, database server, or web runtime. Its external dependencies are terminal I/O and local filesystem persistence. `Exception` provides an application-level error boundary for invalid operations, authentication/storage failures, or domain errors.
- `Ficheros/Makefile`
- `Ficheros/Exception.h`
- `Ficheros/README.md`

Main entry points: [`Ficheros/Administrador.h`](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Administrador.h) (Administrador), [`Ficheros/Interfaz.h`](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Interfaz.h) (Interfaz), [`Ficheros/main.cpp`](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/main.cpp) (Program entry), [`Ficheros/Login.cpp`](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Login.cpp) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_makefile["Make build<br/>build target"]
  node_main["Program entry<br/>C++ entry point<br/>[main.cpp]"]
  node_terminal(("Terminal I/O<br/>external boundary"))
end

subgraph group_application["Application"]
  node_interfaz["Interfaz<br/>terminal UI<br/>[Interfaz.h]"]
  node_login["Login<br/>authentication service<br/>[Login.cpp]"]
  node_administrador["Administrador<br/>application coordinator<br/>[Administrador.h]"]
  node_exception["Exception<br/>error boundary<br/>[Exception.h]"]
end

subgraph group_domain["Greenhouse domain"]
  node_usuario["Usuario<br/>user entity<br/>[Usuario.h]"]
  node_sensor_camara["SensorCamara<br/>sensor abstraction<br/>[SensorCamara.h]"]
  node_sensor_specializations["Sensor specializations<br/>polymorphic implementations<br/>[STemp.h]"]
  node_alarma["Alarma<br/>alarm domain service<br/>[Alarma.cpp]"]
end

subgraph group_persistence["Local persistence"]
  node_bd_usuarios[("BDUsuarios<br/>user repository<br/>[BDUsuarios.cpp]")]
  node_users_file["users.txt<br/>user data file<br/>[users.txt]"]
  node_bd_sensores[("BDSensores<br/>sensor repository<br/>[BDSensores.h]")]
  node_sensors_file["sensors.dat<br/>binary sensor data<br/>[sensors.dat]"]
end

node_makefile -->|"builds"| node_main
node_main -->|"starts"| node_interfaz
node_main -->|"wires"| node_administrador
node_interfaz -->|"reads and displays"| node_terminal
node_interfaz -->|"requests authentication"| node_login
node_login -->|"authenticates through"| node_bd_usuarios
node_bd_usuarios -->|"loads"| node_usuario
node_bd_usuarios -->|"persists"| node_users_file
node_interfaz -->|"invokes operations"| node_administrador
node_administrador -->|"manages"| node_sensor_camara
node_sensor_specializations -->|"specialize"| node_sensor_camara
node_administrador -->|"loads and saves readings"| node_bd_sensores
node_bd_sensores -->|"persists"| node_sensors_file
node_sensor_camara -->|"supplies values for"| node_alarma
node_alarma -->|"reports conditions to"| node_administrador
node_administrador -.->|"raises failures through"| node_exception
node_login -.->|"reports failures through"| node_exception

click node_makefile "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Makefile"
click node_main "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/main.cpp"
click node_interfaz "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Interfaz.h"
click node_login "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Login.cpp"
click node_administrador "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Administrador.h"
click node_exception "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Exception.h"
click node_usuario "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Usuario.h"
click node_sensor_camara "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/SensorCamara.h"
click node_sensor_specializations "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/STemp.h"
click node_alarma "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Alarma.cpp"
click node_bd_usuarios "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/BDUsuarios.cpp"
click node_users_file "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/users.txt"
click node_bd_sensores "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/BDSensores.h"
click node_sensors_file "https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/sensors.dat"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_makefile,node_main,node_terminal toneBlue
class node_interfaz,node_login,node_administrador,node_exception toneAmber
class node_usuario,node_sensor_camara,node_sensor_specializations,node_alarma toneMint
class node_bd_usuarios,node_users_file,node_bd_sensores,node_sensors_file toneRose
```

## Components

### Runtime

- [Make build](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Makefile): build target · Compiles the native C++ executable with g++. · `Ficheros/Makefile`
- [Program entry](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/main.cpp): C++ entry point · Constructs application services and starts the login/UI flow. · `Ficheros/main.cpp`
- **Terminal I/O**: external boundary

### Application

- [Interfaz](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Interfaz.h): terminal UI · Owns menus and user interaction. · `Ficheros/Interfaz.h`
- [Login](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Login.cpp): authentication service · `Ficheros/Login.cpp`
- [Administrador](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Administrador.h): application coordinator · Coordinates greenhouse entities and operational actions. · `Ficheros/Administrador.h`
- [Exception](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Exception.h): error boundary · Application-level invalid-operation and failure handling. · `Ficheros/Exception.h`

### Greenhouse domain

- [Usuario](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Usuario.h): user entity · `Ficheros/Usuario.h`
- [SensorCamara](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/SensorCamara.h): sensor abstraction · Common polymorphic boundary for sensors and cameras. · `Ficheros/SensorCamara.h`
- [Sensor specializations](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/STemp.h): polymorphic implementations · Temperature, humidity, air, lighting, RGB, and thermal sensor/camera types. · `Ficheros/STemp.h`
- [Alarma](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/Alarma.cpp): alarm domain service · Evaluates exceptional greenhouse conditions from sensor values. · `Ficheros/Alarma.cpp`

### Local persistence

- [BDUsuarios](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/BDUsuarios.cpp): user repository · Durable user-record storage. · `Ficheros/BDUsuarios.cpp`
- [users.txt](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/users.txt): user data file · `Ficheros/users.txt`
- [BDSensores](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/BDSensores.h): sensor repository · Loads and saves sensor state/readings. · `Ficheros/BDSensores.h`
- [sensors.dat](https://github.com/alejandrotejero/invernadero/blob/main/Ficheros/sensors.dat): binary sensor data · `Ficheros/sensors.dat`

## Connections

- Make build → Program entry: builds
- Program entry → Interfaz: starts
- Program entry → Administrador: wires
- Interfaz → Terminal I/O: reads and displays
- Interfaz → Login: requests authentication
- Login → BDUsuarios: authenticates through
- BDUsuarios → Usuario: loads
- BDUsuarios → users.txt: persists
- Interfaz → Administrador: invokes operations
- Administrador → SensorCamara: manages
- Sensor specializations → SensorCamara: specialize
- Administrador → BDSensores: loads and saves readings
- BDSensores → sensors.dat: persists
- SensorCamara → Alarma: supplies values for
- Alarma → Administrador: reports conditions to
- Administrador → Exception: raises failures through
- Login → Exception: reports failures through
