-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDSChannel2ChannelConnectionComponent.cpp
134 lines (112 loc) · 4.13 KB
/
DSChannel2ChannelConnectionComponent.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/****************************************************************************
* Modul: $RCSfile: DSChannel2ChannelConnectionComponent.cpp,v $
*
* $Author: md $
* $Date: 1998/01/13 12:48:22 $
* $Revision: 1.2 $
* Aufgabe: Basisklasse fuer alle SDL-Strukturen in denen SDL-Kanaele
* mit Signalchanneln verbunden werden koennen.
*
* Funktionen:
****************************************************************************/
#ifdef USE_PRAGMA
#pragma interface
#endif
/****************************************************************************
* Konstanten
****************************************************************************/
/****************************************************************************
* Include-Anweisungen
****************************************************************************/
#include "DSChannel2ChannelConnectionComponent.h"
#include "DSChannel2ChannelConnection.h"
#ifdef DEBUG
#include <dmalloc.h>
#endif
/****************************************************************************
* Externe Variablen
****************************************************************************/
/****************************************************************************
* Globale Variablen
****************************************************************************/
/****************************************************************************
* Konstruktoren
****************************************************************************/
DSChannel2ChannelConnectionComponent::DSChannel2ChannelConnectionComponent(DSObject *father) :
parent(father)
{
channel2channel_connection_list = NULL;
}
/****************************************************************************
* Destruktor
****************************************************************************/
DSChannel2ChannelConnectionComponent::~DSChannel2ChannelConnectionComponent(void)
{
if (channel2channel_connection_list) delete channel2channel_connection_list;
}
DSChannel2ChannelConnectionList* DSChannel2ChannelConnectionComponent::GetChannel2ChannelConnectionList(void) const
{
return channel2channel_connection_list;
}
DSChannel2ChannelConnection *DSChannel2ChannelConnectionComponent::GetFirstChannel2ChannelConnection(void) const
{
if (channel2channel_connection_list == NULL)
{
return NULL;
}
if (channel2channel_connection_list->MoveFirst() != DS_OK)
{
return NULL;
}
return channel2channel_connection_list->GetCurrentData();
}
DSChannel2ChannelConnection *DSChannel2ChannelConnectionComponent::GetNextChannel2ChannelConnection(void) const
{
if (channel2channel_connection_list == NULL)
{
return NULL;
}
if (channel2channel_connection_list->MoveNext() != DS_OK)
{
return NULL;
}
return channel2channel_connection_list->GetCurrentData();
}
DSResult DSChannel2ChannelConnectionComponent::SetChannel2ChannelConnectionList(DSChannel2ChannelConnectionList *list)
{
if (channel2channel_connection_list == list) return DS_OK;
if (channel2channel_connection_list != NULL)
{
delete channel2channel_connection_list;
}
channel2channel_connection_list = list;
return DS_OK;
}
DSResult DSChannel2ChannelConnectionComponent::InsertChannel2ChannelConnection(DSChannel2ChannelConnection* c2c)
{
assert(c2c);
if (channel2channel_connection_list == NULL)
{
channel2channel_connection_list = new DSChannel2ChannelConnectionList;
assert(channel2channel_connection_list != NULL);
}
if (c2c->GetParent() == NULL) // Vater noch nicht gesetzt ?
{
c2c->SetParent(DSChannel2ChannelConnectionComponent::parent);
}
return channel2channel_connection_list->Append(c2c);
}
/****************************************************************************
* GetParent(): Liefert das Vaterobjekt des Objekts
* Ergebnis: Zeiger auf DSObject
* Seiteneffekte: keine
****************************************************************************/
DSObject* DSChannel2ChannelConnectionComponent::GetComponentParent(void) const
{
return parent;
}
DSResult DSChannel2ChannelConnectionComponent::SetComponentParent(const DSObject *par)
{
parent = (DSObject *)par;
return DS_OK;
}