System class allows to control the Core in a global way. It provides facilities for the Core initialization, shutdown, etc. and simplified access to Core subsystems. Some of the functionality can be accessed by calling appropriate subsystems directly, however this would require knowledge of the Core internals (as semi-public API would be used) and the use would be cumbersome. On the other side, the API provided by the System class is completely public.
The System API can be separated into these functional groups:
System callbacks
Registering system callbacks used to upcall the application from the Core. The callbacks must either be registered manually before the system initialization or automatically via entries in StartUpInfo structure that is passed to System::initialize(). See also Section 15.2, “Initializing the Core”.
Method |
---|
void register_register_classes( void ( *callback )() ) |
void register_create_node_object( void ( *callback )() ) |
void register_next_tick( void ( *callback )() ) |
Managing system phases, system loops
Initializing the Core, downloading prerequisite data, connecting to simulation, running simulation, disconnecting from simulation, shutting the Core down. See also Figure 15.1, “System Phases”.
Method | Semantics |
---|---|
Phase get_phase() | Determine current system phase. |
void initialize( const StartUpInfo & info ) | Initialize the system according to StartUpInfo structure. |
void download_data() | Download prerequisite data. |
void connect( std::istream & my_config ) | Connect to the simulation using credentials stored in my_config. |
void run() | Run the main loop. |
void disconnect() | Disconnect from the simulation. |
void shutdown() | Shutdown the system. |
bool is_connected() | Check whether the system is connected to the simulation. |
void request_quit() | Request quit from the current system loop. |
Time
Retrieving the current simulation time and the local system time. See also Chapter 18, Simulation Time.
Method | Semantics |
---|---|
const STime & time() | Get simulation time. |
const SystemTime & system_time() | Get local system time. |
Garbage Collector API
Forcing garbage collection, deleting objects explicitly, disposing GC root objects. See also Section 5.4, “Garbage Collector”.
Method | Semantics |
---|---|
void force_gc() | Force garbage collection. |
void collect_object( "managed_pointer" ) | Force GC to collect object referenced by the managed pointer. |
void dispose_gc_root( "managed_pointer" ) | Tells GC that permanent GC root object should be demoted to a non-root object. |
Well known object ids
Determining naming service object id.
Method | Semantics |
---|---|
const ObjectId & get_naming_service_object_id() | Get naming service object id. |
Local node information
Obtaining local node id.
Method | Semantics |
---|---|
const NodeId & get_local_node_id() | Get node id of the local node. |
bool is_server() | Test if the local node is a server. |
bool is_client() | Test if the local node is a client. |
Archive management
Creating initial archives, packing and unpacking archives. See also Chapter 23, Archivation and Startup or the Massiv Core Reference Guide.
Method | Semantics |
---|---|
void create_initial_object_provider( UInt32 id ) | Ask the Core for a new ObjectId pool so that object instances could be created. To be used when an initial archive is being created. |
void create_initial_archive() | Archive local simulations state. To be called from server nodes that did not connect to the simulation and where startup simulation state has just been prepared. |
void unpack_archive( const std::string & archive_id, const std::string & directory ) | Export archive streams from the volume image to external file system. |
void pack_archive( const std::vector< std::string > directories, const std::string & archive_id ) | Import archive streams from external directories to a new archive. |