[英]c++: error: cannot convert ‘ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >’ to ‘uint32_t {aka unsigned int}
I am trying to cast TracedValue<uint32_t> m_bytesInFlight
to uint32_t but I get the following error 我正在尝试将
TracedValue<uint32_t> m_bytesInFlight
为uint32_t,但出现以下错误
error: cannot convert ‘ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >’ to ‘uint32_t {aka unsigned int}
Function prototype and variable declarations are 函数原型和变量声明是
uint32_t UnAckDCount (void) const;
TracedValue<uint32_t> m_bytesInFlight {0}; //!< Bytes in flight
Here i am calling the function 在这里我正在调用函数
uint32_t
TcpSocketBase::UnAckDCount () const
{
return m_tcb->m_highTxMark - (uint32_t) m_tcb->m_bytesInFlight;
}
Please suggest some method so that I can execute the return statement to get the result. 请提出一些方法,以便我可以执行return语句以获取结果。 Thanks in advance
提前致谢
Changing m_tcb->m_highTxMark
to m_tcb->m_highTxMark.Get().GetValue()
should work. 将
m_tcb->m_highTxMark
更改为m_tcb->m_highTxMark.Get().GetValue()
应该可以。
Seeing the compiler error, it's easy to figure out that variable m_highTxMark
is of type ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >
. 看到编译器错误,很容易发现变量
m_highTxMark
的类型为ns3::TracedValue<ns3::SequenceNumber<unsigned int, int> >
。 I checked the documentation of ns3::TracedValue
and ns3::SequenceNumber
, they both have getter functions Get() and GetValue() respectively. 我检查了
ns3::TracedValue
和ns3::SequenceNumber
的文档,它们都分别具有getter函数Get()和GetValue()。
See: 看到:
https://www.nsnam.org/doxygen/classns3_1_1_traced_value.html https://www.nsnam.org/doxygen/classns3_1_1_sequence_number.html https://www.nsnam.org/doxygen/classns3_1_1_traced_value.html https://www.nsnam.org/doxygen/classns3_1_1_sequence_number.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.