#include <AppContext.h>
Public Member Functions | |
template<typename T > | |
void | registerService (T *service) |
template<typename T > | |
T * | getService () const |
void | initFrameworkServices () |
Static Public Member Functions | |
static AppContext & | getInstance () |
template<typename T > | |
static T * | get () |
Get a service of type T from the application context. | |
template<typename T > | |
static bool | has () |
Private Member Functions | |
AppContext ()=default | |
Static Private Member Functions | |
template<typename T > | |
static constexpr std::uintptr_t | getTypeKey () |
Private Attributes | |
std::unordered_map< std::uintptr_t, void * > | services |
Static Private Attributes | |
static SemaphoreHandle_t | mutex = xSemaphoreCreateMutex() |
Definition at line 9 of file AppContext.h.
|
privatedefault |
This is a convenience method that allows you to get a service without needing to call getService<T>() explicitly.
T | The type of the service to retrieve. Must be a complete type. |
Definition at line 63 of file AppContext.h.
References getInstance(), getService(), and getTypeKey().
|
static |
Definition at line 22 of file AppContext.cpp.
Referenced by get(), getFormattedTimestamp(), FrameworkManager::onStart(), and traceLog().
Definition at line 45 of file AppContext.h.
References getTypeKey(), mutex, and services.
Referenced by get(), getFormattedTimestamp(), and traceLog().
|
inlinestaticconstexprprivate |
Definition at line 91 of file AppContext.h.
References getTypeKey().
Referenced by TimeManager::applyFixedTimezoneOffset(), DashboardController::deleteFile(), MultipartParser::extractFilename(), MultipartParser::file_exists(), Logger::forEachLine(), get(), getService(), getTypeKey(), FrameworkModel::getValue(), GpioEventManager::gpio_event_handler(), has(), FileHandler::init(), initFrameworkServices(), HttpServer::initListener(), App::initRoutes(), FileHandler::listDirectory(), FrameworkModel::load(), Logger::log(), App::onEvent(), FrameworkManager::onEvent(), FrameworkManager::onStart(), App::onStart(), FrameworkManager::poll(), App::poll(), MultipartParser::processFileData(), registerService(), HtmlTemplateView::render(), HttpServer::run(), FrameworkModel::save(), FrameworkModel::saveAll(), TimerService::scheduleAt(), TimerService::scheduleDailyAt(), TimerService::scheduleDuration(), TimerService::scheduleEvery(), FileHandler::serveFile(), TimeManager::setTime(), TimeManager::setTimeFromEpoch(), FrameworkManager::setupTraceFromConfig(), FrameworkModel::setValue(), sntp_set_system_time(), TimeManager::start(), and TimeManager::syncTimeWithNtp().
Definition at line 68 of file AppContext.h.
References getTypeKey().
void AppContext::initFrameworkServices | ( | ) |
Definition at line 27 of file AppContext.cpp.
References GpioEventManager::getInstance(), getTypeKey(), and TRACE.
Referenced by FrameworkManager::onStart().
Definition at line 27 of file AppContext.h.
References getTypeKey(), mutex, and services.
|
staticprivate |
Definition at line 88 of file AppContext.h.
Referenced by getService(), and registerService().
|
private |
Definition at line 86 of file AppContext.h.
Referenced by getService(), and registerService().