[ndnSIM] Question for Pending Interest Table

Alex Afanasyev alexander.afanasyev at ucla.edu
Mon Apr 15 20:38:51 PDT 2013


I just tried this code with clang++ compiler and it didn't complain.

What you can do, is to write is slightly differently, as you may be facing some problems with operation priorities:

std::cout << ( 100 - pit->GetSize () ) << std::endl;

(the key point is to put parentheses around 100-pit->GetSize())

---
Alex

On Apr 15, 2013, at 8:30 PM, "Xee" <1839750381 at qq.com> wrote:

> 
> Hi Alex
> Thanks for your email, I am trying to use the funcation to process the output with numbers as:
> 
> std::cout << (100)-(pit->GetSize ());
> 
> I want to process the value of PIT size from function and calculate with numbers using arithmetical operations. But when I use this function I am receiving the following errors:
> 
> Waf: Entering directory `/home/xee/ndnSIM/ns-3/build'
> [1002/1994] cxx: src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc -> build/src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc.18.o
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc: In function ‘void PeriodicStatsPrinter(ns3::Ptr<ns3::Node>, ns3::Time)’:
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc:56:13: error: expected primary-expression before ‘<<’ token
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc:56:42: error: invalid operands of types ‘uint32_t {aka unsigned int}’ and ‘const char [2]’ to binary ‘operator<<’
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc:56:42: error: suggest parentheses around ‘-’ inside ‘<<’ [-Werror=parentheses]
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc:56:46: error: expected ‘)’ before ‘;’ token
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc: In function ‘int main(int, char**)’:
> ../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc:100:6: error: expected primary-expression before ‘<<’ token
> cc1plus: all warnings being treated as errors
> Waf: Leaving directory `/home/xee/ndnSIM/ns-3/build'
> Build failed
>  -> task in 'ndn-simple-with-pit-count-stats' failed (exit status 1): 
>     {task 158764620: cxx ndn-simple-with-pit-count-stats.cc -> ndn-simple-with-pit-count-stats.cc.18.o}
> ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-fno-strict-aliasing', '-fwrapv', '-fstack-protector', '-fno-strict-aliasing', '-Ibuild', '-I.', '-I.', '-I/home/xee/ndnSIM', '-I/usr/include', '-I/usr/include/python2.7', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DNDEBUG', '-D_FORTIFY_SOURCE=2', '../src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc', '-c', '-o', 'src/ndnSIM/examples/ndn-simple-with-pit-count-stats.cc.18.o']
> 
> 
> rgd
> -Xee
> 
> ------------------ Original ------------------
> From:  "Alex Afanasyev"<alexander.afanasyev at ucla.edu>;
> Date:  Apr 16, 2013
> To:  "Xee"<1839750381 at qq.com>;
> Cc:  "ndnsim"<ndnsim at lists.cs.ucla.edu>;
> Subject:  Re: [ndnSIM] Question for Pending Interest Table
> 
> Hi Xee,
> 
> What kind of error? pit->GetSize () returns just size_t value, which you should be able to use in any way.  Can post the actual error with a context (where are you calling from and how pit variable is defined).
> 
> ---
> Alex
> 
> On Apr 15, 2013, at 8:21 PM, "Xee" <1839750381 at qq.com> wrote:
> 
>> Hi Alex
>> 
>> I am trying to make some mathematical operations with pit->GetSize () function output, 
>> but it is giving me error. Is there any way to process the output of this function ?
>> 
>> ------------------ Original ------------------
>> From:  "Xee"<1839750381 at qq.com>;
>> Date:  Apr 16, 2013
>> To:  "Alex Afanasyev"<alexander.afanasyev at ucla.edu>;
>> Cc:  "ndnsim"<ndnsim at lists.cs.ucla.edu>;
>> Subject:  [ndnSIM] Question for Pending Interest Table
>> 
>> Hi Alex
>> 
>> Is is possible to set variable timeout for PIT entries during simulation ? 
>> 
>> rgd
>> -Xee
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130415/efa4ae56/attachment.html>


More information about the ndnSIM mailing list