ReXGlue SDK
Loading...
Searching...
No Matches
app.h File Reference
#include <exception>
#include <filesystem>
#include <memory>
#include <span>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <rex/cli.h>
#include <rex/platform.h>
#include <rex/platform/process.h>
#include <rex/app_info.h>
#include <rex/module.h>
#include <rex/result.h>
#include <rex/setting.h>
#include <rex/settings_registry.h>
#include <rex/types.h>

Go to the source code of this file.

Classes

class  rex::app::App

Namespaces

namespace  rex
namespace  rex::gpu
namespace  rex::apu

Macros

#define REX_CONSOLE_APP(AppClass)
#define REX_CONSOLE_APP_MAIN(AppClass, Function)

Enumerations

enum class  rex::app::AppPhase : u8 {
  kStart , kProviders , kRunning , kTitleLaunch ,
  kTitleRunning , kTitleStop , kShutdown
}

Functions

REX_APP_API void rex::app::RequestShutdown (i32 exit_code)
REX_APP_API void rex::app::RequestRestart (std::vector< std::string > args={})
REX_APP_API bool rex::app::IsShutdownRequested ()

Detailed Description

License
BSD 3-Clause License See LICENSE file in the project root for full license text.

Macro Definition Documentation

◆ REX_CONSOLE_APP

#define REX_CONSOLE_APP ( AppClass)
Value:
static int ReXConsoleEntry(const ::rex::CLIArgList& args) { \
AppClass rex_app; \
if (rex_app.Init(args)) { \
rex_app.Run(); \
} \
return rex_app.Shutdown(); \
} \
REX_DETAIL_ENTRY_POINTS(ReXConsoleEntry)

Defines the entry point for a console app. An exception that escapes is printed to stderr and the exit code is 1.

Parameters
AppClassA class deriving from rex::app::App with a default constructor.
class FooTool : public rex::app::App {
public:
FooTool() : App("foo") {}
};
#define REX_CONSOLE_APP(AppClass)
Definition app.h:296
Definition app.h:73

◆ REX_CONSOLE_APP_MAIN

#define REX_CONSOLE_APP_MAIN ( AppClass,
Function )
Value:
static int ReXConsoleEntry(const ::rex::CLIArgList& args) { \
AppClass rex_app; \
return Function(rex_app, args); \
} \
REX_DETAIL_ENTRY_POINTS(ReXConsoleEntry)

Defines the entry point for a console app that calls its own steps.

Parameters
AppClassA class deriving from rex::app::App with a default constructor.
FunctionA function taking AppClass& and const rex::CLIArgList&, returning int.
int FooToolMain(FooTool& tool, const rex::CLIArgList& args) {
if (tool.Init(args)) {
tool.Run();
}
return tool.Shutdown();
}
REX_CONSOLE_APP_MAIN(FooTool, FooToolMain)
#define REX_CONSOLE_APP_MAIN(AppClass, Function)
Definition app.h:322
Definition cli.h:36

Enumeration Type Documentation

◆ AppPhase

enum class rex::app::AppPhase : u8
strong

Phase of the app lifecycle. kTitleLaunch, kTitleRunning and kTitleStop exist only in a TitleApp.

Enumerator
kStart 

Init. Logging, settings and paths come up and the layers apply.

kProviders 

Modules load and connect and drivers initialize.

kRunning 

Window, input, audio, UI and overlays work, with no title.

kTitleLaunch 

rex::kernel::TitleRuntime loads and launches and drivers attach.

kTitleStop 

rex::kernel::TitleRuntime stops, drivers detach, then kRunning again.

kShutdown 

Drivers shut down, modules unload in reverse and logging goes last.

Function Documentation

◆ IsShutdownRequested()

REX_APP_API bool rex::app::IsShutdownRequested ( )

Reports whether shutdown of the running app has been requested.

Returns
True once rex::app::RequestShutdown or rex::app::RequestRestart has been called.

◆ RequestRestart()

REX_APP_API void rex::app::RequestRestart ( std::vector< std::string > args = {})

Requests shutdown of the running app and a new process of it once Shutdown completes. Any thread.

Parameters
argsArguments for the new process. Empty reuses the current arguments.

◆ RequestShutdown()

REX_APP_API void rex::app::RequestShutdown ( i32 exit_code)

Requests shutdown of the running app. Any thread. Later requests do not change the exit code.

Parameters
exit_codeThe exit code Shutdown returns.