1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #include "Rtpcommon.h"
- #include <cstring> // 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)
- {
- localIP = other.localIP;
- localPort = other.localPort;
- clientIP = other.clientIP;
- clientPort = other.clientPort;
- compareItemID = other.compareItemID;
- compareItemRoadNum = other.compareItemRoadNum;
- SoundCardNum = other.SoundCardNum;
- SoundCardRoadNum = other.SoundCardRoadNum;
- // udpSocket = other.udpSocket; /* 不拷贝udp套接字 */
- }
- return *this;
- }
|