[Doxygen] Various in src/core
This commit is contained in:
@@ -21,17 +21,39 @@
|
||||
#include "ns3/assert.h"
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup callback
|
||||
* Example program illustrating use of callback functions and methods.
|
||||
*
|
||||
* See \ref callback
|
||||
*/
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
static double
|
||||
/**
|
||||
* Example Callback function.
|
||||
*
|
||||
* \param [in] a The first argument.
|
||||
* \param [in] b The second argument.
|
||||
* \returns The first argument.
|
||||
*/
|
||||
static double
|
||||
CbOne (double a, double b)
|
||||
{
|
||||
std::cout << "invoke cbOne a=" << a << ", b=" << b << std::endl;
|
||||
return a;
|
||||
}
|
||||
|
||||
/** Example Callback class. */
|
||||
class MyCb {
|
||||
public:
|
||||
/**
|
||||
* Example Callback class method.
|
||||
*
|
||||
* \param [in] a The argument.
|
||||
* \returns -5
|
||||
*/
|
||||
int CbTwo (double a) {
|
||||
std::cout << "invoke cbTwo a=" << a << std::endl;
|
||||
return -5;
|
||||
|
||||
@@ -29,12 +29,23 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup scheduler
|
||||
* An example of scheduling events in a background thread.
|
||||
*
|
||||
* See \ref ns3::SystemThread,
|
||||
* \ref ns3::SimulatorImpl::ScheduleWithContext
|
||||
*/
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("TestSync");
|
||||
|
||||
/** Check that the event functions run in the intended order. */
|
||||
bool gFirstRun = false;
|
||||
|
||||
/** An event method called many times from the background thread. */
|
||||
void
|
||||
inserted_function (void)
|
||||
{
|
||||
@@ -43,6 +54,7 @@ inserted_function (void)
|
||||
Simulator::Now ().GetSeconds () << " s");
|
||||
}
|
||||
|
||||
/** An event method called many times from the main thread. */
|
||||
void
|
||||
background_function (void)
|
||||
{
|
||||
@@ -51,6 +63,7 @@ background_function (void)
|
||||
Simulator::Now ().GetSeconds () << " s");
|
||||
}
|
||||
|
||||
/** An event method called once from the main thread. */
|
||||
void
|
||||
first_function (void)
|
||||
{
|
||||
@@ -59,10 +72,13 @@ first_function (void)
|
||||
gFirstRun = true;
|
||||
}
|
||||
|
||||
/** Example class with a method for the background task. */
|
||||
class FakeNetDevice
|
||||
{
|
||||
public:
|
||||
/** Constructor. */
|
||||
FakeNetDevice ();
|
||||
/** The thread entry point. */
|
||||
void Doit3 (void);
|
||||
};
|
||||
|
||||
@@ -86,7 +102,15 @@ FakeNetDevice::Doit3 (void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Example use of ns3::SystemThread.
|
||||
*
|
||||
* This example is a complete simulation.
|
||||
* It schedules \c first_function and many executions of \c background_function
|
||||
* to execute in the main (foreground) thread. It also launches a background
|
||||
* thread with an instance of FakeNetDevice, which schedules many instances of
|
||||
* \c inserted_function.
|
||||
*/
|
||||
void
|
||||
test (void)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \ingroup simulator
|
||||
* Example program demonstrating use of various Schedule functions.
|
||||
*/
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
class MyModel
|
||||
|
||||
Reference in New Issue
Block a user