2022-02-05 17:22:59 +01:00
|
|
|
#ifndef RCPP_FRAMEWORK_H
|
|
|
|
#define RCPP_FRAMEWORK_H
|
|
|
|
|
|
|
|
#include "core/containers/vector.h"
|
2022-02-05 18:26:32 +01:00
|
|
|
#include "core/string.h"
|
2022-02-05 17:22:59 +01:00
|
|
|
|
|
|
|
#include "core/object.h"
|
|
|
|
|
2022-02-06 00:09:53 +01:00
|
|
|
class RCPPFramework : public Object {
|
2022-02-05 18:26:32 +01:00
|
|
|
RCPP_OBJECT(RCPPFramework, Object);
|
2022-02-05 17:22:59 +01:00
|
|
|
|
|
|
|
public:
|
2022-02-05 18:26:32 +01:00
|
|
|
// Helper methods to allocate and destroy the singleton.
|
|
|
|
// Note that creating / deleting an instance manually in your app will also work.
|
|
|
|
static void create();
|
|
|
|
static void destroy();
|
|
|
|
// Usie these if you don't want to mess with the default settings.
|
|
|
|
static void create_and_init();
|
|
|
|
static void create_and_init(int argc, char **argv, char **envp);
|
|
|
|
|
|
|
|
void initialize();
|
2022-02-05 19:29:20 +01:00
|
|
|
void initialize(int argc, char **argv, char **envp);
|
2022-02-05 18:26:32 +01:00
|
|
|
void uninitialize();
|
2022-02-05 18:17:36 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
void setup_args(int argc, char **argv, char **envp);
|
2022-02-05 18:17:36 +01:00
|
|
|
|
2022-02-05 19:29:20 +01:00
|
|
|
virtual void load();
|
|
|
|
virtual void migrate();
|
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
void manage_object(Object *obj);
|
2022-02-05 17:22:59 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
RCPPFramework();
|
|
|
|
~RCPPFramework();
|
2022-02-05 17:22:59 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
static RCPPFramework *get_singleton();
|
2022-02-05 17:22:59 +01:00
|
|
|
|
2022-02-05 19:29:20 +01:00
|
|
|
bool allocate_settings_singleton;
|
2022-02-05 19:20:25 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
#if DATABASES_ENABLED
|
|
|
|
bool allocate_database_manager_singleton;
|
2022-02-05 19:20:25 +01:00
|
|
|
|
2022-02-05 19:29:20 +01:00
|
|
|
// TODO Need a define for this
|
|
|
|
bool allocate_db_settings_singleton;
|
2022-02-05 18:26:32 +01:00
|
|
|
#endif
|
2022-02-05 17:22:59 +01:00
|
|
|
|
2022-02-05 18:31:00 +01:00
|
|
|
#if WEB_ENABLED
|
|
|
|
bool allocate_session_manager_singleton;
|
2022-02-05 19:29:20 +01:00
|
|
|
bool allocate_file_cache_singleton;
|
2022-02-05 18:39:27 +01:00
|
|
|
|
2022-02-05 19:29:20 +01:00
|
|
|
// By default it's set to "".
|
|
|
|
// It will be ignored if you leave it.
|
|
|
|
String www_root;
|
2022-02-05 18:31:00 +01:00
|
|
|
#endif
|
|
|
|
|
2022-02-05 17:22:59 +01:00
|
|
|
protected:
|
2022-02-05 18:26:32 +01:00
|
|
|
virtual void _do_initialize();
|
|
|
|
virtual void _do_uninitialize();
|
2022-02-05 18:17:36 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
bool _initialized;
|
2022-02-05 18:17:36 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
Vector<Object *> _managed_objects;
|
2022-02-05 17:22:59 +01:00
|
|
|
|
2022-02-05 18:26:32 +01:00
|
|
|
static RCPPFramework *_instance;
|
2022-02-05 17:22:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|