Usermode/libc++ - Implement map::insert and map::erase
[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         try {
28                 return m_windows.at(ID);
29         }
30         catch(const std::exception& e) {
31                 return NULL;
32         }
33 }
34
35 void CClient::SetWindow(int ID, CWindow* window)
36 {
37         _SysDebug("SetWindow(ID=%i,window=%p)", ID, window);
38         if( m_windows[ID] ) {
39                 delete m_windows[ID];
40         }
41         m_windows[ID] = window;
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