Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Schniz/robotikka. Lee Ve Tom Ve Ani Doin our Robottttt
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677#pragma once
#include "ConfigurationManager.h"#include <iostream>#include <string>#include "../lib/config.h"#include "../Consts.h"using namespace std;using namespace Consts;
namespace Managers {ConfigurationManager *ConfigurationManager::m_ConfigurationManagerInstance = NULL;
ConfigurationManager::ConfigurationManager(){};
void ConfigurationManager::LoadFromFile(string filePath) { // create the first singleton instance
Config configParser(filePath);
ConfigurationManager::m_ConfigurationManagerInstance = new ConfigurationManager(); m_PngMapPath = configParser.mapLocation; m_StartLocation.m_X = configParser.startLocation[0]; m_StartLocation.m_Y = configParser.startLocation[1]; m_StartLocation.m_Yaw = configParser.startLocation[2]; m_EndLocation.m_X = configParser.goal[0]; m_EndLocation.m_Y = configParser.goal[1]; m_PpCM = configParser.mapResolutionCm; m_PngGridResolution = configParser.gridResolutionCm; m_RobotSize.m_Width = configParser.robotSize[0]; m_RobotSize.m_Height = configParser.robotSize[1];
}
ConfigurationManager::~ConfigurationManager() { }
ConfigurationManager* ConfigurationManager::GetInstance() { if (ConfigurationManager::m_ConfigurationManagerInstance == NULL) { throw new std::string("Object ConfigurationManager Never Loaded"); } else { return ConfigurationManager::m_ConfigurationManagerInstance; } return NULL; }
string ConfigurationManager::getPngMapPath() { return m_PngMapPath; }
Location ConfigurationManager::getStartLocation() { return m_StartLocation; }
Location ConfigurationManager::getEndLocation() { return m_EndLocation; }
float ConfigurationManager::getPixelPerCm() { return m_PpCM; }
float ConfigurationManager::getPngGridResolution() { return m_PngGridResolution; }
Size ConfigurationManager::getRobotSize() { return m_RobotSize; }
}