23 #include "ns3/buildings-module.h"    24 #include "ns3/mobility-module.h"    25 #include "ns3/core-module.h"    26 #include "ns3/network-module.h"    35   std::ofstream outFile;
    36   outFile.open (filename.c_str (), std::ios_base::out | std::ios_base::trunc);
    37   if (!outFile.is_open ())
    46       Box box = (*it)->GetBoundaries ();
    47       outFile << 
"set object " << index
    48               << 
" rect from " << box.
xMin  << 
"," << box.
yMin    49               << 
" to "   << box.
xMax  << 
"," << box.
yMax    61 main (
int argc, 
char *argv[])
    65   cmd.Parse (argc, argv);
    68   double buildingSizeX = 100;       
    69   double buildingSizeY = 50; 
    70   double streetWidth = 25; 
    71   double buildingHeight = 10; 
    72   uint32_t numBuildingsX = 10;
    73   uint32_t numBuildingsY = 10;
    74   double maxAxisX = (buildingSizeX + streetWidth) * numBuildingsX;
    75   double maxAxisY = (buildingSizeY + streetWidth) * numBuildingsY;
    77   std::vector<Ptr<Building> > buildingVector;
    78   for (uint32_t buildingIdX = 0; buildingIdX < numBuildingsX; ++buildingIdX)
    80       for (uint32_t buildingIdY = 0; buildingIdY < numBuildingsY; ++buildingIdY)
    83           building = CreateObject<Building> ();
    86                                         buildingIdX * (buildingSizeX + streetWidth) + buildingSizeX,
    87                                         buildingIdY * (buildingSizeY + streetWidth),
    88                                         buildingIdY * (buildingSizeY + streetWidth) + buildingSizeY,
    89                                         0.0, buildingHeight));
    93           buildingVector.push_back (building);
   106   mobility.SetMobilityModel (
"ns3::RandomWalk2dOutdoorMobilityModel",
   108                                Rectangle (-streetWidth, maxAxisX, -streetWidth, maxAxisY)));
   113   xPos->SetAttribute (
"Max", 
DoubleValue (maxAxisX));
   119   mobility.SetPositionAllocator (position);
 Manage ASCII trace files for device models. 
Smart pointer class similar to boost::intrusive_ptr. 
void SetNRoomsY(uint16_t nroomy)
static void Run(void)
Run the simulation. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
static Iterator End(void)
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
double xMax
The x coordinate of the right bound of the box. 
static Iterator Begin(void)
double yMax
The y coordinate of the top bound of the box. 
  AttributeValue implementation for Rectangle. 
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component. 
void SetNFloors(uint16_t nfloors)
std::vector< Ptr< Building > >::const_iterator Iterator
double yMin
The y coordinate of the bottom bound of the box. 
Parse command-line arguments. 
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy(). 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
keep track of a set of node pointers. 
Hold objects of type Ptr<T>. 
Helper class used to assign positions and mobility models to nodes. 
static void Stop(void)
Tell the Simulator the calling event should be the last one executed. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
void SetNRoomsX(uint16_t nroomx)
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR. 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void PrintGnuplottableBuildingListToFile(std::string filename)
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
void SetBoundaries(Box box)
Set the boundaries of the building. 
double xMin
The x coordinate of the left bound of the box.