Weather App
 
Loading...
Searching...
No Matches
LocalDB Class Reference

Provides methods to update and load station and sensor data stored locally in JSON format. More...

#include <LocalDB.h>

Static Public Member Functions

static void UpdateIndex (std::string data)
 Updates the index file with new data.
 
static void UpdateStation (std::string stationId, std::string data)
 Updates a specific station's data file.
 
static void UpdateSensor (std::string sensorId, std::string data)
 Updates a specific sensor's data file.
 
static bool LoadIndex (nlohmann::json &data)
 Loads the index data from the local JSON file.
 
static bool LoadStation (nlohmann::json &data, std::string stationId)
 Loads a specific station's data from the local JSON file.
 
static bool LoadSensor (nlohmann::json &data, std::string sensorId)
 Loads a specific sensor's data from the local JSON file.
 

Detailed Description

Provides methods to update and load station and sensor data stored locally in JSON format.

Member Function Documentation

◆ LoadIndex()

static bool LocalDB::LoadIndex ( nlohmann::json & data)
static

Loads the index data from the local JSON file.

Parameters
dataReference to a JSON object where the index data will be stored.
Returns
True if the data is successfully loaded, false otherwise.

◆ LoadSensor()

static bool LocalDB::LoadSensor ( nlohmann::json & data,
std::string sensorId )
static

Loads a specific sensor's data from the local JSON file.

Parameters
dataReference to a JSON object where the sensor data will be stored.
sensorIdThe unique identifier of the sensor.
Returns
True if the data is successfully loaded, false otherwise.

◆ LoadStation()

static bool LocalDB::LoadStation ( nlohmann::json & data,
std::string stationId )
static

Loads a specific station's data from the local JSON file.

Parameters
dataReference to a JSON object where the station data will be stored.
stationIdThe unique identifier of the station.
Returns
True if the data is successfully loaded, false otherwise.

◆ UpdateIndex()

static void LocalDB::UpdateIndex ( std::string data)
static

Updates the index file with new data.

Parameters
dataThe new index data in JSON string format.

◆ UpdateSensor()

static void LocalDB::UpdateSensor ( std::string sensorId,
std::string data )
static

Updates a specific sensor's data file.

Parameters
sensorIdThe unique identifier of the sensor.
dataThe new sensor data in JSON string format.

◆ UpdateStation()

static void LocalDB::UpdateStation ( std::string stationId,
std::string data )
static

Updates a specific station's data file.

Parameters
stationIdThe unique identifier of the station.
dataThe new station data in JSON string format.

The documentation for this class was generated from the following file: