Fixed Session load recursion, allow higher level of imbrication

Recursive load of SessionFile in a Session is now detected by filename and prevented. Deeper level of integration of sessionfile inside session is thus possible (set to 3). Sessions now have an id, allowing to reference them by id in the logs. Terminology is clarified between level and recursion.
This commit is contained in:
Bruno Herbelin
2022-04-08 17:44:39 +02:00
parent ef65dd8cc6
commit 33756c775c
7 changed files with 84 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
#ifndef SESSIONCREATOR_H
#define SESSIONCREATOR_H
#include <list>
#include <map>
#include <tinyxml2.h>
@@ -13,11 +14,9 @@ class FrameBufferImage;
class SessionLoader : public Visitor {
SessionLoader();
public:
SessionLoader(Session *session, int recursion = 0);
SessionLoader(Session *session = nullptr, uint level = 0);
inline Session *session() const { return session_; }
void load(tinyxml2::XMLElement *sessionNode);
@@ -84,8 +83,8 @@ protected:
std::string sessionFilePath_;
// parsing current xml
tinyxml2::XMLElement *xmlCurrent_;
// level of loading recursion
int recursion_;
// level of loading imbricated sessions and recursion
uint level_;
// map of correspondance from xml source id (key) to new source pointer (value)
std::map< uint64_t, Source* > sources_id_;
// list of groups (lists of xml source id)
@@ -115,7 +114,7 @@ class SessionCreator : public SessionLoader {
void loadInputCallbacks(tinyxml2::XMLElement *inputsNode);
public:
SessionCreator(int recursion = 0);
SessionCreator(uint level = 0);
void load(const std::string& filename);