mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
49 lines
1023 B
C++
49 lines
1023 B
C++
|
|
#include "AppData.h"
|
|||
|
|
|
|||
|
|
#include "app/Station.h"
|
|||
|
|
|
|||
|
|
std::shared_ptr<Station> AppData::getStation(int stationId)
|
|||
|
|
{
|
|||
|
|
auto iter = mapStation.find(stationId);
|
|||
|
|
if (iter!=mapStation.end())
|
|||
|
|
{
|
|||
|
|
return iter->second;
|
|||
|
|
}
|
|||
|
|
return nullptr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::shared_ptr<Station> AppData::getStationByName(std::string name)
|
|||
|
|
{
|
|||
|
|
for (auto iter = mapStation.begin(); iter!=mapStation.end(); ++iter)
|
|||
|
|
{
|
|||
|
|
if (iter->second->name == name)
|
|||
|
|
{
|
|||
|
|
return iter->second;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return nullptr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void AppData::getStationNames(std::vector<std::string>& vecNames)
|
|||
|
|
{
|
|||
|
|
vecNames.resize(mapStation.size());
|
|||
|
|
int i = 0;
|
|||
|
|
for (auto iter = mapStation.begin(); iter!=mapStation.end(); ++iter)
|
|||
|
|
{
|
|||
|
|
vecNames[i] = iter->second->name;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
std::shared_ptr<Device> AppData::getDevice(int stationId, int deviceId)
|
|||
|
|
{
|
|||
|
|
auto station = getStation(stationId);
|
|||
|
|
if (station)
|
|||
|
|
{
|
|||
|
|
return station->getDevice(deviceId);
|
|||
|
|
}
|
|||
|
|
return nullptr;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void AppData::loadStatData()
|
|||
|
|
{
|
|||
|
|
}
|