/****************************************************************************
 *   This file is part of the aGrUM/pyAgrum library.                        *
 *                                                                          *
 *   Copyright (c) 2005-2025 by                                             *
 *       - Pierre-Henri WUILLEMIN(_at_LIP6)                                 *
 *       - Christophe GONZALES(_at_AMU)                                     *
 *                                                                          *
 *   The aGrUM/pyAgrum library is free software; you can redistribute it    *
 *   and/or modify it under the terms of either :                           *
 *                                                                          *
 *    - the GNU Lesser General Public License as published by               *
 *      the Free Software Foundation, either version 3 of the License,      *
 *      or (at your option) any later version,                              *
 *    - the MIT license (MIT),                                              *
 *    - or both in dual license, as here.                                   *
 *                                                                          *
 *   (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html)    *
 *                                                                          *
 *   This aGrUM/pyAgrum library is distributed in the hope that it will be  *
 *   useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,          *
 *   INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
 *   FOR A PARTICULAR PURPOSE  AND NONINFRINGEMENT. IN NO EVENT SHALL THE   *
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,        *
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR  *
 *   OTHER DEALINGS IN THE SOFTWARE.                                        *
 *                                                                          *
 *   See LICENCES for more details.                                         *
 *                                                                          *
 *   SPDX-FileCopyrightText: Copyright 2005-2025                            *
 *       - Pierre-Henri WUILLEMIN(_at_LIP6)                                 *
 *       - Christophe GONZALES(_at_AMU)                                     *
 *   SPDX-License-Identifier: LGPL-3.0-or-later OR MIT                      *
 *                                                                          *
 *   Contact  : info_at_agrum_dot_org                                       *
 *   homepage : http://agrum.gitlab.io                                      *
 *   gitlab   : https://gitlab.com/agrumery/agrum                           *
 *                                                                          *
 ****************************************************************************/


/*!
 * \page using_signals How to use signaler/listener in aGrUM ?
 *
 * aGrUM has its own implementation of signalers/listeners.
 *
 * Let's say that <tt>class A</tt> has a method <tt>f(int i,char ch)</tt> and would
 * like to give to everyone the right to know whenever <tt>f()</tt> is run.
 *
 * \code{.cpp}
#include <agrum/core/signal/signaler.h>

class A {
 public:
  gum::Signaler2<int,char> onF; // Note that onF is public and will send an int and a char then
'Signaler2' is used.

 void f(int i,char ch) {
    //do something
    GUM_EMIT2(onF,i,ch); // a signal (with 2 args i and ch) is emitted via the Signaler onF.
  }
};
 @ \endcode
 *
 * Note that for <tt>class A</tt>, adding signaler is very light : a new public
 * attribute and a GUM_EMITx when needed (where x is the number of args).
 *
 * Now, how to listen to such a signal ?
 *
 * \code{.cpp}
#include <agrum/core/signal/Listener.h>

class B : public gum::Listener {
 public:
  void whenF(const void *src,int i, char ch) { // note the void* src
    std::cout<<"object "<<src<<" run f on "<<i<<" and "<<ch<<std::endl;
  }
};
// we may have more than one listener
class C : public gum::Listener {
 public:
  void dummy(void *src,int i,char ch) {
    std::cout<<"dummy on "<<i<<" and "<<ch<<std::endl;
  }
};
 * \endcode
 *
 * Now we have to connect
 *
 * \code{.cpp}
int main(void) {
  A a;

  B b1;
  B b2;

  GUM_CONNECT( a,onF,b1,B::whenF );
  GUM_CONNECT( a,onF,b2,B::whenF );

  a.f(3,'a');
  // b1.whenF and b2.whenF has been executed.


  {
    C c;
    GUM_CONNECT( a,onF,c,C::dummy );
    a.f(4,'x');
    //c.dummy(), b1.whenF and b2.whenF has been executed.
  } // c is destroyed...

  a.f(5,'y');
  //b1.whenF and b2.whenF has been executed.
}
 * \endcode
*/
