core,internet: Add missing GetTypeId() in Object-derived classes

This commit is contained in:
Stefano Avallone
2025-08-21 17:50:49 +02:00
committed by Tom Henderson
parent 711a55857f
commit 736aeddc7f
4 changed files with 48 additions and 0 deletions

View File

@@ -26,6 +26,12 @@ using namespace ns3;
class PtrExample : public Object
{
public:
/**
* @brief Get the type ID.
* @return the object TypeId
*/
static TypeId GetTypeId();
/** Constructor. */
PtrExample();
/** Destructor. */
@@ -34,6 +40,16 @@ class PtrExample : public Object
void Method();
};
NS_OBJECT_ENSURE_REGISTERED(PtrExample);
TypeId
PtrExample::GetTypeId()
{
static TypeId tid =
TypeId("ns3::PtrExample").SetParent<Object>().SetGroupName("Core").HideFromDocumentation();
return tid;
}
PtrExample::PtrExample()
{
std::cout << "PtrExample constructor" << std::endl;

View File

@@ -18,8 +18,18 @@ namespace ns3
NS_LOG_COMPONENT_DEFINE("Ipv6AutoconfiguredPrefix");
NS_OBJECT_ENSURE_REGISTERED(Ipv6AutoconfiguredPrefix);
uint32_t Ipv6AutoconfiguredPrefix::m_prefixId = 0;
TypeId
Ipv6AutoconfiguredPrefix::GetTypeId()
{
static TypeId tid =
TypeId("ns3::Ipv6AutoconfiguredPrefix").SetParent<Object>().SetGroupName("Internet");
return tid;
}
Ipv6AutoconfiguredPrefix::Ipv6AutoconfiguredPrefix(Ptr<Node> node,
uint32_t interface,
Ipv6Address prefix,

View File

@@ -29,6 +29,12 @@ class Node;
class Ipv6AutoconfiguredPrefix : public Object
{
public:
/**
* @brief Get the type ID.
* @return the object TypeId
*/
static TypeId GetTypeId();
/**
* @brief Constructor.
* @param node node

View File

@@ -53,6 +53,16 @@ using namespace ns3;
class TracedCallbackTypedefTestCase : public TestCase
{
public:
/// @return the TypeId for the callback checkers
static TypeId GetCheckerTypeId()
{
static TypeId tid = TypeId("ns3::TracedCallbackTypedefTestCaseChecker")
.SetParent<Object>()
.SetGroupName("Test")
.HideFromDocumentation();
return tid;
}
TracedCallbackTypedefTestCase();
~TracedCallbackTypedefTestCase() override
@@ -268,6 +278,12 @@ class TracedCallbackTypedefTestCase::Checker : public Object
TracedCallback<Ts...> m_cb;
public:
/// @return the TypeId for this checker
static TypeId GetTypeId()
{
return TracedCallbackTypedefTestCase::GetCheckerTypeId();
}
Checker()
{
}