fw4spl
fwMetrics.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include <iostream>
8 
9 #include <fwCore/base.hpp>
10 
11 #include <fwData/registry/detail.hpp>
12 
13 #include <fwServices/macros.hpp>
14 #include <fwServices/registry/ServiceFactory.hpp>
15 
16 #include <fwGui/dialog/MessageDialog.hpp>
17 
18 #include "monitor/action/fwMetrics.hpp"
19 
20 namespace monitor
21 {
22 namespace action
23 {
24 
25 fwServicesRegisterMacro( ::fwGui::IActionSrv, ::monitor::action::fwMetrics, ::fwData::Object );
26 
27 //------------------------------------------------------------------------------
28 
29 fwMetrics::fwMetrics( ) noexcept
30 {
31 }
32 
33 //------------------------------------------------------------------------------
34 
36 {
37 }
38 
39 //------------------------------------------------------------------------------
40 
42 {
43  std::stringstream stream;
44 
45  stream << "Registered factory keys";
46  stream << std::endl;
47 
48  stream << "fwData: ";
49  stream << ::fwData::registry::get()->getFactoryKeys().size();
50  stream << std::endl;
51 
52  stream << "IService: ";
53  stream << ::fwServices::registry::ServiceFactory::getDefault()->getFactoryKeys().size();
54 
56  messageBox.setTitle("FactoryRegistry Information");
57  messageBox.setMessage( stream.str() );
58  messageBox.setIcon(::fwGui::dialog::IMessageDialog::INFO);
59  messageBox.addButton(::fwGui::dialog::IMessageDialog::OK);
60  messageBox.show();
61 }
62 
63 //------------------------------------------------------------------------------
64 
66 {
68 }
69 
70 //------------------------------------------------------------------------------
71 
73 {
75 }
76 
77 //------------------------------------------------------------------------------
78 
80 {
82 }
83 
84 //------------------------------------------------------------------------------
85 
86 
87 } // namespace action
88 } // namespace monitor
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Definition: IActionSrv.cpp:160
virtual FWGUI_API void setMessage(const std::string &msg) override
Set the message.
Defines the generic message box for IHM. Use the Delegate design pattern.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
Definition: IActionSrv.cpp:153
Defines the service interface managing the menu items.
Definition: IActionSrv.hpp:24
Implements an action for show metrics about f4s factories (number of data, message and service in fac...
Definition: fwMetrics.hpp:20
void stopping() override
Calls classic IAction methods to stop.
Definition: fwMetrics.cpp:79
virtual FWGUI_API void addButton(IMessageDialog::Buttons button) override
Add a button (OK, YES_NO, YES, NO, CANCEL)
virtual MONITOR_API ~fwMetrics() noexcept
Does nothing.
Definition: fwMetrics.cpp:35
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
FWGUI_API void initialize()
Initialize the action.
Definition: IActionSrv.cpp:69
Base class for each data object.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
void starting() override
Calls classic IAction methods to start.
Definition: fwMetrics.cpp:72
The namespace monitor contains tools for monitoring an application built with FW4SPL.
Definition: fwMetrics.hpp:14
static FWSERVICES_API ServiceFactory::sptr getDefault()
Return the unique Instance, create it if required at first access.
MONITOR_API fwMetrics() noexcept
Does nothing.
void configuring() override
Calls classic IAction methods to configure.
Definition: fwMetrics.cpp:65
void updating() override
Show metrics in a dialog message box.
Definition: fwMetrics.cpp:41
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.