@@ -114,10 +114,10 @@ bool COSMPDummySensor::get_fmi_sensor_view_config(osi3::SensorViewConfiguration&
114
114
115
115
void COSMPDummySensor::set_fmi_sensor_view_config_request (const osi3::SensorViewConfiguration& data)
116
116
{
117
- data.SerializeToString (& currentConfigRequestBuffer);
118
- encode_pointer_to_integer (currentConfigRequestBuffer. data (),integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASELO_IDX]);
119
- integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_SIZE_IDX]=(fmi2Integer)currentConfigRequestBuffer. length ();
120
- normal_log (" OSMP" ," Providing %08X %08X, writing from %p ..." ,integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASELO_IDX],currentConfigRequestBuffer. data ());
117
+ data.SerializeToString (currentConfigRequestBuffer);
118
+ encode_pointer_to_integer (currentConfigRequestBuffer-> data (),integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASELO_IDX]);
119
+ integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_SIZE_IDX]=(fmi2Integer)currentConfigRequestBuffer-> length ();
120
+ normal_log (" OSMP" ," Providing %08X %08X, writing from %p ..." ,integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORVIEW_CONFIG_REQUEST_BASELO_IDX],currentConfigRequestBuffer-> data ());
121
121
swap (currentConfigRequestBuffer,lastConfigRequestBuffer);
122
122
}
123
123
@@ -142,10 +142,10 @@ bool COSMPDummySensor::get_fmi_sensor_view_in(osi3::SensorView& data)
142
142
143
143
void COSMPDummySensor::set_fmi_sensor_data_out (const osi3::SensorData& data)
144
144
{
145
- data.SerializeToString (& currentOutputBuffer);
146
- encode_pointer_to_integer (currentOutputBuffer. data (),integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASELO_IDX]);
147
- integer_vars[FMI_INTEGER_SENSORDATA_OUT_SIZE_IDX]=(fmi2Integer)currentOutputBuffer. length ();
148
- normal_log (" OSMP" ," Providing %08X %08X, writing from %p ..." ,integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASELO_IDX],currentOutputBuffer. data ());
145
+ data.SerializeToString (currentOutputBuffer);
146
+ encode_pointer_to_integer (currentOutputBuffer-> data (),integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASELO_IDX]);
147
+ integer_vars[FMI_INTEGER_SENSORDATA_OUT_SIZE_IDX]=(fmi2Integer)currentOutputBuffer-> length ();
148
+ normal_log (" OSMP" ," Providing %08X %08X, writing from %p ..." ,integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASEHI_IDX],integer_vars[FMI_INTEGER_SENSORDATA_OUT_BASELO_IDX],currentOutputBuffer-> data ());
149
149
swap (currentOutputBuffer,lastOutputBuffer);
150
150
}
151
151
@@ -255,7 +255,7 @@ void rotatePoint(double x, double y, double z,double yaw,double pitch,double rol
255
255
rz = matrix[2 ][0 ] * x + matrix[2 ][1 ] * y + matrix[2 ][2 ] * z;
256
256
}
257
257
258
- fmi2Status COSMPDummySensor::doCalc (fmi2Real currentCommunicationPoint, fmi2Real communicationStepSize, fmi2Boolean noSetFMUStatePriorToCurrentPointfmi2Component )
258
+ fmi2Status COSMPDummySensor::doCalc (fmi2Real currentCommunicationPoint, fmi2Real communicationStepSize, fmi2Boolean noSetFMUStatePriorToCurrentPoint )
259
259
{
260
260
DEBUGBREAK ();
261
261
@@ -373,6 +373,10 @@ COSMPDummySensor::COSMPDummySensor(fmi2String theinstanceName, fmi2Type thefmuTy
373
373
loggingOn(!!theloggingOn),
374
374
simulation_started(false )
375
375
{
376
+ currentOutputBuffer=new string ();
377
+ lastOutputBuffer=new string ();
378
+ currentConfigRequestBuffer=new string ();
379
+ lastConfigRequestBuffer=new string ();
376
380
loggingCategories.clear ();
377
381
loggingCategories.insert (" FMI" );
378
382
loggingCategories.insert (" OSMP" );
@@ -381,22 +385,24 @@ COSMPDummySensor::COSMPDummySensor(fmi2String theinstanceName, fmi2Type thefmuTy
381
385
382
386
COSMPDummySensor::~COSMPDummySensor ()
383
387
{
384
-
388
+ delete currentOutputBuffer;
389
+ delete lastOutputBuffer;
390
+ delete currentConfigRequestBuffer;
391
+ delete lastConfigRequestBuffer;
385
392
}
386
393
387
-
388
394
fmi2Status COSMPDummySensor::SetDebugLogging (fmi2Boolean theloggingOn, size_t nCategories, const fmi2String categories[])
389
395
{
390
396
fmi_verbose_log (" fmi2SetDebugLogging(%s)" , theloggingOn ? " true" : " false" );
391
397
loggingOn = theloggingOn ? true : false ;
392
398
if (categories && (nCategories > 0 )) {
393
399
loggingCategories.clear ();
394
400
for (size_t i=0 ;i<nCategories;i++) {
395
- if (categories[i] == " FMI" )
401
+ if (0 == strcmp ( categories[i], " FMI" ) )
396
402
loggingCategories.insert (" FMI" );
397
- else if (categories[i] == " OSMP" )
403
+ else if (0 == strcmp ( categories[i], " OSMP" ) )
398
404
loggingCategories.insert (" OSMP" );
399
- else if (categories[i] == " OSI" )
405
+ else if (0 == strcmp ( categories[i], " OSI" ) )
400
406
loggingCategories.insert (" OSI" );
401
407
}
402
408
} else {
0 commit comments