Increased size of unique identifier of objects: using uint64 instead of

int. Deep change in all concerned objects (Node, Source, Shader, etc.).
No behavior change, just more robust in duration.
This commit is contained in:
brunoherbelin
2020-10-06 22:45:52 +02:00
parent 977ae76f9b
commit 233fc64c4e
23 changed files with 96 additions and 93 deletions

View File

@@ -31,8 +31,10 @@ void Action::clear()
store("Session start");
}
void Action::store(const std::string &label, int id)
void Action::store(const std::string &label, uint64_t id)
{
// TODO use id of item stored
// ignore if locked or if no label is given
if (locked_ || label.empty())
return;
@@ -82,8 +84,8 @@ void Action::undo()
// get history node of current step
std::string nodename = "H" + std::to_string(step_);
XMLElement *sessionNode = xmlDoc_.FirstChildElement( nodename.c_str() );
int id = -1;
sessionNode->QueryIntAttribute("id", &id);
uint64_t id = 0;
sessionNode->QueryUnsigned64Attribute("id", &id);
restore( step_ - 1, id);
}
@@ -96,8 +98,8 @@ void Action::redo()
// what id to modify to go to next step ?
std::string nodename = "H" + std::to_string(step_ + 1);
XMLElement *sessionNode = xmlDoc_.FirstChildElement( nodename.c_str() );
int id = -1;
sessionNode->QueryIntAttribute("id", &id);
uint64_t id = 0;
sessionNode->QueryUnsigned64Attribute("id", &id);
restore( step_ + 1, id);
}
@@ -106,7 +108,7 @@ void Action::redo()
void Action::stepTo(uint target)
{
// going to target step
restore(target, -1);
restore(target, 0);
}
@@ -122,7 +124,7 @@ std::string Action::label(uint s) const
return l;
}
void Action::restore(uint target, int id)
void Action::restore(uint target, uint64_t id)
{
// lock
locked_ = true;
@@ -137,7 +139,7 @@ void Action::restore(uint target, int id)
#endif
// sessionsources contains ids of all sources currently in the session
std::list<int> sessionsources = Mixer::manager().session()->getIdList();
std::list<uint64_t> sessionsources = Mixer::manager().session()->getIdList();
// load history status:
// - if a source exists, its attributes are updated
@@ -146,7 +148,7 @@ void Action::restore(uint target, int id)
loader.load( sessionNode );
// loadersources contains ids of all sources generated by loader
std::list<int> loadersources = loader.getIdList();
std::list<uint64_t> loadersources = loader.getIdList();
// remove intersect of both lists (sources were updated)
for( auto lsit = loadersources.begin(); lsit != loadersources.end(); ){
@@ -167,6 +169,7 @@ void Action::restore(uint target, int id)
}
// remaining ids in list loadersources : to add
while ( !loadersources.empty() ){
Log::Info("Recreate id %s", std::to_string(loadersources.front() ).c_str());
Mixer::manager().attach( Mixer::manager().findSource( loadersources.front() ) );
loadersources.pop_front();
}