//---------------------------------------------------------------------------- Command::Command(tcpip::Storage& storageP, size_t* sizeP) //---------------------------------------------------------------------------- { Storage(); m_is_data_written = false; if (*sizeP >= 7) { m_equipment_type = storageP.readChar(); m_equipment_id = storageP.readChar(); m_action = storageP.readChar(); m_object_type = storageP.readChar(); m_object_id = storageP.readChar(); this->writeChar(m_equipment_type); this->writeChar(m_equipment_id); this->writeChar(m_action); this->writeChar(m_object_type); this->writeChar(m_object_id); unsigned short size = storageP.readShort(); this->writeShort(size); *sizeP = *sizeP - 7; if (size > 0) { if (*sizeP >= size) { for (int i = 0; i < size ; i++) { this->writeChar(storageP.readChar()); } } else { throw command_deserialize_length_error(); } *sizeP = *sizeP - size; } m_is_data_written = true; } else { throw command_deserialize_length_error(); } }