ExpressionParser: Pass control qualifiers by const reference
These aren't necessarily cheap to copy, since a control qualifier will have around 3 std::strings inside of it, so passing by value can churn allocations a little bit.
This commit is contained in:
parent
2c6bf2d224
commit
ea71a76ea9
|
@ -600,7 +600,7 @@ private:
|
|||
std::unique_ptr<Expression> m_rhs;
|
||||
};
|
||||
|
||||
std::shared_ptr<Device> ControlEnvironment::FindDevice(ControlQualifier qualifier) const
|
||||
std::shared_ptr<Device> ControlEnvironment::FindDevice(const ControlQualifier& qualifier) const
|
||||
{
|
||||
if (qualifier.has_device)
|
||||
return container.FindDevice(qualifier.device_qualifier);
|
||||
|
@ -608,7 +608,7 @@ std::shared_ptr<Device> ControlEnvironment::FindDevice(ControlQualifier qualifie
|
|||
return container.FindDevice(default_device);
|
||||
}
|
||||
|
||||
Device::Input* ControlEnvironment::FindInput(ControlQualifier qualifier) const
|
||||
Device::Input* ControlEnvironment::FindInput(const ControlQualifier& qualifier) const
|
||||
{
|
||||
const std::shared_ptr<Device> device = FindDevice(qualifier);
|
||||
if (!device)
|
||||
|
@ -617,7 +617,7 @@ Device::Input* ControlEnvironment::FindInput(ControlQualifier qualifier) const
|
|||
return device->FindInput(qualifier.control_name);
|
||||
}
|
||||
|
||||
Device::Output* ControlEnvironment::FindOutput(ControlQualifier qualifier) const
|
||||
Device::Output* ControlEnvironment::FindOutput(const ControlQualifier& qualifier) const
|
||||
{
|
||||
const std::shared_ptr<Device> device = FindDevice(qualifier);
|
||||
if (!device)
|
||||
|
|
|
@ -150,9 +150,9 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Core::Device> FindDevice(ControlQualifier qualifier) const;
|
||||
Core::Device::Input* FindInput(ControlQualifier qualifier) const;
|
||||
Core::Device::Output* FindOutput(ControlQualifier qualifier) const;
|
||||
std::shared_ptr<Core::Device> FindDevice(const ControlQualifier& qualifier) const;
|
||||
Core::Device::Input* FindInput(const ControlQualifier& qualifier) const;
|
||||
Core::Device::Output* FindOutput(const ControlQualifier& qualifier) const;
|
||||
// Returns an existing variable by the specified name if already existing. Creates it otherwise.
|
||||
std::shared_ptr<ControlState> GetVariablePtr(const std::string& name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue