yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::cli::api::HttpServer Class Reference

#include <http_server.h>

Collaboration diagram for yaze::cli::api::HttpServer:

Public Types

using SymbolProviderSource = std::function<emu::debug::SymbolProvider*()>
 
using RenderServiceSource = std::function<app::service::RenderService*()>
 
using RomSource = std::function<Rom*()>
 
using ProjectPathSource = std::function<std::string()>
 
using WindowAction = std::function<bool()>
 

Public Member Functions

 HttpServer ()
 
 ~HttpServer ()
 
absl::Status Start (int port)
 
void Stop ()
 
bool IsRunning () const
 
void SetSymbolProviderSource (SymbolProviderSource source)
 
void SetRenderServiceSource (RenderServiceSource source)
 
void SetRomSource (RomSource source)
 
void SetProjectPathSource (ProjectPathSource source)
 
int port () const
 
void SetWindowActions (WindowAction show, WindowAction hide)
 
SymbolProviderSource GetSymbolSource () const
 
BonjourPublisherGetBonjourPublisher ()
 

Private Member Functions

void RunServer (int port)
 
void RegisterRoutes ()
 

Private Attributes

std::unique_ptr< httplib::Server > server_
 
std::unique_ptr< std::thread > server_thread_
 
std::atomic< bool > is_running_ {false}
 
int port_ = 0
 
BonjourPublisher bonjour_
 
SymbolProviderSource symbol_source_
 
RenderServiceSource render_source_
 
RomSource rom_source_
 
ProjectPathSource project_path_source_
 
WindowAction window_show_
 
WindowAction window_hide_
 

Detailed Description

Definition at line 37 of file http_server.h.

Member Typedef Documentation

◆ SymbolProviderSource

◆ RenderServiceSource

◆ RomSource

using yaze::cli::api::HttpServer::RomSource = std::function<Rom*()>

Definition at line 41 of file http_server.h.

◆ ProjectPathSource

using yaze::cli::api::HttpServer::ProjectPathSource = std::function<std::string()>

Definition at line 42 of file http_server.h.

◆ WindowAction

using yaze::cli::api::HttpServer::WindowAction = std::function<bool()>

Definition at line 43 of file http_server.h.

Constructor & Destructor Documentation

◆ HttpServer()

yaze::cli::api::HttpServer::HttpServer ( )

Definition at line 14 of file http_server.cc.

◆ ~HttpServer()

yaze::cli::api::HttpServer::~HttpServer ( )

Definition at line 16 of file http_server.cc.

References Stop().

Here is the call graph for this function:

Member Function Documentation

◆ Start()

◆ Stop()

void yaze::cli::api::HttpServer::Stop ( )

Definition at line 59 of file http_server.cc.

References bonjour_, is_running_, LOG_INFO, server_, server_thread_, and yaze::cli::api::BonjourPublisher::Unpublish().

Referenced by ~HttpServer().

Here is the call graph for this function:

◆ IsRunning()

bool yaze::cli::api::HttpServer::IsRunning ( ) const

Definition at line 72 of file http_server.cc.

References is_running_.

◆ SetSymbolProviderSource()

void yaze::cli::api::HttpServer::SetSymbolProviderSource ( SymbolProviderSource source)
inline

Definition at line 58 of file http_server.h.

References symbol_source_.

◆ SetRenderServiceSource()

void yaze::cli::api::HttpServer::SetRenderServiceSource ( RenderServiceSource source)
inline

Definition at line 63 of file http_server.h.

References render_source_.

◆ SetRomSource()

void yaze::cli::api::HttpServer::SetRomSource ( RomSource source)
inline

Definition at line 68 of file http_server.h.

References rom_source_.

◆ SetProjectPathSource()

void yaze::cli::api::HttpServer::SetProjectPathSource ( ProjectPathSource source)
inline

Definition at line 71 of file http_server.h.

References project_path_source_.

◆ port()

int yaze::cli::api::HttpServer::port ( ) const
inline

Definition at line 76 of file http_server.h.

References port_.

Referenced by Start().

◆ SetWindowActions()

void yaze::cli::api::HttpServer::SetWindowActions ( WindowAction show,
WindowAction hide )
inline

Definition at line 79 of file http_server.h.

References window_hide_, and window_show_.

◆ GetSymbolSource()

SymbolProviderSource yaze::cli::api::HttpServer::GetSymbolSource ( ) const
inline

Definition at line 85 of file http_server.h.

References symbol_source_.

◆ GetBonjourPublisher()

BonjourPublisher & yaze::cli::api::HttpServer::GetBonjourPublisher ( )
inline

Definition at line 88 of file http_server.h.

References bonjour_.

◆ RunServer()

void yaze::cli::api::HttpServer::RunServer ( int port)
private

◆ RegisterRoutes()

Member Data Documentation

◆ server_

std::unique_ptr<httplib::Server> yaze::cli::api::HttpServer::server_
private

Definition at line 94 of file http_server.h.

Referenced by RegisterRoutes(), Start(), and Stop().

◆ server_thread_

std::unique_ptr<std::thread> yaze::cli::api::HttpServer::server_thread_
private

Definition at line 95 of file http_server.h.

Referenced by Start(), and Stop().

◆ is_running_

std::atomic<bool> yaze::cli::api::HttpServer::is_running_ {false}
private

Definition at line 96 of file http_server.h.

Referenced by IsRunning(), Start(), and Stop().

◆ port_

int yaze::cli::api::HttpServer::port_ = 0
private

Definition at line 97 of file http_server.h.

Referenced by port(), and Start().

◆ bonjour_

BonjourPublisher yaze::cli::api::HttpServer::bonjour_
private

Definition at line 98 of file http_server.h.

Referenced by GetBonjourPublisher(), RegisterRoutes(), Start(), and Stop().

◆ symbol_source_

SymbolProviderSource yaze::cli::api::HttpServer::symbol_source_
private

Definition at line 99 of file http_server.h.

Referenced by GetSymbolSource(), RegisterRoutes(), and SetSymbolProviderSource().

◆ render_source_

RenderServiceSource yaze::cli::api::HttpServer::render_source_
private

Definition at line 100 of file http_server.h.

Referenced by RegisterRoutes(), and SetRenderServiceSource().

◆ rom_source_

RomSource yaze::cli::api::HttpServer::rom_source_
private

Definition at line 101 of file http_server.h.

Referenced by RegisterRoutes(), and SetRomSource().

◆ project_path_source_

ProjectPathSource yaze::cli::api::HttpServer::project_path_source_
private

Definition at line 102 of file http_server.h.

Referenced by RegisterRoutes(), and SetProjectPathSource().

◆ window_show_

WindowAction yaze::cli::api::HttpServer::window_show_
private

Definition at line 103 of file http_server.h.

Referenced by RegisterRoutes(), and SetWindowActions().

◆ window_hide_

WindowAction yaze::cli::api::HttpServer::window_hide_
private

Definition at line 104 of file http_server.h.

Referenced by RegisterRoutes(), and SetWindowActions().


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