-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCCommunicationsStack.cpp
78 lines (58 loc) · 1.5 KB
/
CCommunicationsStack.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// CCommunicationsStack.cpp
//
// CCommunicationsStack class
// Copyright (c) 2017 Kronosaur Productions, LLC. All Rights Reserved.
#include "PreComp.h"
CCommunicationsStack::CCommunicationsStack (void) :
m_bInitialized(false)
// CCommunicationsStack constructor
{
}
CCommunicationsHandler *CCommunicationsStack::GetCommsHandler (CDesignType *pParent)
// GetCommsHandler
//
// Returns an integrated communications handler, including any inherited
// values. Or NULL if we have none.
{
CCommunicationsHandler *pParentHandler;
if (pParent && (pParentHandler = pParent->GetCommsHandler()))
{
if (!m_bInitialized)
{
m_Composite.Merge(m_CommsHandler);
m_Composite.Merge(*pParentHandler);
m_bInitialized = true;
}
return (m_Composite.GetCount() ? &m_Composite : NULL);
}
else
return (m_CommsHandler.GetCount() ? &m_CommsHandler : NULL);
}
ALERROR CCommunicationsStack::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// InitFromXML
//
// Initialize from XML
{
if (pDesc == NULL)
return NOERROR;
if (m_CommsHandler.InitFromXML(pDesc, &Ctx.sError) != NOERROR)
return ERR_FAIL;
m_bInitialized = false;
return NOERROR;
}
void CCommunicationsStack::Merge (CCommunicationsStack &Src)
// Merge
//
// Merges from a source
{
if (Src.m_CommsHandler.GetCount() > 0)
m_CommsHandler.Merge(Src.m_CommsHandler);
}
void CCommunicationsStack::Unbind (void)
// Unbind
//
// Unbind in case the inheritance hierarchy changed.
{
m_bInitialized = false;
m_Composite.DeleteAll();
}