Lagrange
Systems Class Reference

Container for Systems. More...

#include <lagrange/ui/types/Systems.h>

Public Types

enum class  Stage : int {
  Init = 0 , Interface , Simulation , Render ,
  Post , _SIZE
}
 

Public Member Functions

void run (Stage stage, Registry &registry)
 Runs a stage. More...
 
StringID add (Stage stage, const System &system, StringID id=0)
 Adds a system which will be executed at a given stage. More...
 
bool enable (StringID id, bool value)
 Enables or disables given system. More...
 
bool succeeds (StringID system_id, StringID after_id)
 Places system with system_id after the system with after_id Note: Does not handle cycles nor topological ordering, only moves system_id in execution order. More...
 
bool remove (StringID id)
 Removes system identifier with id More...
 

Detailed Description

Container for Systems.

//Add systems to the Init stage
StringID first_system = S.add(Systems::Stage::Init, [](Registry & r){});
StringID second_system = S.add(Systems::Stage::Init, [](Registry & r){});
Registry r;
//Run the systems in the Init stage
S.run(Systems::Stage::Init, r);
Container for Systems.
Definition: Systems.h:34
void run(Stage stage, Registry &registry)
Runs a stage.
Definition: Systems.cpp:19
StringID add(Stage stage, const System &system, StringID id=0)
Adds a system which will be executed at a given stage.
Definition: Systems.cpp:26

Member Function Documentation

◆ run()

void run ( Stage  stage,
Registry &  registry 
)

Runs a stage.

Executes each system in this stage in order.

Parameters
stageWhich stage
registryRegistry to pass to system execution

◆ add()

StringID add ( Stage  stage,
const System &  system,
StringID  id = 0 
)

Adds a system which will be executed at a given stage.

Parameters
stageWhich Stage should the system be executed in
systemSystem function to execute
idOptional identifier. Generated otherwise.
Returns
If id wasn't given, this function will return a generated StringID If id was given, it will return the id, or 0 if the system with id already exists

◆ enable()

bool enable ( StringID  id,
bool  value 
)

Enables or disables given system.

Parameters
idid of the system, previously return by add()
valueenable or disable
Returns
false if system exists

◆ succeeds()

bool succeeds ( StringID  system_id,
StringID  after_id 
)

Places system with system_id after the system with after_id Note: Does not handle cycles nor topological ordering, only moves system_id in execution order.

Parameters
systemStringID
afterStringID
Returns
true on success, false if system_id or after_id do not exist

◆ remove()

bool remove ( StringID  id)

Removes system identifier with id

Parameters
id
Returns
true if system existed and was removed

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