44#include < wx/listimpl.cpp>
55#include < wx/arrimpl.cpp>
66#include " ExecHiddenMSW.h"
7- WX_DEFINE_OBJARRAY (XmlRpcInstanceCollection);
7+ // WX_DEFINE_OBJARRAY(XmlRpcInstanceCollection);
88WX_DEFINE_LIST (XmlRpcJobQueue);
99
1010using namespace std ;
@@ -341,7 +341,7 @@ XmlRpcInstance::~XmlRpcInstance()
341341 m_pipeclient=NULL ;
342342}
343343
344- XmlRpcInstance::XmlRpcInstance (const wxString &processcmd, const wxString &hostaddress, int port , wxWindow *parent)
344+ XmlRpcInstance::XmlRpcInstance (const wxString &processcmd, int port, const wxString &hostaddress, wxWindow *parent)
345345{
346346 m_parent=parent;
347347 m_port=port;
@@ -354,12 +354,8 @@ XmlRpcInstance::XmlRpcInstance(const wxString &processcmd, const wxString &hosta
354354 m_proc_killlevel=0 ;
355355 m_jobrunning=false ;
356356 // Launch process
357- LaunchProcess (processcmd); // TODO: The command for the interpreter process should come from the manager (and be stored in a config file)
358- // Setup XMLRPC client and use introspection API to look up the supported methods
359- if (port==-1 )
360- m_pipeclient = new XmlRpcPipeClient (m_proc);
361- else
362- m_client = new XmlRpc::XmlRpcClient (hostaddress.char_str (), port);
357+ if (processcmd!=wxEmptyString)
358+ LaunchProcess (processcmd); // TODO: The command for the interpreter process should come from the manager (and be stored in a config file)
363359}
364360
365361long XmlRpcInstance::LaunchProcess (const wxString &processcmd)
@@ -388,6 +384,12 @@ long XmlRpcInstance::LaunchProcess(const wxString &processcmd)
388384// std::cout<<"PyCC: LAUNCHING PROCESS SUCCEEDED"<<std::endl;
389385 m_proc_dead=false ;
390386 m_proc_killlevel=0 ;
387+
388+ // Setup XMLRPC client and use introspection API to look up the supported methods
389+ if (m_port==-1 )
390+ m_pipeclient = new XmlRpcPipeClient (m_proc);
391+ else
392+ m_client = new XmlRpc::XmlRpcClient (m_hostaddress.char_str (), m_port);
391393 }
392394 return m_proc_id;
393395}
@@ -434,6 +436,7 @@ void XmlRpcInstance::OnEndProcess(wxProcessEvent &event)
434436 wxCommandEvent ce (wxEVT_XMLRPC_PROC_END,0 );
435437 if (m_parent)
436438 m_parent->AddPendingEvent (ce);
439+ // XmlRpcMgr::Get().Remove(this);
437440}
438441
439442void XmlRpcInstance::Break ()
@@ -544,29 +547,42 @@ void XmlRpcInstance::OnJobNotify(wxCommandEvent &event)
544547 NextJob ();
545548}
546549
547- XmlRpcMgr::XmlRpcMgr ()
548- {
549- }
550-
551- XmlRpcMgr::~XmlRpcMgr ()
552- {
553- m_Interpreters.Empty ();
554- }
555-
556- XmlRpcInstance *XmlRpcMgr::LaunchProcess (const wxString &cmd,int port,const wxString &address)
557- {
558- XmlRpcInstance *p=new XmlRpcInstance (cmd,address,port);
559- if (p)
560- m_Interpreters.Add (p);
561- return p;
562- }
563-
564- XmlRpcMgr &XmlRpcMgr::Get ()
565- {
566- if (theSingleInstance.get () == 0 )
567- theSingleInstance.reset (new XmlRpcMgr);
568- return *theSingleInstance;
569- }
570-
571- std::auto_ptr<XmlRpcMgr> XmlRpcMgr::theSingleInstance;
572-
550+ // XmlRpcMgr::XmlRpcMgr()
551+ // {
552+ // }
553+ //
554+ // XmlRpcMgr::~XmlRpcMgr()
555+ // {
556+ // m_Interpreters.Clear();
557+ // }
558+ //
559+ // XmlRpcInstance *XmlRpcMgr::LaunchProcess(const wxString &cmd,int port,const wxString &address)
560+ // {
561+ // XmlRpcInstance *p=new XmlRpcInstance(cmd,address,port);
562+ // if(p)
563+ // m_Interpreters.Add(p);
564+ // return p;
565+ // }
566+ //
567+ // void XmlRpcMgr::Remove(XmlRpcInstance *p)
568+ // {
569+ // // m_Interpreters.Remove(*p);
570+ // // for (size_t i=0; i<m_Interpreters.GetCount(); ++i)
571+ // // {
572+ // // if (m_Interpreters.Item(i) == *p)
573+ // // {
574+ // // m_Interpreters.RemoveAt(i);
575+ // // return;
576+ // // }
577+ // // }
578+ // }
579+ //
580+ // XmlRpcMgr &XmlRpcMgr::Get()
581+ // {
582+ // if (theSingleInstance.get() == 0)
583+ // theSingleInstance.reset(new XmlRpcMgr);
584+ // return *theSingleInstance;
585+ // }
586+ //
587+ // std::auto_ptr<XmlRpcMgr> XmlRpcMgr::theSingleInstance;
588+ //
0 commit comments