Changeset 913 in Sophya for trunk/SophyaLib/SysTools


Ignore:
Timestamp:
Apr 13, 2000, 5:58:41 PM (25 years ago)
Author:
ansari
Message:

Documentation + Modifs mineures (namespace, etc..) - Reza 13/4/2000

Location:
trunk/SophyaLib/SysTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SysTools/ctimer.cc

    r895 r913  
    11//
    2 // $Id: ctimer.cc,v 1.3 2000-04-12 17:49:40 ansari Exp $
     2// $Id: ctimer.cc,v 1.4 2000-04-13 15:58:37 ansari Exp $
    33//
    44
     
    3939/*!
    4040  \class SOPHYA::Timer
     41  \ingroup SysTools
    4142  This class implements a simple chronometer which can be used for
    4243  measuring the CPU and elapsed time in functions. The constructor
  • trunk/SophyaLib/SysTools/pdlmgr.cc

    r895 r913  
    1 // This may look like C code, but it is really -*- C++ -*-
    21// Gestionnaire de lien dynamique   -   R. Ansari 12/98
    32// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
    43
     4#include "pdlmgr.h"
    55#include <stdio.h>
    66#include <stdlib.h>
     
    88#include <iostream.h>
    99
    10 #include "pdlmgr.h"
    1110
    1211// Extension de noms de fichiers Shared libs
     
    2019/*!
    2120  \class SOPHYA::PDynLinkMgr
     21  \ingroup SysTools
    2222  This classes handles the run-time operations related to using shared
    2323  libraries. The present version has been adapted for different Unix
    2424  flavours (Linux, Compaq/Digital Unix, SGI IRIX, IBM AIX, Sun Solaris).
     25  The example here the linking of shared library named "mylib.so"
     26  containing a function \c double \c myfunction(double x).
     27  \code
     28  #include "pdlmgr.h"
     29  typedef double (* AFunctionOfX) (double x);
     30  {
     31  // ...
     32  string soname = "mylib.so";
     33  string funcname = "myfunction";
     34  PDynLinkMgr dyl(son);
     35  AFunctionOfX f = (AFunctionOfX)dyl.GetFunction(funcname);
     36  double x = 3.1425;
     37  if (f != NULL)
     38    cout << " X= " << x << " myfunction(x)=" << f(x) << endl;
     39  // ...
     40  }
     41  \endcode
    2542*/
    2643
  • trunk/SophyaLib/SysTools/periodic.cc

    r241 r913  
    99
    1010#include "periodic.h"
     11/*!
     12  \class SOPHYA::Periodic
     13  \ingroup SysTools
     14  This class provide the service of calling a given function at
     15  regular intervals. It can also be subclassed with the method
     16  \b DoPeriodic redefined to perform a periodic action.
     17*/
    1118
    1219/* --Methode-- */
     20/*! Constructor with the definition of the interval (in seconds)
     21  and an optional user action */
    1322Periodic::Periodic(int dt, UsPeriodicAction act, void * usp)
    1423{
     
    2938
    3039/* --Methode-- */
     40/*! Sets the user action function and its data \c usp */
    3141void Periodic::SetAction(UsPeriodicAction act, void * usp)
    3242{
     
    3646
    3747/* --Methode-- */
     48/*! Changes the interval \c dt specified in seconds */
    3849void Periodic::SetInterval(int dt)
    3950{
     
    4455
    4556/* --Methode-- */
     57/*! Changes the interval \c dtms specified in milli-seconds */
    4658void Periodic::SetIntervalms(int dtms)
    4759{
     
    5365
    5466/* --Methode-- */
     67/*! Activate the object */
    5568void Periodic::Start(int dt)
    5669{
     
    6982
    7083/* --Methode-- */
     84/*! Deactivate the object */
    7185void Periodic::Stop()
    7286{
     
    86100
    87101/* --Methode-- */
     102/*! This method should be redefined for sub-classes of Periodic
     103  The default implementation calls the user action function */
    88104void Periodic::DoPeriodic()
    89105{
  • trunk/SophyaLib/SysTools/psighand.cc

    r706 r913  
    99static bool sigprstate[6] = {false, false, false, false, false, false};
    1010
    11 void PeidaProcessSignal(int s);
     11void SophyaProcessSignal(int s);
    1212
    1313/* Nouvelle-Fonction */
    14 void PeidaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2)
     14/*!\ingroup  SysTools
     15   Configures signal handling. When the flag is true, an exception
     16   \b CaughtSignalExc is thrown with the excpetion id set to the
     17   signal id. With the flag is false, the default signal handling
     18   is restored.
     19   \param cfpe : Floating point exception \c SIGFPE
     20   \param csegv : Segmentation fault \c SIGSEGV
     21   \param cint : Interrupt signal \c SIGINT
     22   \param cquit : Quit signal \c SIGINT
     23   \param cusr1 : User signal 1 \c SIGUSR1
     24   \param cusr2 : User signal 1 \c SIGUSR2
     25*/
     26void SOPHYA::SophyaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2)
    1527{
    1628  struct sigaction ae, ad;
    1729
    18   ae.sa_handler = PeidaProcessSignal;
     30  ae.sa_handler = SophyaProcessSignal;
    1931  ad.sa_handler = SIG_DFL;
    2032  memset( &(ae.sa_mask), 0, sizeof(sigset_t) );
     
    3143    if (cfpe)   {
    3244      sigaction(SIGFPE, &ae, NULL);
    33       puts("PeidaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ...");
     45      puts("SophyaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ...");
    3446      }
    3547    else  {
    3648      sigaction(SIGFPE, &ad, NULL);
    37       puts("PeidaConfigureSignalhandling(): Back to default SIGFPE handling ...");
     49      puts("SophyaConfigureSignalhandling(): Back to default SIGFPE handling ...");
    3850      }
    3951    sigprstate[0] = cfpe;
     
    4355    if (csegv)   {
    4456      sigaction(SIGSEGV, &ae, NULL);
    45       puts("PeidaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ...");
     57      puts("SophyaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ...");
    4658      }
    4759    else  {
    4860      sigaction(SIGSEGV, &ad, NULL);
    49       puts("PeidaConfigureSignalhandling(): Back to default SIGSEGV handling ...");
     61      puts("SophyaConfigureSignalhandling(): Back to default SIGSEGV handling ...");
    5062      }
    5163    sigprstate[1] = csegv;
     
    5668    if (cint)   {
    5769      sigaction(SIGINT, &ae, NULL);
    58       puts("PeidaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ...");
     70      puts("SophyaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ...");
    5971      }
    6072    else  {
    6173      sigaction(SIGINT, &ad, NULL);
    62       puts("PeidaConfigureSignalhandling(): Back to default SIGINT handling ...");
     74      puts("SophyaConfigureSignalhandling(): Back to default SIGINT handling ...");
    6375      }
    6476    sigprstate[2] = cint;
     
    6981    if (cquit)   {
    7082      sigaction(SIGQUIT, &ae, NULL);
    71       puts("PeidaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ...");
     83      puts("SophyaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ...");
    7284      }
    7385    else  {
    7486      sigaction(SIGQUIT, &ad, NULL);
    75       puts("PeidaConfigureSignalhandling(): Back to default SIGQUIT handling ...");
     87      puts("SophyaConfigureSignalhandling(): Back to default SIGQUIT handling ...");
    7688      }
    7789    sigprstate[3] = cquit;
     
    8294    if (cusr1)   {
    8395      sigaction(SIGUSR1, &ae, NULL);
    84       puts("PeidaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ...");
     96      puts("SophyaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ...");
    8597      }
    8698    else  {
    8799      sigaction(SIGUSR1, &ad, NULL);
    88       puts("PeidaConfigureSignalhandling(): Back to default SIGUSR1 handling ...");
     100      puts("SophyaConfigureSignalhandling(): Back to default SIGUSR1 handling ...");
    89101      }
    90102    sigprstate[4] = cusr1;
     
    94106    if (cusr2)   {
    95107      sigaction(SIGUSR2, &ae, NULL);
    96       puts("PeidaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ...");
     108      puts("SophyaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ...");
    97109      }
    98110    else  {
    99111      sigaction(SIGUSR2, &ad, NULL);
    100       puts("PeidaConfigureSignalhandling(): Back to default SIGUSR2 handling ...");
     112      puts("SophyaConfigureSignalhandling(): Back to default SIGUSR2 handling ...");
    101113      }
    102114    sigprstate[5] = cusr2;
     
    104116}
    105117/* Nouvelle-Fonction */
    106 void PeidaProcessSignal(int s)
     118void SophyaProcessSignal(int s)
    107119{
    108120string msg;
     
    110122  {
    111123  case SIGFPE :
    112     puts("PeidaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###");
     124    puts("SophyaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###");
    113125    msg = "Caught SIGFPE";
    114126    throw ( CaughtSignalExc(msg, s) );
    115127  case SIGSEGV :
    116     puts("PeidaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###");
     128    puts("SophyaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###");
    117129    msg = "Caught SIGSEGV";
    118130    throw ( CaughtSignalExc(msg, s) );
    119131  case SIGINT :
    120     puts("PeidaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###");
     132    puts("SophyaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###");
    121133    msg = "Caught SIGINT";
    122134    throw ( CaughtSignalExc(msg, s) );
    123135  case SIGQUIT :
    124     puts("PeidaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###");
     136    puts("SophyaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###");
    125137    msg = "Caught SIGQUIT";
    126138    throw ( CaughtSignalExc(msg, s) );
    127139  case SIGUSR1 :
    128     puts("PeidaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###");
     140    puts("SophyaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###");
    129141    msg = "Caught SIGUSR1";
    130142    throw ( CaughtSignalExc(msg, s) );
    131143  case SIGUSR2 :
    132     puts("PeidaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###");
     144    puts("SophyaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###");
    133145    msg = "Caught SIGUSR2";
    134146    throw ( CaughtSignalExc(msg, s) );
    135147  default :
    136     printf("PeidaProcessSignal: ###Signal %d catched, throw  inconsistentErr ### \n", s);
     148    printf("SophyaProcessSignal: ###Signal %d catched, throw  inconsistentErr ### \n", s);
    137149    msg = "Caught SIG???";
    138150    throw ( CaughtSignalExc(msg, s) );
  • trunk/SophyaLib/SysTools/psighand.h

    r480 r913  
    22//  Pour la gestion des signaux a travers des exceptions
    33
    4 #ifndef PSIGHANDLE_SEEN
    5 #define PSIGHANDLE_SEEN
     4#ifndef SOPHYASIGHANDLE_SEEN
     5#define SOPHYASIGHANDLE_SEEN
    66
    77#include "machdefs.h"
    8 void PeidaConfigureSignalhandling(bool cfpe=false, bool csegv=false,
    9                                   bool cint=false, bool cquit=false,
    10                                   bool cusr1=false, bool cusr2=false);
     8
     9namespace SOPHYA {
     10void SophyaConfigureSignalhandling(bool cfpe=false, bool csegv=false,
     11                                   bool cint=false, bool cquit=false,
     12                                   bool cusr1=false, bool cusr2=false);
     13} // namespace SOPHYA
     14
    1115#endif
Note: See TracChangeset for help on using the changeset viewer.