xref: /openbmc/phosphor-objmgr/src/test/util/debug_output.hpp (revision 1f62380a2e85caf3118568c4fb0bdea32d7e2ba1)
17264d90dSAndrew Geissler #include "src/associations.hpp"
27264d90dSAndrew Geissler 
37264d90dSAndrew Geissler #include <iostream>
47264d90dSAndrew Geissler 
57264d90dSAndrew Geissler // Some debug functions for dumping out the main data structures in objmgr
67264d90dSAndrew Geissler 
dumpAssociationOwnersType(AssociationOwnersType & assocOwners)7a098a37aSBrad Bishop void dumpAssociationOwnersType(AssociationOwnersType& assocOwners)
87264d90dSAndrew Geissler {
97264d90dSAndrew Geissler     using namespace std;
107264d90dSAndrew Geissler     cout << "##### AssociationOwnersType #####" << endl;
11*1f62380aSBrad Bishop     for (const auto& i : assocOwners)
127264d90dSAndrew Geissler     {
137264d90dSAndrew Geissler         cout << "------------------------------------" << endl;
147264d90dSAndrew Geissler         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
157264d90dSAndrew Geissler 
16*1f62380aSBrad Bishop         for (const auto& j : i.second)
177264d90dSAndrew Geissler         {
187264d90dSAndrew Geissler             cout << setw(16) << left << "DBUS SERVICE:" << j.first << endl;
197264d90dSAndrew Geissler 
20*1f62380aSBrad Bishop             for (const auto& k : j.second)
217264d90dSAndrew Geissler             {
227264d90dSAndrew Geissler                 cout << setw(17) << left << "ASSOC PATH:" << k.first << endl;
237264d90dSAndrew Geissler 
24*1f62380aSBrad Bishop                 for (const auto& l : k.second)
257264d90dSAndrew Geissler                 {
267264d90dSAndrew Geissler                     cout << setw(18) << left << "ENDPOINT:" << l << endl;
277264d90dSAndrew Geissler                 }
287264d90dSAndrew Geissler             }
297264d90dSAndrew Geissler         }
307264d90dSAndrew Geissler         cout << "------------------------------------" << endl;
317264d90dSAndrew Geissler     }
327264d90dSAndrew Geissler }
337264d90dSAndrew Geissler 
dumpAssociationInterfaces(AssociationInterfaces & assocInterfaces)34a098a37aSBrad Bishop void dumpAssociationInterfaces(AssociationInterfaces& assocInterfaces)
357264d90dSAndrew Geissler {
367264d90dSAndrew Geissler     using namespace std;
377264d90dSAndrew Geissler     cout << "##### AssociationInterfaces #####" << endl;
387264d90dSAndrew Geissler     for (auto i : assocInterfaces)
397264d90dSAndrew Geissler     {
407264d90dSAndrew Geissler         cout << "------------------------------------" << endl;
417264d90dSAndrew Geissler         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
427264d90dSAndrew Geissler         auto intfEndpoints = std::get<endpointsPos>(i.second);
437264d90dSAndrew Geissler 
44*1f62380aSBrad Bishop         for (const auto& k : intfEndpoints)
457264d90dSAndrew Geissler         {
467264d90dSAndrew Geissler             cout << setw(16) << left << "ENDPOINTS:" << k << endl;
477264d90dSAndrew Geissler         }
487264d90dSAndrew Geissler         cout << "------------------------------------" << endl;
497264d90dSAndrew Geissler     }
507264d90dSAndrew Geissler }
517264d90dSAndrew Geissler 
dumpInterfaceMapType(InterfaceMapType & intfMap)52a098a37aSBrad Bishop void dumpInterfaceMapType(InterfaceMapType& intfMap)
537264d90dSAndrew Geissler {
547264d90dSAndrew Geissler     using namespace std;
55a098a37aSBrad Bishop     cout << "##### interfaceMapType #####" << endl;
56*1f62380aSBrad Bishop     for (const auto& i : intfMap)
577264d90dSAndrew Geissler     {
587264d90dSAndrew Geissler         cout << "------------------------------------" << endl;
597264d90dSAndrew Geissler         cout << setw(15) << left << "OBJ PATH:" << i.first << endl;
607264d90dSAndrew Geissler 
61*1f62380aSBrad Bishop         for (const auto& j : i.second)
627264d90dSAndrew Geissler         {
637264d90dSAndrew Geissler             cout << setw(16) << left << "DBUS SERVICE:" << j.first << endl;
647264d90dSAndrew Geissler 
65*1f62380aSBrad Bishop             for (const auto& k : j.second)
667264d90dSAndrew Geissler             {
677264d90dSAndrew Geissler                 cout << setw(18) << left << "INTERFACE:" << k << endl;
687264d90dSAndrew Geissler             }
697264d90dSAndrew Geissler         }
707264d90dSAndrew Geissler     }
717264d90dSAndrew Geissler     cout << "------------------------------------" << endl;
727264d90dSAndrew Geissler }
73