mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 23:30:07 +00:00
[netdata] unify GetNext...() methods into a single template (#11812)
This change updates the `NetworkData` iteration methods to reduce redundant code and simplify their use. Previously, separate methods were defined to iterate over different types of network data entries (e.g., `GetNextOnMeshPrefix()`, `GetNextExternalRoute()`). This change unifies these into a single template method, `NetworkData::GetNext<EntryType>()`. A similar change is applied to unify the corresponding `Contains...()` methods into a single template.
This commit is contained in:
@@ -179,12 +179,12 @@ void TestNetworkDataIterator(void)
|
||||
|
||||
for (const auto &route : routes)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextExternalRoute(iter, rconfig));
|
||||
SuccessOrQuit(netData.GetNext(iter, rconfig));
|
||||
PrintExternalRouteConfig(rconfig);
|
||||
VerifyOrQuit(CompareExternalRouteConfig(rconfig, route));
|
||||
}
|
||||
|
||||
VerifyOrQuit(netData.GetNextExternalRoute(iter, rconfig) == kErrorNotFound);
|
||||
VerifyOrQuit(netData.GetNext(iter, rconfig) == kErrorNotFound);
|
||||
|
||||
netData.FindRlocs(kAnyBrOrServer, kAnyRole, rlocs);
|
||||
VerifyRlocsArray(rlocs, kRlocs);
|
||||
@@ -303,7 +303,7 @@ void TestNetworkDataIterator(void)
|
||||
|
||||
for (const auto &route : routes)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextExternalRoute(iter, rconfig));
|
||||
SuccessOrQuit(netData.GetNext(iter, rconfig));
|
||||
PrintExternalRouteConfig(rconfig);
|
||||
VerifyOrQuit(CompareExternalRouteConfig(rconfig, route));
|
||||
}
|
||||
@@ -471,7 +471,7 @@ void TestNetworkDataIterator(void)
|
||||
|
||||
for (const auto &route : routes)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextExternalRoute(iter, rconfig));
|
||||
SuccessOrQuit(netData.GetNext(iter, rconfig));
|
||||
PrintExternalRouteConfig(rconfig);
|
||||
VerifyOrQuit(CompareExternalRouteConfig(rconfig, route));
|
||||
}
|
||||
@@ -480,7 +480,7 @@ void TestNetworkDataIterator(void)
|
||||
|
||||
for (const auto &prefix : prefixes)
|
||||
{
|
||||
SuccessOrQuit(netData.GetNextOnMeshPrefix(iter, pconfig));
|
||||
SuccessOrQuit(netData.GetNext(iter, pconfig));
|
||||
PrintOnMeshPrefixConfig(pconfig);
|
||||
VerifyOrQuit(CompareOnMeshPrefixConfig(pconfig, prefix));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user