|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
c++ code
Dear All, I know java but I am a newbie in c++ and I am trying to learn ns3 . could anybody tell me what is going on in this two code snippets? ( these are talking from Chap 7 , ns3 tutorial) Code:
class MyObject : public Object { public: static TypeId GetTypeId (void) { static TypeId tid = TypeId ("MyObject") .SetParent (Object::GetTypeId ()) .AddConstructor<MyObject> () .AddTraceSource ("MyInteger", "An integer value to trace.", MakeTraceSourceAccessor (&MyObject::m_myInt)) ; return tid; } MyObject () {} TracedValue<int32_t> m_myInt; };Code:
int main (int argc, char *argv[]) { Ptr<MyObject> myObject = CreateObject<MyObject> (); myObject->TraceConnectWithoutContext ("MyInteger", MakeCallback(&IntTrace)); myObject->m_myInt = 1234; }your help is HIGHLY appreciated ---------- Post updated at 11:37 PM ---------- Previous update was at 11:32 PM ---------- I will post the code snippets again here . class MyObject : public Object { public: static TypeId GetTypeId (void) { static TypeId tid = TypeId ("MyObject") .SetParent (Object::GetTypeId ()) .AddConstructor<MyObject> () .AddTraceSource ("MyInteger", "An integer value to trace.", MakeTraceSourceAccessor (&MyObject::m_myInt)) ; return tid; } MyObject () {} TracedValue<int32_t> m_myInt; }; void IntTrace (int32_t oldValue, int32_t newValue) { std::cout << "Traced " << oldValue << " to " << newValue << std::endl; } |
| Sponsored Links | ||
|
|
![]() |
| Tags |
| c++, c++ in unix, programmers, programming |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Block of code replacement in Java source code through Unix script | hareeshram | Shell Programming and Scripting | 2 | 01-30-2012 10:54 AM |
| If ‘922’ Code does not exist on ‘03’ Record, ‘901’ Code will be there instead, move ‘03’ R | sgoud | UNIX for Dummies Questions & Answers | 1 | 06-28-2011 01:55 PM |
| how i prepare a c++ code(c code) for implementing my own protocol format | amitpansuria | Programming | 1 | 09-06-2007 11:09 PM |
|
|