#include "Rtpcommon.h" #include // for memset, strncpy RtpRecvClientInfo_t::RtpRecvClientInfo_t() { memset(clientIP, 0, 32); clientPort = 0; compareItemID = 0; compareItemRoadNum = 0; memset(sessionName, 0, 32); type = 0; // 默认类型为0 } RtpRecvClientInfo_t::RtpRecvClientInfo_t(const RtpRecvClientInfo_t& other) { *this = other; // 使用赋值运算符重载来复制数据 } RtpRecvClientInfo_t& RtpRecvClientInfo_t::operator=(const RtpRecvClientInfo_t& other) { if (this != &other) { strncpy(clientIP, other.clientIP, sizeof(clientIP) - 1); clientIP[sizeof(clientIP) - 1] = '\0'; clientPort = other.clientPort; compareItemID = other.compareItemID; compareItemRoadNum = other.compareItemRoadNum; strncpy(sessionName, other.sessionName, sizeof(sessionName) - 1); sessionName[sizeof(sessionName) - 1] = '\0'; type = other.type; } return *this; } RtpSendClientInfo_t::RtpSendClientInfo_t() { } RtpSendClientInfo_t::RtpSendClientInfo_t(const RtpSendClientInfo_t& other) { *this = other; } RtpSendClientInfo_t& RtpSendClientInfo_t::operator=(const RtpSendClientInfo_t& other) { if (this != &other) { localPort = other.localPort; clientIP = other.clientIP; clientPort = other.clientPort; compareItemID = other.compareItemID; compareItemRoadNum = other.compareItemRoadNum; // udpSocket = other.udpSocket; /* 不拷贝udp套接字 */ } return *this; }