23 #include "object-factory.h"
25 #include "singleton.h"
26 #include "attribute.h"
44 NS_OBJECT_ENSURE_REGISTERED (Object);
46 Object::AggregateIterator::AggregateIterator ()
57 return m_current < m_object->m_aggregates->n;
83 Object::GetTypeId (
void)
93 :
m_tid (Object::GetTypeId ()),
96 m_aggregates ((struct Aggregates *) std::malloc (sizeof (struct Aggregates))),
108 for (uint32_t i = 0; i < n; i++)
130 m_initialized (false),
145 Object::DoGetObject (
TypeId tid)
const
151 TypeId objectTid = Object::GetTypeId ();
152 for (uint32_t i = 0; i < n; i++)
156 while (cur != tid && cur != objectTid)
173 return const_cast<Object *
> (current);
192 for (uint32_t i = 0; i < n; i++)
217 for (uint32_t i = 0; i < n; i++)
229 Object::UpdateSortedArray (
struct Aggregates *aggregates, uint32_t j)
const
233 aggregates->buffer[j]->m_getObjectCount > aggregates->buffer[j-1]->m_getObjectCount)
235 Object *tmp = aggregates->buffer[j-1];
236 aggregates->buffer[j-1] = aggregates->buffer[j];
237 aggregates->buffer[j] = tmp;
253 "Multiple aggregation of objects of type " <<
257 Object *other = PeekPointer (o);
262 aggregates->n = total;
265 std::memcpy (&aggregates->buffer[0],
282 uint32_t n = aggregates->n;
283 for (uint32_t i = 0; i < n; i++)
285 Object *current = aggregates->buffer[i];
294 for (uint32_t i = 0; i < a->n; i++)
296 Object *current = a->buffer[i];
299 for (uint32_t i = 0; i < b->n; i++)
301 Object *current = b->buffer[i];
349 Object::Check (
void)
const
363 Object::CheckLoose (
void)
const
366 uint32_t refcount = 0;
368 for (uint32_t i = 0; i < n; i++)
373 return (refcount > 0);
394 for (uint32_t i = 0; i < n; i++)
405 for (uint32_t i = 0; i < n; i++)
411 Object *current = aggregates->buffer[0];
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
virtual TypeId GetInstanceTypeId(void) const
uint32_t m_getObjectCount
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
TypeId GetParent(void) const
struct Aggregates * m_aggregates
virtual void DoDispose(void)
implement the ns-3 type and attribute system
#define NS_FATAL_ERROR(msg)
fatal error handling
uint32_t GetReferenceCount(void) const
Ptr< const Object > Next(void)
void SetTypeId(TypeId tid)
void AggregateObject(Ptr< Object > other)
virtual void NotifyNewAggregate(void)
void ConstructSelf(const AttributeConstructionList &attributes)
std::string GetName(void) const
AggregateIterator GetAggregateIterator(void) const
void Construct(const AttributeConstructionList &attributes)
a base class which provides memory management and object aggregation
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Iterate over the objects aggregated to an ns3::Object.
virtual void DoInitialize(void)