New CountVisitor to count the number of sources in session

Session size is the number of elements, use CountVisitor to count the total number of sources inside (recursively through SessionSources).
This commit is contained in:
Bruno Herbelin
2022-04-09 00:35:20 +02:00
parent f2db10d29a
commit 8fef0052a3
15 changed files with 353 additions and 148 deletions

View File

@@ -33,6 +33,7 @@
#include "MixingGroup.h"
#include "ControlManager.h"
#include "SourceCallback.h"
#include "CountVisitor.h"
#include "Log.h"
#include "Session.h"
@@ -432,11 +433,21 @@ SourceList Session::getDepthSortedList() const
return depth_sorted(sources_);
}
uint Session::numSource() const
uint Session::size() const
{
return sources_.size();
}
uint Session::numSources() const
{
CountVisitor counter;
for( SourceList::const_iterator it = sources_.cbegin(); it != sources_.cend(); ++it) {
(*it)->accept(counter);
}
return counter.numSources();
}
SourceIdList Session::getIdList() const
{
return ids(sources_);