92898b110a92db39a7d13e92870e4851fe93fc09
[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         _SysDebug("GetWindow(ID=%i)", ID);
28         try {
29                 return m_windows.at(ID);
30         }
31         catch(const std::exception& e) {
32                 return NULL;
33         }
34 }
35
36 void CClient::SetWindow(int ID, CWindow* window)
37 {
38         _SysDebug("SetWindow(ID=%i,window=%p)", ID, window);
39         if( m_windows[ID] ) {
40                 delete m_windows[ID];
41         }
42         m_windows[ID] = window;
43 }
44
45 void CClient::HandleMessage(CDeserialiser& message)
46 {
47         try {
48                 IPC::HandleMessage(*this, message);
49                 if( !message.IsConsumed() )
50                 {
51                         _SysDebug("NOTICE - CClient::HandleMessage - Trailing data in message");
52                 }
53         }
54         catch( const ::std::exception& e )
55         {
56                 _SysDebug("ERROR - Exception while processing message from client: %s", e.what());
57         }
58         catch( ... )
59         {
60                 _SysDebug("ERROR - Unknown exception while processing message from client");
61         }
62 }
63
64 };      // namespace AxWin
65

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