Alex Bikfalvi
SimStream Documentation
StreamMessageBootPushMultiResponse.cpp
00001 #include "Headers.h" 00002 #include "StreamMessageBootPushMultiResponse.h" 00003 00004 CStreamMessageBootPushMultiResponse::CStreamMessageBootPushMultiResponse( 00005 __uint32 stream, 00006 __uint32 layers 00007 ) : CStreamMessage(CStreamMessage::STREAM_MESSAGE_BOOT_PUSH_MULTI_RESPONSE, 64, stream) 00008 { 00009 assert(layers <= BOOT_MAX_LAYERS); 00010 00011 this->type = STREAM; 00012 this->layer = 0; 00013 this->layers = layers; 00014 00015 for(__uint32 index = 0; index < this->layers; index++) 00016 { 00017 this->count[index] = 0; 00018 } 00019 } 00020 00021 CStreamMessageBootPushMultiResponse::CStreamMessageBootPushMultiResponse( 00022 __uint32 stream, 00023 __uint32 layer, 00024 __uint32 count 00025 ) : CStreamMessage(CStreamMessage::STREAM_MESSAGE_BOOT_PUSH_MULTI_RESPONSE, 64 + count * 32, stream) 00026 { 00027 this->type = LAYER; 00028 this->layer = layer; 00029 this->layers = 1; 00030 00031 this->count[0] = count; 00032 } 00033 00034 void CStreamMessageBootPushMultiResponse::Set(__uint32 layer, __uint32 count) 00035 { 00036 assert(layer < this->layers); 00037 assert(count <= BOOT_MAX_HOSTS); 00038 00039 this->size += (count * 32 - this->count[layer] * 32); 00040 this->count[layer] = count; 00041 } 00042 00043 CPacket* CStreamMessageBootPushMultiResponse::Copy() 00044 { 00045 CStreamMessageBootPushMultiResponse* packet; 00046 00047 switch(this->type) 00048 { 00049 case STREAM: 00050 packet = new CStreamMessageBootPushMultiResponse( 00051 this->stream, 00052 this->layers 00053 ); 00054 for(__uint32 layer = 0; layer < this->layers; layer++) 00055 { 00056 packet->count[layer] = this->count[layer]; 00057 for(__uint32 index = 0; index < this->count[layer]; index++) 00058 packet->hosts[layer][index] = this->hosts[layer][index]; 00059 } 00060 break; 00061 case LAYER: 00062 packet = new CStreamMessageBootPushMultiResponse( 00063 this->stream, 00064 this->layer, 00065 this->count[0] 00066 ); 00067 for(__uint32 index = 0; index < this->count[0]; index++) 00068 packet->hosts[0][index] = this->hosts[0][index]; 00069 break; 00070 } 00071 00072 return packet; 00073 }
Last updated: February 8, 2011