mirror of https://github.com/AxioDL/amuse.git
Merge pull request #40 from lioncash/const
Studio: Make _cyclicCheck a const member function
This commit is contained in:
commit
0dca047352
|
@ -18,7 +18,7 @@ class Studio {
|
||||||
|
|
||||||
std::list<StudioSend> m_studiosOut;
|
std::list<StudioSend> m_studiosOut;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bool _cyclicCheck(Studio* leaf);
|
bool _cyclicCheck(const Studio* leaf) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include "amuse/Studio.hpp"
|
#include "amuse/Studio.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "amuse/Engine.hpp"
|
#include "amuse/Engine.hpp"
|
||||||
|
|
||||||
namespace amuse {
|
namespace amuse {
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bool Studio::_cyclicCheck(Studio* leaf) {
|
bool Studio::_cyclicCheck(const Studio* leaf) const {
|
||||||
for (auto it = m_studiosOut.begin(); it != m_studiosOut.end();) {
|
return std::any_of(m_studiosOut.cbegin(), m_studiosOut.cend(), [leaf](const auto& studio) {
|
||||||
if (leaf == it->m_targetStudio.get() || it->m_targetStudio->_cyclicCheck(leaf))
|
return leaf == studio.m_targetStudio.get() || studio.m_targetStudio->_cyclicCheck(leaf);
|
||||||
return true;
|
});
|
||||||
++it;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Studio::Studio(Engine& engine, bool mainOut) : m_engine(engine), m_master(engine
|
||||||
}
|
}
|
||||||
|
|
||||||
void Studio::addStudioSend(ObjToken<Studio> studio, float dry, float auxA, float auxB) {
|
void Studio::addStudioSend(ObjToken<Studio> studio, float dry, float auxA, float auxB) {
|
||||||
m_studiosOut.emplace_back(studio, dry, auxA, auxB);
|
m_studiosOut.emplace_back(std::move(studio), dry, auxA, auxB);
|
||||||
|
|
||||||
/* Cyclic check */
|
/* Cyclic check */
|
||||||
assert(!_cyclicCheck(this));
|
assert(!_cyclicCheck(this));
|
||||||
|
|
Loading…
Reference in New Issue