1080 TMMCSessRing::TMMCSessRing() |
1080 TMMCSessRing::TMMCSessRing() |
1081 /** |
1081 /** |
1082 * Constructor |
1082 * Constructor |
1083 */ |
1083 */ |
1084 : iPMark(NULL),iPoint(NULL),iPrevP(NULL),iSize(0) |
1084 : iPMark(NULL),iPoint(NULL),iPrevP(NULL),iSize(0) |
1085 {OstTraceFunctionEntry1( TMMCSESSRING_TMMCSESSRING_ENTRY, this );} |
1085 {} |
1086 |
1086 |
1087 |
1087 |
1088 void TMMCSessRing::Erase() |
1088 void TMMCSessRing::Erase() |
1089 /** |
1089 /** |
1090 * Erases all the ring content |
1090 * Erases all the ring content |
1091 */ |
1091 */ |
1092 { |
1092 { |
1093 OstTraceFunctionEntry1( TMMCSESSRING_ERASE_ENTRY, this ); |
|
1094 iPMark = iPoint = iPrevP = NULL; iSize = 0; |
1093 iPMark = iPoint = iPrevP = NULL; iSize = 0; |
1095 OstTraceFunctionExit1( TMMCSESSRING_ERASE_EXIT, this ); |
|
1096 } |
1094 } |
1097 |
1095 |
1098 |
1096 |
1099 DMMCSession* TMMCSessRing::operator++(TInt) |
1097 DMMCSession* TMMCSessRing::operator++(TInt) |
1100 /** |
1098 /** |
1116 TBool TMMCSessRing::Point(DMMCSession* aSessP) |
1114 TBool TMMCSessRing::Point(DMMCSession* aSessP) |
1117 /** |
1115 /** |
1118 * Finds aSessP and sets Point to that position |
1116 * Finds aSessP and sets Point to that position |
1119 */ |
1117 */ |
1120 { |
1118 { |
1121 OstTraceFunctionEntryExt( TMMCSESSRING_POINT_ENTRY, this ); |
|
1122 Point(); |
1119 Point(); |
1123 |
1120 |
1124 while( iPoint != NULL ) |
1121 while( iPoint != NULL ) |
1125 if( iPoint == aSessP ) |
1122 if( iPoint == aSessP ) |
1126 { |
1123 { |
1127 OstTraceFunctionExitExt( TMMCSESSRING_POINT_EXIT1, this, (TUint) ETrue ); |
|
1128 return ETrue; |
1124 return ETrue; |
1129 } |
1125 } |
1130 else |
1126 else |
1131 this->operator++(0); |
1127 this->operator++(0); |
1132 |
1128 |
1133 OstTraceFunctionExitExt( TMMCSESSRING_POINT_EXIT2, this, (TUint) EFalse ); |
|
1134 return EFalse; |
1129 return EFalse; |
1135 } |
1130 } |
1136 |
1131 |
1137 void TMMCSessRing::Add(DMMCSession* aSessP) |
1132 void TMMCSessRing::Add(DMMCSession* aSessP) |
1138 /** |
1133 /** |
1139 * Inserts aSessP before Marker. Point is moved into the Marker position. |
1134 * Inserts aSessP before Marker. Point is moved into the Marker position. |
1140 */ |
1135 */ |
1141 { |
1136 { |
1142 OstTraceFunctionEntryExt( TMMCSESSRING_ADD1_ENTRY, this ); |
|
1143 if( iSize == 0 ) |
1137 if( iSize == 0 ) |
1144 { |
1138 { |
1145 iPMark = iPrevP = iPoint = aSessP; |
1139 iPMark = iPrevP = iPoint = aSessP; |
1146 aSessP->iLinkP = aSessP; |
1140 aSessP->iLinkP = aSessP; |
1147 iSize = 1; |
1141 iSize = 1; |
1148 OstTraceFunctionExit1( TMMCSESSRING_ADD1_EXIT1, this ); |
|
1149 return; |
1142 return; |
1150 } |
1143 } |
1151 |
1144 |
1152 iPoint = iPMark->iLinkP; |
1145 iPoint = iPMark->iLinkP; |
1153 iPMark->iLinkP = aSessP; |
1146 iPMark->iLinkP = aSessP; |
1154 aSessP->iLinkP = iPoint; |
1147 aSessP->iLinkP = iPoint; |
1155 iPMark = iPrevP = aSessP; |
1148 iPMark = iPrevP = aSessP; |
1156 iSize++; |
1149 iSize++; |
1157 OstTraceFunctionExit1( TMMCSESSRING_ADD1_EXIT2, this ); |
|
1158 } |
1150 } |
1159 |
1151 |
1160 |
1152 |
1161 void TMMCSessRing::Add(TMMCSessRing& aRing) |
1153 void TMMCSessRing::Add(TMMCSessRing& aRing) |
1162 /** |
1154 /** |
1163 * Inserts aRing before Marker. Point is moved into the Marker position. |
1155 * Inserts aRing before Marker. Point is moved into the Marker position. |
1164 * aRing Marker becomes the fisrt inserted element. |
1156 * aRing Marker becomes the fisrt inserted element. |
1165 * Erases aRing. |
1157 * Erases aRing. |
1166 */ |
1158 */ |
1167 { |
1159 { |
1168 OstTraceFunctionEntry1( TMMCSESSRING_ADD2_ENTRY, this ); |
|
1169 Point(); |
1160 Point(); |
1170 |
1161 |
1171 if( aRing.iSize == 0 ) |
1162 if( aRing.iSize == 0 ) |
1172 { |
1163 { |
1173 OstTraceFunctionExit1( TMMCSESSRING_ADD2_EXIT1, this ); |
|
1174 return; |
1164 return; |
1175 } |
1165 } |
1176 |
1166 |
1177 if( iSize == 0 ) |
1167 if( iSize == 0 ) |
1178 { |
1168 { |
1187 iPrevP->iLinkP = iPoint; |
1177 iPrevP->iLinkP = iPoint; |
1188 iSize += aRing.iSize; |
1178 iSize += aRing.iSize; |
1189 } |
1179 } |
1190 |
1180 |
1191 aRing.Erase(); |
1181 aRing.Erase(); |
1192 OstTraceFunctionExit1( TMMCSESSRING_ADD2_EXIT2, this ); |
|
1193 } |
1182 } |
1194 |
1183 |
1195 DMMCSession* TMMCSessRing::Remove() |
1184 DMMCSession* TMMCSessRing::Remove() |
1196 /** |
1185 /** |
1197 * Removes an element pointed to by Point. |
1186 * Removes an element pointed to by Point. |
1198 * Point (and possibly Marker) move forward as in operator++ |
1187 * Point (and possibly Marker) move forward as in operator++ |
1199 */ |
1188 */ |
1200 { |
1189 { |
1201 OstTraceFunctionEntry1( TMMCSESSRING_REMOVE1_ENTRY, this ); |
|
1202 DMMCSession* remS = iPrevP; |
1190 DMMCSession* remS = iPrevP; |
1203 |
1191 |
1204 if( iSize < 2 ) |
1192 if( iSize < 2 ) |
1205 Erase(); |
1193 Erase(); |
1206 else |
1194 else |
1217 iPMark = iPrevP; |
1205 iPMark = iPrevP; |
1218 iPoint = NULL; |
1206 iPoint = NULL; |
1219 } |
1207 } |
1220 } |
1208 } |
1221 |
1209 |
1222 OstTraceFunctionExitExt( TMMCSESSRING_REMOVE1_EXIT, this, ( TUint )( remS ) ); |
|
1223 return remS; |
1210 return remS; |
1224 } |
1211 } |
1225 |
1212 |
1226 |
1213 |
1227 void TMMCSessRing::Remove(DMMCSession* aSessP) |
1214 void TMMCSessRing::Remove(DMMCSession* aSessP) |
1228 /** |
1215 /** |
1229 * Removes a specified session from the ring |
1216 * Removes a specified session from the ring |
1230 */ |
1217 */ |
1231 { |
1218 { |
1232 OstTraceFunctionEntryExt( TMMCSESSRING_REMOVE2_ENTRY, this ); |
|
1233 if( Point(aSessP) ) |
1219 if( Point(aSessP) ) |
1234 Remove(); |
1220 Remove(); |
1235 else |
1221 else |
1236 DMMCSocket::Panic(DMMCSocket::EMMCSessRingNoSession); |
1222 DMMCSocket::Panic(DMMCSocket::EMMCSessRingNoSession); |
1237 OstTraceFunctionExit1( TMMCSESSRING_REMOVE2_EXIT, this ); |
|
1238 } |
1223 } |
1239 |
1224 |
1240 |
1225 |
1241 |
1226 |
1242 // -------- class TMMCStateMachine -------- |
1227 // -------- class TMMCStateMachine -------- |