source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/Dispatcher/DispatchInfo.cpp @ 53

Last change on this file since 53 was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 1010 bytes
Line 
1#include "DispatchInfo.h"
2
3DispatchInfo::DispatchInfo()
4  : m_pData(0),
5    m_nDataSize(0),
6        m_pProtocolInfo(0)
7{
8}
9
10DispatchInfo::~DispatchInfo()
11{
12        delete [] m_pData;
13        delete m_pProtocolInfo;
14}
15
16const unsigned char * DispatchInfo::GetData() const {
17  return m_pData;
18}
19
20const ssize_t DispatchInfo::GetDataSize() const {
21  return m_nDataSize;
22}
23
24void DispatchInfo::SetData(const unsigned char * pData, const ssize_t nDataSize)
25{
26        delete [] m_pData;
27        if (nDataSize > 0)
28        {
29                m_pData = new unsigned char[nDataSize];
30                memcpy(m_pData, pData, nDataSize);
31                m_nDataSize = nDataSize;
32        }
33        else
34        {
35                m_pData = 0;
36                m_nDataSize = 0;
37        }
38}
39
40void DispatchInfo::AddProtocolInfo(ProtocolInfoElement * info)
41{
42        if (!m_pProtocolInfo)
43                m_pProtocolInfo = new ProtocolInfo();
44        m_pProtocolInfo->AddItem(info);
45}
46
47ProtocolInfo * DispatchInfo::DetachProtocolInfo()
48{
49        ProtocolInfo * pRes = m_pProtocolInfo;
50        m_pProtocolInfo = 0;
51        return pRes;
52}
53
54ProtocolInfo * DispatchInfo::GetProtocolInfo() const
55{
56        return m_pProtocolInfo;
57}
Note: See TracBrowser for help on using the repository browser.