Commit c28d49f6 authored by Uwe Woessner's avatar Uwe Woessner
Browse files

avoid copying strings --> better performance


collisions could be missed if the collision happened close to a timestep border, this has been fixed
Signed-off-by: Uwe Woessner's avatarhpcwoess <woessner@hlrs.de>
parent 08b8fac3
......@@ -128,12 +128,11 @@ Source: {#ICU}\bin64\icuuc58.dll; DestDir: {#DBIN}; Flags: skipifsourcedoesntexi
Source: {#ICU}\bin64\icuin58.dll; DestDir: {#DBIN}; Flags: skipifsourcedoesntexist; Components: core
Source: {#ICU}\bin64\icudt58.dll; DestDir: {#DBIN}; Flags: skipifsourcedoesntexist; Components: core
Source: {#ICONFILE}; DestDir: {#DBIN}; Flags: skipifsourcedoesntexist; Components: core
Source: {#OP_SOURCE}\Documentation; DestDir: {app}\Documentation; Excludes: .svn\*,*.tex,*.aux,*.log,*.pl,WARNINGS; Flags: recursesubdirs; Components: help
Source: {#OP_SOURCE}\scripts\windowsEnv.bat; DestDir: {app}\scripts; Components: core
Source: {#OP_SOURCE}\Documentation\*; DestDir: {app}\Documentation; Excludes: .svn\*,*.tex,*.aux,*.log,*.pl,WARNINGS; Flags: recursesubdirs; Components: help
Source: {#OP_SOURCE}\scripts\windowsEnv.bat; DestDir: {app}\scripts; Components: core
[Registry]
; for user installation
......
......@@ -101,7 +101,7 @@ public:
*
* @return Name of source component as string.
*/
virtual std::string GetSource() const
virtual const std::string &GetSource() const
{
return source;
}
......@@ -111,7 +111,7 @@ public:
*
* @return Sequence name as string.
*/
virtual std::string GetSequenceName() const
virtual const std::string &GetSequenceName() const
{
return sequenceName;
}
......
......@@ -89,7 +89,7 @@ class SpawnInfo
{
public:
SpawnInfo() {}
SpawnInfo(double t, double s, double v, std::string roadId, int lane, double offset, double acceleration, double heading = 0):
SpawnInfo(double t, double s, double v, const std::string roadId, int lane, double offset, double acceleration, double heading = 0):
TStart(t), roadId(roadId), ILane(lane), heading(heading)
{
this->s.value = s;
......
......@@ -27,7 +27,7 @@ struct RoadNetworkElement
std::string id;
RoadNetworkElement() = default;
RoadNetworkElement(RoadNetworkElementType type, std::string id) :
RoadNetworkElement(RoadNetworkElementType type, const std::string & id) :
type(type),
id(id)
{}
......@@ -42,7 +42,7 @@ struct JunctionConnection
struct JunctionConnectorPriority
{
JunctionConnectorPriority(std::string high, std::string low) :
JunctionConnectorPriority(const std::string& high, const std::string& low) :
high(high),
low(low)
{}
......@@ -150,7 +150,7 @@ struct RoadPosition
struct GlobalRoadPosition
{
GlobalRoadPosition() = default;
GlobalRoadPosition(std::string roadId, int laneId, double s, double t, double hdg) :
GlobalRoadPosition(const std::string roadId, int laneId, double s, double t, double hdg) :
roadId{roadId},
laneId{laneId},
roadPosition(s, t, hdg)
......
......@@ -525,7 +525,7 @@ LCM_LC2013::informFollower(AbstractLaneChangeModel::LCMessager& msgPass,
// XXX: 1) Decelerating *once* does not necessarily lead to the gap decelGap! (if TS<1s.) (Leo)
// 2) Probably, the if() for euler should test for dv * (remainingSeconds-1) > ..., too ?!, refs. #2578
} else if (dir == LCA_MRIGHT && !myAllowOvertakingRight && (!neighFollow->GetState()->velocity_long<(60/3.6))){
} else if (dir == LCA_MRIGHT && !myAllowOvertakingRight && (!(neighFollow->GetState()->velocity_long<(60/3.6)))){
// XXX: check if this requires a special treatment for the ballistic update, refs. #2575
const double vhelp = std::max(neighNewSpeed, HELP_OVERTAKE);
......@@ -629,7 +629,6 @@ LCM_LC2013::_wantsChange(
double *occupancy,
double *targetoccupancy,
const RoadGeometry *RoadGeometry) {
time_t currentTime;
// compute bestLaneOffset
int curr, neigh, best;
......@@ -739,7 +738,7 @@ LCM_LC2013::_wantsChange(
double vMax = std::min(vehicleParameters.maxVelocity, *agent->GetDriverInformation()->v_Wish);
// upper bound which will be restricted successively
double thisLaneVSafe = vMax;
const bool checkOverTakeRight = (checkOverTakeRightPre && !agent->GetState_Ego()->velocity_long<16); // !myAllowOvertakingRight;
const bool checkOverTakeRight = (checkOverTakeRightPre && !(agent->GetState_Ego()->velocity_long<16)); // !myAllowOvertakingRight;
bool changeLeftToAvoidOvertakeRight = true;
if (changeToBest
......@@ -1197,7 +1196,7 @@ LCM_LC2013::slowDownForBlocked(SurroundingMovingObjectsData* blocked, int state,
void
LCM_LC2013::saveBlockerLength(SurroundingMovingObjectsData* blocker, int lcaCounter, egoData* agent) {
if (blocker != 0 && (blocker->GetState()->indicatorstate!=IndicatorState::IndicatorState_Off & lcaCounter) != 0) {
if (blocker != 0 && blocker->GetState()->indicatorstate!=IndicatorState::IndicatorState_Off && lcaCounter != 0) {
// is there enough space in front of us for the blocker?
const double potential = myLeftSpace - myCarFollowModel->brakeGap(
&agent->GetState_Ego()->velocity_long);
......
......@@ -21,7 +21,7 @@
#include "Common/componentStateChangeEvent.h"
#include "Common/componentWarningEvent.h"
ComponentControllerImplementation::ComponentControllerImplementation(std::string componentName,
ComponentControllerImplementation::ComponentControllerImplementation(const std::string & componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -33,7 +33,7 @@ class ComponentControllerImplementation : public UnrestrictedEventModelInterface
public:
const std::string COMPONENTNAME = "ComponentController";
ComponentControllerImplementation(std::string componentName,
ComponentControllerImplementation(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -20,7 +20,7 @@
#include "Interfaces/observationInterface.h"
#include "Common/componentStateChangeEvent.h"
TrajectoryFollowerCommonBase::TrajectoryFollowerCommonBase(std::string componentName,
TrajectoryFollowerCommonBase::TrajectoryFollowerCommonBase(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -78,7 +78,7 @@ class TrajectoryFollowerCommonBase : public UnrestrictedEventModelInterface
public:
const std::string COMPONENTNAME = "Dynamics_TrajectoryFollower";
TrajectoryFollowerCommonBase(std::string componentName,
TrajectoryFollowerCommonBase(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -22,7 +22,7 @@
#include "Signals/sensorDriverSignal.h"
SensorDriverImplementation::SensorDriverImplementation(
std::string componentName,
const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -76,7 +76,7 @@ public:
//! \param [in] observations Interface which has to be provided by observation modules
//! \param [in] callbacks Interface for callbacks to framework
//! \param [in] agent This interface provides access to agent parameters, properties, attributes and dynamic states
SensorDriverImplementation(std::string componentName,
SensorDriverImplementation(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -37,7 +37,7 @@
// #include "complexsignals.cpp"
Sensor_Modular_Driver_Implementation::Sensor_Modular_Driver_Implementation(std::string componentName,
Sensor_Modular_Driver_Implementation::Sensor_Modular_Driver_Implementation(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......
......@@ -75,7 +75,7 @@ class Sensor_Modular_Driver_Implementation : public SensorInterface
public:
const std::string COMPONENTNAME = "Sensor_Modular_Driver";
Sensor_Modular_Driver_Implementation(std::string componentName,
Sensor_Modular_Driver_Implementation(const std::string &componentName,
bool isInit,
int priority,
int offsetTime,
......@@ -196,7 +196,7 @@ public:
//! \param odRoadId Id of Road in openDrive-Format
//! \return Id of Road in OWL-Format
//!
uint64_t GetCurrentOsiLaneId(std::string odRoadId)
uint64_t GetCurrentOsiLaneId(const std::string &odRoadId)
{
std::unordered_map<uint64_t, std::string> RoadMap = static_cast<OWL::WorldData*>(GetWorld()->GetWorldData())->GetRoadIdMapping();
for (auto it = RoadMap.begin(); it!=RoadMap.end(); ++it)
......
......@@ -130,7 +130,7 @@ std::shared_ptr<SignalInterface const> SignalPrioritizerImplementation::GetSigna
return signalWithHighestPriority;
}
void SignalPrioritizerImplementation::Error(std::string message) const
void SignalPrioritizerImplementation::Error(const std::string &message) const
{
const std::string errorMsg = COMPONENTNAME + " " + message;
LOG(CbkLogLevel::Debug, errorMsg);
......
......@@ -117,7 +117,7 @@ private:
*
* \param[in] message message for to the log and thrown exception
*/
[[noreturn]]void Error(std::string message) const;
[[noreturn]]void Error(const std::string &message) const;
};
......
......@@ -9,6 +9,62 @@ add_openpass_target(
parameters.h
xmlParser.h
cephesMIT/mconf.h
../../Interfaces/agentBlueprintInterface.h
../../Interfaces/agentBlueprintProviderInterface.h
../../Interfaces/agentFactoryInterface.h
../../Interfaces/agentInterface.h
../../Interfaces/agentTypeInterface.h
../../Interfaces/callbackInterface.h
../../Interfaces/collisionDetectionInterface.h
../../Interfaces/componentInterface.h
../../Interfaces/configurationContainerInterface.h
../../Interfaces/eventDetectorInterface.h
../../Interfaces/eventDetectorNetworkInterface.h
../../Interfaces/eventInterface.h
../../Interfaces/eventNetworkInterface.h
../../Interfaces/frameworkModuleContainerInterface.h
../../Interfaces/manipulatorInterface.h
../../Interfaces/manipulatorNetworkInterface.h
../../Interfaces/modelInterface.h
../../Interfaces/observationInterface.h
../../Interfaces/observationNetworkInterface.h
../../Interfaces/parameterInterface.h
../../Interfaces/profilesInterface.h
../../Interfaces/runResultInterface.h
../../Interfaces/samplerInterface.h
../../Interfaces/scenarioActionInterface.h
../../Interfaces/scenarioInterface.h
../../Interfaces/sceneryInterface.h
../../Interfaces/signalInterface.h
../../Interfaces/slaveConfigInterface.h
../../Interfaces/spawnControlInterface.h
../../Interfaces/spawnPointInterface.h
../../Interfaces/spawnPointNetworkInterface.h
../../Interfaces/stochasticsInterface.h
../../Interfaces/systemConfigInterface.h
../../Interfaces/trafficObjectInterface.h
../../Interfaces/trajectoryInterface.h
../../Interfaces/vehicleModelsInterface.h
../../Interfaces/worldInterface.h
../../Interfaces/worldObjectInterface.h
../../Interfaces/roadInterface/connectionInterface.h
../../Interfaces/roadInterface/junctionInterface.h
../../Interfaces/roadInterface/roadElementTypes.h
../../Interfaces/roadInterface/roadElevation.h
../../Interfaces/roadInterface/roadGeometryArcInterface.h
../../Interfaces/roadInterface/roadGeometryInterface.h
../../Interfaces/roadInterface/roadGeometryLineInterface.h
../../Interfaces/roadInterface/roadGeometryPoly3Interface.h
../../Interfaces/roadInterface/roadGeometrySpiralInterface.h
../../Interfaces/roadInterface/roadInterface.h
../../Interfaces/roadInterface/roadLaneInterface.h
../../Interfaces/roadInterface/roadLaneOffset.h
../../Interfaces/roadInterface/roadLaneRoadMark.h
../../Interfaces/roadInterface/roadLaneSectionInterface.h
../../Interfaces/roadInterface/roadLaneWidth.h
../../Interfaces/roadInterface/roadLinkInterface.h
../../Interfaces/roadInterface/roadObjectInterface.h
../../Interfaces/roadInterface/roadSignalInterface.h
SOURCES
callbacks.cpp
......
......@@ -26,53 +26,53 @@ bool CheckedInsert(Map& map, std::string name, Value& value)
return inserted;
}
bool Parameters::AddParameterDouble(std::string name, double value)
bool Parameters::AddParameterDouble(const std::string &name, double value)
{
return CheckedInsert(parametersDouble, name, value);
}
bool Parameters::AddParameterInt(std::string name, int value)
bool Parameters::AddParameterInt(const std::string& name, int value)
{
return CheckedInsert(parametersInt, name, value);
}
bool Parameters::AddParameterBool(std::string name, bool value)
bool Parameters::AddParameterBool(const std::string& name, bool value)
{
return CheckedInsert(parametersBool, name, value);
}
bool Parameters::AddParameterDoubleVector(std::string name, const std::vector<double> value)
bool Parameters::AddParameterDoubleVector(const std::string& name, const std::vector<double> value)
{
return CheckedInsert(parametersDoubleVector, name, value);
}
bool Parameters::AddParameterIntVector(std::string name, const std::vector<int> value)
bool Parameters::AddParameterIntVector(const std::string& name, const std::vector<int> value)
{
return CheckedInsert(parametersIntVector, name, value);
}
bool Parameters::AddParameterBoolVector(std::string name, const std::vector<bool> value)
bool Parameters::AddParameterBoolVector(const std::string& name, const std::vector<bool> value)
{
return CheckedInsert(parametersBoolVector, name, value);
}
bool Parameters::AddParameterString(std::string name, const std::string& value)
bool Parameters::AddParameterString(const std::string& name, const std::string& value)
{
return CheckedInsert(parametersString, name, value);
}
bool Parameters::AddParameterStringVector(std::string name, const std::vector<std::string> value)
bool Parameters::AddParameterStringVector(const std::string& name, const std::vector<std::string> value)
{
return CheckedInsert(parametersStringVector, name, value);
}
bool Parameters::AddParameterNormalDistribution(std::string name,
bool Parameters::AddParameterNormalDistribution(const std::string& name,
const StochasticDefintions::NormalDistributionParameter value)
{
return CheckedInsert(parametersNormalDistribution, name, value);
}
ParameterInterface& Parameters::InitializeListItem(std::string key)
ParameterInterface& Parameters::InitializeListItem(const std::string &key)
{
auto& element = parameterLists[key];
element.emplace_back(std::make_shared<ModelParameters>());
......
......@@ -44,18 +44,18 @@ public:
parametersNormalDistribution{other.GetParametersNormalDistribution()},
parameterLists{other.GetParameterLists()} {}
bool AddParameterDouble(std::string name, double value) override;
bool AddParameterInt(std::string name, int value) override;
bool AddParameterBool(std::string name, bool value) override;
bool AddParameterString(std::string name, const std::string& value) override;
bool AddParameterDoubleVector(std::string name, const std::vector<double> value) override;
bool AddParameterIntVector(std::string name, const std::vector<int> value) override;
bool AddParameterBoolVector(std::string name, const std::vector<bool> value) override;
bool AddParameterStringVector(std::string name, const std::vector<std::string> value) override;
bool AddParameterNormalDistribution(std::string name,
bool AddParameterDouble(const std::string &name, double value) override;
bool AddParameterInt(const std::string &name, int value) override;
bool AddParameterBool(const std::string &name, bool value) override;
bool AddParameterString(const std::string &name, const std::string& value) override;
bool AddParameterDoubleVector(const std::string &name, const std::vector<double> value) override;
bool AddParameterIntVector(const std::string &name, const std::vector<int> value) override;
bool AddParameterBoolVector(const std::string &name, const std::vector<bool> value) override;
bool AddParameterStringVector(const std::string &name, const std::vector<std::string> value) override;
bool AddParameterNormalDistribution(const std::string &name,
const StochasticDefintions::NormalDistributionParameter value) override;
ParameterInterface& InitializeListItem(std::string key) override;
ParameterInterface& InitializeListItem(const std::string &key) override;
//NOTE: The primitive getters are in header on purpose
......
......@@ -24,7 +24,7 @@ EventDetectorBinding::~EventDetectorBinding()
Unload();
}
std::vector<const EventDetector*> EventDetectorBinding::Instantiate(const std::string libraryPath,
std::vector<const EventDetector*> EventDetectorBinding::Instantiate(const std::string &libraryPath,
ScenarioInterface *scenario,
EventNetworkInterface* eventNetwork,
WorldInterface *world,
......
......@@ -50,7 +50,7 @@ public:
//! @param[in] stochastics The stochastics object
//! @return Vector of created EventDetectors from the library
//-----------------------------------------------------------------------------
std::vector<const EventDetector *> Instantiate(const std::string libraryPath,
std::vector<const EventDetector *> Instantiate(const std::string &libraryPath,
ScenarioInterface *scenario,
EventNetworkInterface *eventNetwork,
WorldInterface *world,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment