..  vim: filetype: rst
.. _dimbrowser:

==========================================================================
:mod:`dimbrowser` - Interface to DIM C++ class DimBrowser
==========================================================================

.. module:: dimbrowser

The :mod:`dimbrowser` module  is basically a wrapper for the DIM C++ class DimBrowser. It's very
close to the DIM C++ class DimBrowser so it should be straightforward to use for people
with previous experience in DimBrowser.

For further reference, please consult the `documentation for the DimBrowser class <http://dim.web.cern.ch/dim/cpp_doc/DimBrowser.html>`_.


Creating a DimBrowser object is very easy, import the dimbrowser module
and call the DimBrowser's constructor :

.. code-block:: python
  :linenos:

  from dimbrowser import DimBrowser

  dbr = DimBrowser()


Methods
=====================================

.. autoclass:: DimBrowser
  :members:


Examples
=====================================
Here a few examples of how to use the Python DimBrowser.

.. code-block:: python
  :linenos:

  from dimbrowser import DimBrowser
  import sys
  if __name__ == '__main__':
      dbr = DimBrowser()

      nbRes = dbr.getServices("example-command*")
      print("nbServices of example-command server = %s" % nbRes)
      for i in range(nbRes):
          print(dbr.getNextService().next())

      nbServers = dbr.getServers()
      print("NbServers = %s" % nbServers)
      for i in range(nbServers):
          print(dbr.getNextServer().next())

      nbServerServices = dbr.getServerServices("example-commands")
      print("NbServerServices of example-commands server %s" % nbServerServices)
      for i in range(nbServerServices-1):
          print(dbr.getNextServerService().next())

      nbClientsConnected = dbr.getServerClients("example-commands")
      print("nbClientsConnected to server-name = %s" % nbClientsConnected)
      for i in range(nbClientsConnected):
          print(dbr.getNextServerClient().next())
