PModulePackage.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // PModulePackage.cpp: implementation of the PModulePackage class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "PModulePackage.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- PModulePackage::PModulePackage()
- {
- this->Tag = PModulePackageTAG;
- this->module = 0;
- this->module_buffer = NULL;
- this->module_size = 0;
- }
- PModulePackage::~PModulePackage()
- {
- }
- bool PModulePackage::assembleData( int module , char * buffer , int size )
- {
- this->buffer.Resize( 4 * INT_SIZE + size );
- char * now = this->buffer.GetBuffer( );
- *( int * )now = this->buffer.GetSize( ); now += INT_SIZE;
- *( int * )now = this->Tag; now += INT_SIZE;
- *( int * )now = module; now += INT_SIZE;
- *( int * )now = size; now += INT_SIZE;
- if( size && buffer )
- memcpy( now , buffer , size );
- return true;
- }
- bool PModulePackage::parseData( CBuffer & buffer )
- {
- if( ! buffer.GetSize( ) ) return false;
- char * now = buffer.GetBuffer( ) + 2 * INT_SIZE;
- this->module = *( int * )now; now += INT_SIZE;
- this->module_size = *( int * )now; now += INT_SIZE;
- this->module_buffer = ! this->module_size ? NULL : now;
- return true;
- }