@@ -229,12 +229,24 @@ class AppWrapper : public CMOOSApp {
229229 // Clean shutdown
230230 }
231231
232- bool Run (const std::string & sServer , int Port, const std::string & sMyName , const std::string & sMissionFile = " " ) {
232+ // Standard MOOS pattern: Run with mission file (reads server/port/name from file)
233+ bool Run (const std::string & sMissionFile ) {
234+ SetMissionFile (sMissionFile );
235+ return BASE::Run ();
236+ }
237+
238+ // Alternative: Run with explicit parameters (for when mission file is not used)
239+ bool Run (const std::string & sServer , int Port, const std::string & sMyName ) {
233240 SetAppName (sMyName );
234241 SetServer (sServer , Port);
235- if (!sMissionFile .empty ()) {
236- SetMissionFile (sMissionFile );
237- }
242+ return BASE::Run ();
243+ }
244+
245+ // Run with explicit parameters and mission file
246+ bool Run (const std::string & sServer , int Port, const std::string & sMyName , const std::string & sMissionFile ) {
247+ SetAppName (sMyName );
248+ SetServer (sServer , Port);
249+ SetMissionFile (sMissionFile );
238250 return BASE::Run ();
239251 }
240252
@@ -747,10 +759,19 @@ PYBIND11_MODULE(pymoos, m) {
747759 py::class_<MOOS::AppWrapper, CMOOSApp>(m, " app" )
748760 .def (py::init<>())
749761
750- .def (" run" , &MOOS::AppWrapper::Run,
751- " Run the MOOS application." ,
752- py::arg (" server" ), py::arg (" port" ), py::arg (" name" ),
753- py::arg (" mission_file" ) = " " )
762+ .def (" run" , static_cast <bool (MOOS::AppWrapper::*)(const std::string&)>(&MOOS::AppWrapper::Run),
763+ " Run the MOOS application with mission file. "
764+ " Server, port, and app name are read from the mission file." ,
765+ py::arg (" mission_file" ))
766+
767+ .def (" run" , static_cast <bool (MOOS::AppWrapper::*)(const std::string&, int , const std::string&)>(&MOOS::AppWrapper::Run),
768+ " Run the MOOS application with explicit server, port, and name. "
769+ " Use this when not using a mission file." ,
770+ py::arg (" server" ), py::arg (" port" ), py::arg (" name" ))
771+
772+ .def (" run" , static_cast <bool (MOOS::AppWrapper::*)(const std::string&, int , const std::string&, const std::string&)>(&MOOS::AppWrapper::Run),
773+ " Run the MOOS application with both explicit parameters and mission file." ,
774+ py::arg (" server" ), py::arg (" port" ), py::arg (" name" ), py::arg (" mission_file" ))
754775
755776 .def (" fetch" , &MOOS::AppWrapper::FetchMailAsVector,
756777 " Fetch incoming mail as a vector." )
0 commit comments