diff --git a/src/node/random-position.h b/src/node/random-position.h index 98a771c44..ee97a2286 100644 --- a/src/node/random-position.h +++ b/src/node/random-position.h @@ -9,20 +9,42 @@ namespace ns3 { class RandomVariable; +/** + * \brief choose a position at random. + * + * This is a pure abstract base class. + */ class RandomPosition : public Object { public: static const InterfaceId iid; RandomPosition (); virtual ~RandomPosition (); + /** + * \returns the next randomly-choosen position. + */ virtual Position Get (void) const = 0; }; +/** + * \brief allocate random positions within a rectangle + * according to a pair of random variables. + */ class RandomRectanglePosition : public RandomPosition { public: static const ClassId cid; + /** + * Create a random position model based on the + * Bind default values. + */ RandomRectanglePosition (); + /** + * \param x the random variable which is used to choose + * the x coordinates. + * \param y the random variable which is used to choose + * the y coordinates. + */ RandomRectanglePosition (const RandomVariable &x, const RandomVariable &y); virtual ~RandomRectanglePosition (); @@ -32,11 +54,31 @@ private: RandomVariable *m_y; }; +/** + * \brief allocate random positions within a disc + * according to a pair of random variables. + */ class RandomDiscPosition : public RandomPosition { public: static const ClassId cid; + /** + * Create a random position model based on the + * Bind default values. + */ RandomDiscPosition (); + /** + * \param theta the random variable used to pick + * the angle of the random position in polar + * coordinates. + * \param rho the random variable used to pick the + * radius of the random position in polar + * coordinates. + * \param x the x coordinate of the center of the + * polar coodinate system. + * \param y the y coordinate of the center of the + * polar coodinate system. + */ RandomDiscPosition (const RandomVariable &theta, const RandomVariable &rho, double x, double y); diff --git a/src/node/random-topology.h b/src/node/random-topology.h index f3c63b853..e3dbef0be 100644 --- a/src/node/random-topology.h +++ b/src/node/random-topology.h @@ -29,20 +29,63 @@ namespace ns3 { class RandomPosition; +/** + * \brief layout objects randomly in 3d space. + * + * This assigns an initial position to each object + * according to its position model and assigns + * an instance of a mobility model to each object + * according to its mobility model class id. + */ class RandomTopology { public: + /** + * Create a default random topology based + * on Bind configuration. + */ RandomTopology (); + /** + * \param positionModel model to set the initial position + * of each object. + * \param type of mobility model to attach to each object. + * + * Create a random topology based on the + * specified position and mobility models. + */ RandomTopology (Ptr positionModel, ClassId mobilityModel); ~RandomTopology (); + /** + * \param classId the type of mobility model attached to each + * input object if it does not have one already. + */ void SetMobilityModel (ClassId classId); + /** + * \param positionModel the position model used to initialize + * the position of each object. + */ void SetPositionModel (Ptr positionModel); + /** + * \param object the object to layout + * + * Assign an initial position and a mobility model + * to the object. + */ void LayoutOne (Ptr object); + /** + * \param begin iterator which identifies the first + * object to configure. + * \param end iterator which identifies the last + * object to configure. + * + * Assign an initial position and a mobility model + * to the objects. + */ template void Layout (const T &begin, const T &end); private: