25 #include <ns3/building-position-allocator.h>
26 #include <ns3/mobility-building-info.h>
27 #include <ns3/constant-position-mobility-model.h>
28 #include <ns3/mobility-model.h>
29 #include <ns3/building.h>
30 #include <ns3/buildings-helper.h>
31 #include <ns3/mobility-helper.h>
32 #include <ns3/simulator.h>
42 Room (uint32_t xx, uint32_t yy, uint32_t zz);
59 || ( (a.
x == b.
x) && (a.
y < b.
y) )
60 || ( (a.
x == b.
x) && (a.
y == b.
y) && (a.
z < b.
z) ));
71 virtual void DoRun (
void);
77 :
TestCase (
"RandomRoom, 12 rooms, 24 nodes")
103 BuildingsHelper::Install (nodes);
105 BuildingsHelper::MakeMobilityModelConsistent ();
107 std::map<Room, uint32_t> roomCounter;
112 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
114 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
130 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
140 Simulator::Destroy ();
153 virtual void DoRun (
void);
185 BuildingsHelper::Install (nodes);
189 positionAlloc = CreateObject<SameRoomPositionAllocator> (
nodes);
192 BuildingsHelper::Install (copyNodes);
194 BuildingsHelper::MakeMobilityModelConsistent ();
196 std::map<Room, uint32_t> roomCounter;
201 NS_ASSERT_MSG (mm,
"no mobility model aggregated to this node");
203 NS_ASSERT_MSG (bmm,
"MobilityBuildingInfo has not been aggregated to this node mobility model");
210 for (std::map<Room, uint32_t>::iterator it = roomCounter.begin (); it != roomCounter.end (); ++it)
218 Simulator::Destroy ();
234 :
TestSuite (
"building-position-allocator", UNIT)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetNRoomsY(uint16_t nroomy)
RandomRoomPositionAllocatorTestCase()
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
virtual void DoRun(void)
Implementation to actually run this TestCase.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Vector GetPosition(void) const
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
uint8_t GetFloorNumber(void)
uint8_t GetRoomNumberX(void)
Keep track of the current position and velocity of an object.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
bool operator<(const Room &a, const Room &b)
void SetNFloors(uint16_t nfloors)
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
SameRoomPositionAllocatorTestCase()
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Helper class used to assign positions and mobility models to nodes.
mobility buildings information (to be used by mobility models)
BuildingPositionAllocatorTestSuite()
void SetNRoomsX(uint16_t nroomx)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
static BuildingPositionAllocatorTestSuite buildingsPositionAllocatorTestSuiteInstance
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Ptr< T > GetObject(void) const
Room(uint32_t xx, uint32_t yy, uint32_t zz)
void SetBoundaries(Box box)
Set the boundaries of the building.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint8_t GetRoomNumberY(void)