]>
git.saurik.com Git - wxWidgets.git/blob - src/common/ipcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/ipcbase.cpp
3 // Purpose: IPC base classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
22 #include "wx/ipcbase.h"
24 IMPLEMENT_CLASS(wxServerBase
, wxObject
)
25 IMPLEMENT_CLASS(wxClientBase
, wxObject
)
26 IMPLEMENT_CLASS(wxConnectionBase
, wxObject
)
28 wxConnectionBase::wxConnectionBase(void *buffer
, size_t bytes
)
29 : m_buffer((char *)buffer
),
31 m_deletebufferwhendone(false),
35 { // behave like next constructor
37 m_deletebufferwhendone
= true;
41 wxConnectionBase::wxConnectionBase()
44 m_deletebufferwhendone(true),
49 wxConnectionBase::wxConnectionBase(const wxConnectionBase
& copy
)
51 m_buffer(copy
.m_buffer
),
52 m_buffersize(copy
.m_buffersize
),
53 m_deletebufferwhendone(false),
54 m_connected(copy
.m_connected
)
57 // copy constructor would require ref-counted pointer to buffer
58 wxFAIL_MSG( _T("Copy constructor of wxConnectionBase not implemented") );
62 wxConnectionBase::~wxConnectionBase(void)
64 if ( m_deletebufferwhendone
&& m_buffer
)
68 void *wxConnectionBase::GetBufferAtLeast( size_t bytes
)
70 if ( m_buffersize
>= bytes
)
73 { // need to resize buffer
74 if ( m_deletebufferwhendone
)
75 { // we're in charge of buffer, increase it
78 m_buffer
= new char[bytes
];
81 } // user-supplied buffer, fail