reset(new Interface()) -> std::make_shared<Interface>()

This commit is contained in:
Robert Haschke 2021-11-29 15:10:14 +01:00
parent 442d39ad3e
commit b2c116edab
2 changed files with 14 additions and 14 deletions

View File

@ -606,9 +606,9 @@ void SerialContainerPrivate::resolveInterface(InterfaceFlags expected) {
validateInterface<START_IF_MASK>(*first.pimpl(), expected); validateInterface<START_IF_MASK>(*first.pimpl(), expected);
// connect first child's (start) pull interface // connect first child's (start) pull interface
if (const InterfacePtr& target = first.pimpl()->starts()) if (const InterfacePtr& target = first.pimpl()->starts())
starts_.reset(new Interface([this, target](Interface::iterator it, bool updated) { starts_ = std::make_shared<Interface>([this, target](Interface::iterator it, bool updated) {
this->copyState<Interface::FORWARD>(it, target, updated); this->copyState<Interface::FORWARD>(it, target, updated);
})); });
} catch (InitStageException& e) { } catch (InitStageException& e) {
exceptions.append(e); exceptions.append(e);
} }
@ -632,9 +632,9 @@ void SerialContainerPrivate::resolveInterface(InterfaceFlags expected) {
validateInterface<END_IF_MASK>(*last.pimpl(), expected); validateInterface<END_IF_MASK>(*last.pimpl(), expected);
// connect last child's (end) pull interface // connect last child's (end) pull interface
if (const InterfacePtr& target = last.pimpl()->ends()) if (const InterfacePtr& target = last.pimpl()->ends())
ends_.reset(new Interface([this, target](Interface::iterator it, bool updated) { ends_ = std::make_shared<Interface>([this, target](Interface::iterator it, bool updated) {
this->copyState<Interface::BACKWARD>(it, target, updated); this->copyState<Interface::BACKWARD>(it, target, updated);
})); });
} catch (InitStageException& e) { } catch (InitStageException& e) {
exceptions.append(e); exceptions.append(e);
} }
@ -733,13 +733,13 @@ void ParallelContainerBasePrivate::resolveInterface(InterfaceFlags expected) {
void ParallelContainerBasePrivate::initializeExternalInterfaces() { void ParallelContainerBasePrivate::initializeExternalInterfaces() {
// States received by the container need to be copied to all children's pull interfaces. // States received by the container need to be copied to all children's pull interfaces.
if (requiredInterface() & READS_START) if (requiredInterface() & READS_START)
starts().reset(new Interface([this](Interface::iterator external, bool updated) { starts() = std::make_shared<Interface>([this](Interface::iterator external, bool updated) {
this->propagateStateToChildren<Interface::FORWARD>(external, updated); this->propagateStateToChildren<Interface::FORWARD>(external, updated);
})); });
if (requiredInterface() & READS_END) if (requiredInterface() & READS_END)
ends().reset(new Interface([this](Interface::iterator external, bool updated) { ends() = std::make_shared<Interface>([this](Interface::iterator external, bool updated) {
this->propagateStateToChildren<Interface::BACKWARD>(external, updated); this->propagateStateToChildren<Interface::BACKWARD>(external, updated);
})); });
} }
void ParallelContainerBasePrivate::validateInterfaces(const StagePrivate& child, InterfaceFlags& external, void ParallelContainerBasePrivate::validateInterfaces(const StagePrivate& child, InterfaceFlags& external,

View File

@ -510,14 +510,14 @@ void PropagatingEitherWayPrivate::initInterface(PropagatingEitherWay::Direction
case PropagatingEitherWay::FORWARD: case PropagatingEitherWay::FORWARD:
required_interface_ = PROPAGATE_FORWARDS; required_interface_ = PROPAGATE_FORWARDS;
if (!starts_) // keep existing interface if possible if (!starts_) // keep existing interface if possible
starts_.reset(new Interface()); starts_ = std::make_shared<Interface>();
ends_.reset(); ends_.reset();
return; return;
case PropagatingEitherWay::BACKWARD: case PropagatingEitherWay::BACKWARD:
required_interface_ = PROPAGATE_BACKWARDS; required_interface_ = PROPAGATE_BACKWARDS;
starts_.reset(); starts_.reset();
if (!ends_) // keep existing interface if possible if (!ends_) // keep existing interface if possible
ends_.reset(new Interface()); ends_ = std::make_shared<Interface>();
return; return;
case PropagatingEitherWay::AUTO: case PropagatingEitherWay::AUTO:
required_interface_ = UNKNOWN; required_interface_ = UNKNOWN;
@ -715,10 +715,10 @@ void MonitoringGeneratorPrivate::solutionCB(const SolutionBase& s) {
} }
ConnectingPrivate::ConnectingPrivate(Connecting* me, const std::string& name) : ComputeBasePrivate(me, name) { ConnectingPrivate::ConnectingPrivate(Connecting* me, const std::string& name) : ComputeBasePrivate(me, name) {
starts_.reset(new Interface(std::bind(&ConnectingPrivate::newState<Interface::BACKWARD>, this, std::placeholders::_1, starts_ = std::make_shared<Interface>(std::bind(&ConnectingPrivate::newState<Interface::BACKWARD>, this,
std::placeholders::_2))); std::placeholders::_1, std::placeholders::_2));
ends_.reset(new Interface(std::bind(&ConnectingPrivate::newState<Interface::FORWARD>, this, std::placeholders::_1, ends_ = std::make_shared<Interface>(
std::placeholders::_2))); std::bind(&ConnectingPrivate::newState<Interface::FORWARD>, this, std::placeholders::_1, std::placeholders::_2));
} }
InterfaceFlags ConnectingPrivate::requiredInterface() const { InterfaceFlags ConnectingPrivate::requiredInterface() const {