Usermode/AxWin4 - Fix deserialiser, ::std::map for client windows, debugging
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / CClient.cpp
1 /*
2  * Acess2 GUI v4
3  * - By John Hodge (thePowersGang)
4  *
5  * CClient.cpp
6  * - IPC Client
7  */
8 #include <CClient.hpp>
9 #include <IIPCChannel.hpp>
10 #include <ipc.hpp>
11
12 namespace AxWin {
13
14 CClient::CClient(::AxWin::IIPCChannel& channel):
15         m_channel(channel)
16 {
17         
18 }
19
20 CClient::~CClient()
21 {
22         ::AxWin::IPC::DeregisterClient(*this);
23 }
24
25 CWindow* CClient::GetWindow(int ID)
26 {
27         if( ID == 0 )
28                 return 0;
29         
30         return m_windows[ID];
31 }
32
33 void CClient::SetWindow(int ID, CWindow* window)
34 {
35         _SysDebug("SetWindow(ID=%i,window=%p)", ID, window);
36         if( m_windows[ID] ) {
37                 delete m_windows[ID];
38         }
39         _SysDebug("SetWindow - Set", ID, window);
40         m_windows[ID] = window;
41         _SysDebug("SetWindow - END");
42 }
43
44 void CClient::HandleMessage(CDeserialiser& message)
45 {
46         try {
47                 IPC::HandleMessage(*this, message);
48                 if( !message.IsConsumed() )
49                 {
50                         _SysDebug("NOTICE - CClient::HandleMessage - Trailing data in message");
51                 }
52         }
53         catch( const ::std::exception& e )
54         {
55                 _SysDebug("ERROR - Exception while processing message from client: %s", e.what());
56         }
57         catch( ... )
58         {
59                 _SysDebug("ERROR - Unknown exception while processing message from client");
60         }
61 }
62
63 };      // namespace AxWin
64

UCC git Repository :: git.ucc.asn.au