@@ -63,8 +63,8 @@ FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number, struct Inp
6363 Type = etTurbine;
6464
6565 MilThrust = MaxThrust = 10000.0 ;
66- TSFC = new FGRealValue (0.8 );
67- ATSFC = new FGRealValue (1.7 );
66+ TSFC = std::make_unique< FGRealValue> (0.8 );
67+ ATSFC = std::make_unique< FGRealValue> (1.7 );
6868 IdleN1 = 30.0 ;
6969 IdleN2 = 60.0 ;
7070 MaxN1 = MaxN2 = 100.0 ;
@@ -84,19 +84,8 @@ FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number, struct Inp
8484
8585// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8686
87- FGTurbine::~FGTurbine ()
88- {
89- delete TSFC;
90- delete ATSFC;
91-
92- Debug (1 );
93- }
94-
95- // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96-
9787void FGTurbine::ResetToIC (void )
9888{
99-
10089 FGEngine::ResetToIC ();
10190
10291 N1 = N2 = InjN1increment = InjN2increment = 0.0 ;
@@ -497,22 +486,20 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
497486
498487 JSBSim::Element* tsfcElement = el->FindElement (" tsfc" );
499488 if (tsfcElement) {
500- delete TSFC;
501489 string value = tsfcElement->GetDataLine ();
502490 if (is_number (value))
503- TSFC = new FGRealValue (atof (value.c_str ()));
491+ TSFC = std::make_unique< FGRealValue> (atof (value.c_str ()));
504492 else
505- TSFC = new FGFunction (FDMExec, tsfcElement, to_string ((int )EngineNumber));
493+ TSFC = std::make_unique< FGFunction> (FDMExec, tsfcElement, to_string ((int )EngineNumber));
506494 }
507495
508496 JSBSim::Element* atsfcElement = el->FindElement (" atsfc" );
509497 if (atsfcElement) {
510- delete ATSFC;
511498 string value = atsfcElement->GetDataLine ();
512499 if (is_number (value))
513- ATSFC = new FGRealValue (atof (value.c_str ()));
500+ ATSFC = std::make_unique< FGRealValue> (atof (value.c_str ()));
514501 else
515- ATSFC = new FGFunction (FDMExec, atsfcElement, to_string ((int )EngineNumber));
502+ ATSFC = std::make_unique< FGFunction> (FDMExec, atsfcElement, to_string ((int )EngineNumber));
516503 }
517504
518505 // Pre-calculations and initializations
@@ -578,36 +565,36 @@ void FGTurbine::bindmodel(FGPropertyManager* PropertyManager)
578565 property_name = base_property_name + " /n2" ;
579566 PropertyManager->Tie ( property_name.c_str (), &N2);
580567 property_name = base_property_name + " /injection_cmd" ;
581- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
568+ PropertyManager->Tie ( property_name.c_str (), this ,
582569 &FGTurbine::GetInjection, &FGTurbine::SetInjection);
583570 property_name = base_property_name + " /seized" ;
584571 PropertyManager->Tie ( property_name.c_str (), &Seized);
585572 property_name = base_property_name + " /stalled" ;
586573 PropertyManager->Tie ( property_name.c_str (), &Stalled);
587574 property_name = base_property_name + " /bleed-factor" ;
588- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this , &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand);
575+ PropertyManager->Tie ( property_name.c_str (), this , &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand);
589576 property_name = base_property_name + " /MaxN1" ;
590- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
577+ PropertyManager->Tie ( property_name.c_str (), this ,
591578 &FGTurbine::GetMaxN1, &FGTurbine::SetMaxN1);
592579 property_name = base_property_name + " /MaxN2" ;
593- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
580+ PropertyManager->Tie ( property_name.c_str (), this ,
594581 &FGTurbine::GetMaxN2, &FGTurbine::SetMaxN2);
595582 property_name = base_property_name + " /InjectionTimer" ;
596- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
583+ PropertyManager->Tie ( property_name.c_str (), this ,
597584 &FGTurbine::GetInjectionTimer, &FGTurbine::SetInjectionTimer);
598585 property_name = base_property_name + " /InjWaterNorm" ;
599- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
586+ PropertyManager->Tie ( property_name.c_str (), this ,
600587 &FGTurbine::GetInjWaterNorm, &FGTurbine::SetInjWaterNorm);
601588 property_name = base_property_name + " /InjN1increment" ;
602- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
589+ PropertyManager->Tie ( property_name.c_str (), this ,
603590 &FGTurbine::GetInjN1increment, &FGTurbine::SetInjN1increment);
604591 property_name = base_property_name + " /InjN2increment" ;
605- PropertyManager->Tie ( property_name.c_str (), (FGTurbine*) this ,
592+ PropertyManager->Tie ( property_name.c_str (), this ,
606593 &FGTurbine::GetInjN2increment, &FGTurbine::SetInjN2increment);
607594 property_name = base_property_name + " /tsfc" ;
608- PropertyManager->Tie (property_name.c_str (), (FGParameter*)TSFC , &FGParameter::GetValue);
595+ PropertyManager->Tie (property_name.c_str (), TSFC. get () , &FGParameter::GetValue);
609596 property_name = base_property_name + " /atsfc" ;
610- PropertyManager->Tie (property_name.c_str (), (FGParameter*)ATSFC , &FGParameter::GetValue);
597+ PropertyManager->Tie (property_name.c_str (), ATSFC. get () , &FGParameter::GetValue);
611598}
612599
613600// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -658,8 +645,8 @@ void FGTurbine::Debug(int from)
658645 cout << " MilThrust: " << MilThrust << endl;
659646 cout << " MaxThrust: " << MaxThrust << endl;
660647 cout << " BypassRatio: " << BypassRatio << endl;
661- cout << " TSFC: " << TSFC << endl;
662- cout << " ATSFC: " << ATSFC << endl;
648+ cout << " TSFC: " << TSFC-> GetValue () << endl;
649+ cout << " ATSFC: " << ATSFC-> GetValue () << endl;
663650 cout << " IdleN1: " << IdleN1 << endl;
664651 cout << " IdleN2: " << IdleN2 << endl;
665652 cout << " MaxN1: " << MaxN1 << endl;
0 commit comments