mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
搭建PVB架构,实现前端的基础布局、菜单、表格、图示等功能
This commit is contained in:
49
src/app/AppData.cpp
Normal file
49
src/app/AppData.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#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()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user