Changeset 913 in Sophya
- Timestamp:
- Apr 13, 2000, 5:58:41 PM (25 years ago)
- Location:
- trunk/SophyaLib
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/dvlist.cc
r895 r913 43 43 44 44 /*! 45 \class SOPHYA::MuTyV 46 \ingroup SysTools 47 Simple utility class which can be used to hold values of type 48 string, integer (\b int_8) or float (\b r_8) and providing 49 easy conversion methods between these types. 50 */ 51 52 /*! 45 53 \class SOPHYA::DVList 54 \ingroup SysTools 46 55 This class can be used to construct list of values associated with names. 47 56 Variables names should not contain space characters and is limited to 64 -
trunk/SophyaLib/BaseTools/dvlist.h
r895 r913 20 20 21 21 // Classe utilitaire pour manipuler des variables typees 22 //! A simple class for holding string, integer and float type values. 22 23 class MuTyV { 23 24 public: -
trunk/SophyaLib/BaseTools/machdefs.h
r849 r913 342 342 /* ********************************************************/ 343 343 344 /* ---- Activation des flags de debug/bound checking ----- */ 345 #ifdef SOPHYA_DEBUG 346 #define SO_BOUNDCHECKING 347 #endif 348 344 349 /* Compatibilite, avant de migrer tout le code en "PLANCK" */ 345 350 -
trunk/SophyaLib/BaseTools/pexceptions.h
r895 r913 17 17 string BuildLongExceptionMessage(const char * s, const char *file, int line); 18 18 19 //! Base exception class in Sophya. 20 /*! Ancestor for PError and PException 19 /*! \ingroup SysTools 20 \brief Base exception class in Sophya 21 22 Ancestor for PError and PException 21 23 It has a message, and an id to give more 22 24 information on the exception. … … 41 43 // PException 42 44 43 //! A PError is a serious logic error. Usually not caught... 45 /*! \ingroup SysTools 46 \brief A PError is a serious logic error. Usually not caught... */ 44 47 class PError : public PThrowable { 45 48 public: … … 47 50 }; 48 51 49 //! A PException is not as serious... Can be caught. 52 /*! \ingroup SysTools 53 \brief A PException is not as serious... Can be caught. */ 50 54 class PException : public PThrowable { 51 55 public: … … 60 64 // AssertionFailedError 61 65 62 //! Memory allocation failure 66 /*! \ingroup SysTools 67 \brief Memory allocation failure */ 63 68 class AllocationError : public PError { 64 69 public: … … 66 71 }; 67 72 68 //! Null pointer error 73 /*! \ingroup SysTools 74 \brief Null pointer error */ 69 75 class NullPtrError : public PError { 70 76 public: … … 73 79 74 80 75 //! Calling a forbidden method, trying a forbidden operation 81 /*! \ingroup SysTools 82 \brief Calling a forbidden method, trying a forbidden operation */ 76 83 class ForbiddenError : public PError { 77 84 public: … … 80 87 81 88 82 //! ASSERT macro failure. The message is the assertion... 89 /*! \ingroup SysTools 90 \brief ASSERT macro failure. The message is the assertion... */ 83 91 class AssertionFailedError : public PError { 84 92 public: … … 101 109 // CaughtSignalExc 102 110 103 //! Generic IO Exception. 111 /*! \ingroup SysTools 112 \brief Generic IO Exception */ 104 113 class IOExc : public PException { 105 114 public: … … 107 116 }; 108 117 109 //! Bad file format. 118 /*! \ingroup SysTools 119 \brief Bad file format */ 110 120 class FileFormatExc : public IOExc { 111 121 public: … … 113 123 }; 114 124 115 //! Size mismatch between objects. 125 /*! \ingroup SysTools 126 \brief Size mismatch between objects */ 116 127 class SzMismatchError : public PException { 117 128 public: … … 119 130 }; 120 131 121 //! Out of bounds for array, matrix, etc. 132 /*! \ingroup SysTools 133 \brief Out of bounds for array, matrix, etc */ 122 134 class RangeCheckError : public PException { 123 135 public: … … 125 137 }; 126 138 127 //! Invalid parameter to method/constructor... 139 /*! \ingroup SysTools 140 \brief Invalid parameter to method/constructor... */ 128 141 class ParmError : public PException { 129 142 public: … … 131 144 }; 132 145 133 //! Calling a non available / not implemented method 146 /*! \ingroup SysTools 147 \brief Calling a non available / not implemented method */ 134 148 class NotAvailableOperation : public PException { 135 149 public: … … 137 151 }; 138 152 139 //! Bad data type -> keep ? 153 /*! \ingroup SysTools 154 \brief Bad data type -> keep ? */ 140 155 class TypeMismatchExc : public PException { 141 156 public: … … 143 158 }; 144 159 145 //! Math operation exception 160 /*! \ingroup SysTools 161 \brief Math operation exception */ 146 162 class MathExc : public PException { 147 163 public: … … 149 165 }; 150 166 151 //! Singular matrix 167 /*! \ingroup SysTools 168 \brief Singular matrix */ 152 169 class SingMatrixExc : public MathExc { 153 170 public: … … 155 172 }; 156 173 157 //! Duplicate identifier during registration 174 /*! \ingroup SysTools 175 \brief Duplicate identifier during registration */ 158 176 class DuplicateIdExc : public PException { 159 177 public: … … 161 179 }; 162 180 163 //! Not found identifier 181 /*! \ingroup SysTools 182 \brief Not found identifier */ 164 183 class NotFoundExc : public PException { 165 184 public: … … 167 186 }; 168 187 169 //! Generated exception when processing a signal 188 /*! \ingroup SysTools 189 \brief Generated exception when processing a signal */ 170 190 class CaughtSignalExc : public PException { 171 191 public: -
trunk/SophyaLib/BaseTools/sophyainit.cc
r802 r913 18 18 // --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier) 19 19 int SophyaInitiator::FgInit = 0; 20 21 /*! 22 \namespace SOPHYA 23 \brief This is the namespace for the whole Sophya package 24 */ 25 26 /*! 27 \defgroup SysTools SysTools module 28 This module contains classes and functions which define the 29 general framework for \b Sophya package such as the simple 30 persistence, serialisation mechanism through \b PPersist, 31 \b POutPersist, \b PInPersist classes. It contains also 32 few utility classes such as the \b NDataBlock<T>, (template 33 numerical arrays with reference counting and sharing) 34 \b DataCards and \b PDynLinker (Dynamic link handler) classes. 35 36 */ 37 38 /*! 39 \class SOPHYA::SophyaInitiator 40 \ingroup SysTools 41 Each Sophya module may contain an initialiser class which should 42 be a sub-class of SophyaInitiator. 43 */ 20 44 21 45 SophyaInitiator::SophyaInitiator() -
trunk/SophyaLib/BaseTools/sophyainit.h
r754 r913 12 12 double SophyaVersion(void); /* Version + (Revision/1000) */ 13 13 14 // Classe d''initialisation pour les modules de PEIDA++14 // Classe d''initialisation pour les modules SOPHYA 15 15 16 //! Initializer class for sophya modules 16 17 class SophyaInitiator { 17 18 private: -
trunk/SophyaLib/BaseTools/srandgen.c
r851 r913 35 35 */ 36 36 37 /*! \defgroup RandGen 38 Random number generators */ 39 40 /*! \ingroup SysTools 41 \fn frand01 42 Returns a random number (float) with flat distribution between 0 ... 1 43 */ 44 /*! \ingroup SysTools 45 \fn drand01 46 Returns a random number (double) with flat distribution between 0 ... 1 47 */ 48 /*! \ingroup SysTools 49 \fn frandpm1() 50 Returns a random number (float) with flat distribution between -1 ... 1 51 */ 52 /*! \ingroup SysTools 53 \fn drandpm1() 54 Returns a random number (double) with flat distribution between -1 ... 1 55 */ 56 37 57 /*=========================================================================*/ 38 58 /* … … 43 63 -- 44 64 */ 65 66 /*! \ingroup SysTools 67 Fast initialisation of the random number generator \c (drand48) 68 using a \c long type value (cf \c srand48 ) 69 */ 45 70 void Ini_Ranf_Quick(long seed_val, int lp) 46 71 { … … 57 82 48 bits (cf seed48). 58 83 -- 84 */ 85 /*! \ingroup SysTools 86 complete initialisation of the random number generator \c (drand48) 87 using a \c using 48 bits (cf \c seed48 ) 59 88 */ 60 89 void Ini_Ranf(unsigned short seed_16v[3], int lp) … … 73 102 de 48 bits (cf seed48). 74 103 -- 104 */ 105 /*! \ingroup SysTools 106 Returns the status (48 bits) of the random number generator \c (drand48) 107 (cf \c seed48 ) 75 108 */ 76 109 void Get_Ranf(unsigned short seed_16v[3], int lp) … … 102 135 -- 103 136 */ 137 /*! \ingroup SysTools 138 Automatic initialisation using the present time 139 */ 104 140 void Auto_Ini_Ranf(int lp) 105 141 { … … 151 187 -- 152 188 */ 189 /*! \ingroup SysTools 190 Normal (Gaussian) random number generator (Mean=0., Sigma=1.) 191 */ 153 192 float NorRand(void) 154 193 { … … 190 229 Generation aleatoire gaussienne de centre "am" et de sigma "s". 191 230 -- 231 */ 232 /*! \ingroup SysTools 233 Normal (Gaussian) random number generator with the specified mean 234 (\c am ) and sigma (\c s ) 192 235 */ 193 236 double GauRnd(double am, double s) -
trunk/SophyaLib/SUtils/datacards.cc
r895 r913 1 // $Id: datacards.cc,v 1. 2 2000-04-12 17:49:42ansari Exp $1 // $Id: datacards.cc,v 1.3 2000-04-13 15:58:38 ansari Exp $ 2 2 // 3 3 // Datacards, acquisition EROS II … … 38 38 /*! 39 39 \class SOPHYA::DataCards 40 \ingroup SysTools 40 41 This class can be used for decoding program parameters from an ascii 41 42 file. Each line of the ascii contains a keyword starting with \b @ . -
trunk/SophyaLib/SysTools/ctimer.cc
r895 r913 1 1 // 2 // $Id: ctimer.cc,v 1. 3 2000-04-12 17:49:40ansari Exp $2 // $Id: ctimer.cc,v 1.4 2000-04-13 15:58:37 ansari Exp $ 3 3 // 4 4 … … 39 39 /*! 40 40 \class SOPHYA::Timer 41 \ingroup SysTools 41 42 This class implements a simple chronometer which can be used for 42 43 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++ -*-2 1 // Gestionnaire de lien dynamique - R. Ansari 12/98 3 2 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 4 3 4 #include "pdlmgr.h" 5 5 #include <stdio.h> 6 6 #include <stdlib.h> … … 8 8 #include <iostream.h> 9 9 10 #include "pdlmgr.h"11 10 12 11 // Extension de noms de fichiers Shared libs … … 20 19 /*! 21 20 \class SOPHYA::PDynLinkMgr 21 \ingroup SysTools 22 22 This classes handles the run-time operations related to using shared 23 23 libraries. The present version has been adapted for different Unix 24 24 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 25 42 */ 26 43 -
trunk/SophyaLib/SysTools/periodic.cc
r241 r913 9 9 10 10 #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 */ 11 18 12 19 /* --Methode-- */ 20 /*! Constructor with the definition of the interval (in seconds) 21 and an optional user action */ 13 22 Periodic::Periodic(int dt, UsPeriodicAction act, void * usp) 14 23 { … … 29 38 30 39 /* --Methode-- */ 40 /*! Sets the user action function and its data \c usp */ 31 41 void Periodic::SetAction(UsPeriodicAction act, void * usp) 32 42 { … … 36 46 37 47 /* --Methode-- */ 48 /*! Changes the interval \c dt specified in seconds */ 38 49 void Periodic::SetInterval(int dt) 39 50 { … … 44 55 45 56 /* --Methode-- */ 57 /*! Changes the interval \c dtms specified in milli-seconds */ 46 58 void Periodic::SetIntervalms(int dtms) 47 59 { … … 53 65 54 66 /* --Methode-- */ 67 /*! Activate the object */ 55 68 void Periodic::Start(int dt) 56 69 { … … 69 82 70 83 /* --Methode-- */ 84 /*! Deactivate the object */ 71 85 void Periodic::Stop() 72 86 { … … 86 100 87 101 /* --Methode-- */ 102 /*! This method should be redefined for sub-classes of Periodic 103 The default implementation calls the user action function */ 88 104 void Periodic::DoPeriodic() 89 105 { -
trunk/SophyaLib/SysTools/psighand.cc
r706 r913 9 9 static bool sigprstate[6] = {false, false, false, false, false, false}; 10 10 11 void PeidaProcessSignal(int s);11 void SophyaProcessSignal(int s); 12 12 13 13 /* 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 */ 26 void SOPHYA::SophyaConfigureSignalhandling(bool cfpe, bool csegv, bool cint, bool cquit, bool cusr1, bool cusr2) 15 27 { 16 28 struct sigaction ae, ad; 17 29 18 ae.sa_handler = PeidaProcessSignal;30 ae.sa_handler = SophyaProcessSignal; 19 31 ad.sa_handler = SIG_DFL; 20 32 memset( &(ae.sa_mask), 0, sizeof(sigset_t) ); … … 31 43 if (cfpe) { 32 44 sigaction(SIGFPE, &ae, NULL); 33 puts(" PeidaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ...");45 puts("SophyaConfigureSignalhandling(): Activating SIGFPE handling (-> throw) ..."); 34 46 } 35 47 else { 36 48 sigaction(SIGFPE, &ad, NULL); 37 puts(" PeidaConfigureSignalhandling(): Back to default SIGFPE handling ...");49 puts("SophyaConfigureSignalhandling(): Back to default SIGFPE handling ..."); 38 50 } 39 51 sigprstate[0] = cfpe; … … 43 55 if (csegv) { 44 56 sigaction(SIGSEGV, &ae, NULL); 45 puts(" PeidaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ...");57 puts("SophyaConfigureSignalhandling(): Activating SIGSEGV handling (-> throw) ..."); 46 58 } 47 59 else { 48 60 sigaction(SIGSEGV, &ad, NULL); 49 puts(" PeidaConfigureSignalhandling(): Back to default SIGSEGV handling ...");61 puts("SophyaConfigureSignalhandling(): Back to default SIGSEGV handling ..."); 50 62 } 51 63 sigprstate[1] = csegv; … … 56 68 if (cint) { 57 69 sigaction(SIGINT, &ae, NULL); 58 puts(" PeidaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ...");70 puts("SophyaConfigureSignalhandling(): Activating SIGINT handling (-> throw) ..."); 59 71 } 60 72 else { 61 73 sigaction(SIGINT, &ad, NULL); 62 puts(" PeidaConfigureSignalhandling(): Back to default SIGINT handling ...");74 puts("SophyaConfigureSignalhandling(): Back to default SIGINT handling ..."); 63 75 } 64 76 sigprstate[2] = cint; … … 69 81 if (cquit) { 70 82 sigaction(SIGQUIT, &ae, NULL); 71 puts(" PeidaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ...");83 puts("SophyaConfigureSignalhandling(): Activating SIGQUIT handling (-> throw) ..."); 72 84 } 73 85 else { 74 86 sigaction(SIGQUIT, &ad, NULL); 75 puts(" PeidaConfigureSignalhandling(): Back to default SIGQUIT handling ...");87 puts("SophyaConfigureSignalhandling(): Back to default SIGQUIT handling ..."); 76 88 } 77 89 sigprstate[3] = cquit; … … 82 94 if (cusr1) { 83 95 sigaction(SIGUSR1, &ae, NULL); 84 puts(" PeidaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ...");96 puts("SophyaConfigureSignalhandling(): Activating SIGUSR1 handling (-> throw) ..."); 85 97 } 86 98 else { 87 99 sigaction(SIGUSR1, &ad, NULL); 88 puts(" PeidaConfigureSignalhandling(): Back to default SIGUSR1 handling ...");100 puts("SophyaConfigureSignalhandling(): Back to default SIGUSR1 handling ..."); 89 101 } 90 102 sigprstate[4] = cusr1; … … 94 106 if (cusr2) { 95 107 sigaction(SIGUSR2, &ae, NULL); 96 puts(" PeidaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ...");108 puts("SophyaConfigureSignalhandling(): Activating SIGUSR2 handling (-> throw) ..."); 97 109 } 98 110 else { 99 111 sigaction(SIGUSR2, &ad, NULL); 100 puts(" PeidaConfigureSignalhandling(): Back to default SIGUSR2 handling ...");112 puts("SophyaConfigureSignalhandling(): Back to default SIGUSR2 handling ..."); 101 113 } 102 114 sigprstate[5] = cusr2; … … 104 116 } 105 117 /* Nouvelle-Fonction */ 106 void PeidaProcessSignal(int s)118 void SophyaProcessSignal(int s) 107 119 { 108 120 string msg; … … 110 122 { 111 123 case SIGFPE : 112 puts(" PeidaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###");124 puts("SophyaProcessSignal: ###Signal SIGFPE catched, throw catchedSIGFPE ###"); 113 125 msg = "Caught SIGFPE"; 114 126 throw ( CaughtSignalExc(msg, s) ); 115 127 case SIGSEGV : 116 puts(" PeidaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###");128 puts("SophyaProcessSignal: ###Signal SIGSEGV catched, throw catchedSIGSEGV ###"); 117 129 msg = "Caught SIGSEGV"; 118 130 throw ( CaughtSignalExc(msg, s) ); 119 131 case SIGINT : 120 puts(" PeidaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###");132 puts("SophyaProcessSignal: ###Signal SIGINT catched, throw catchedSIGINT ###"); 121 133 msg = "Caught SIGINT"; 122 134 throw ( CaughtSignalExc(msg, s) ); 123 135 case SIGQUIT : 124 puts(" PeidaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###");136 puts("SophyaProcessSignal: ###Signal SIGQUIT catched, throw catchedSIGQUIT ###"); 125 137 msg = "Caught SIGQUIT"; 126 138 throw ( CaughtSignalExc(msg, s) ); 127 139 case SIGUSR1 : 128 puts(" PeidaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###");140 puts("SophyaProcessSignal: ###Signal SIGUSR1 catched, throw catchedSIGUSR1 ###"); 129 141 msg = "Caught SIGUSR1"; 130 142 throw ( CaughtSignalExc(msg, s) ); 131 143 case SIGUSR2 : 132 puts(" PeidaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###");144 puts("SophyaProcessSignal: ###Signal SIGUSR2 catched, throw catchedSIGUSR2 ###"); 133 145 msg = "Caught SIGUSR2"; 134 146 throw ( CaughtSignalExc(msg, s) ); 135 147 default : 136 printf(" PeidaProcessSignal: ###Signal %d catched, throw inconsistentErr ### \n", s);148 printf("SophyaProcessSignal: ###Signal %d catched, throw inconsistentErr ### \n", s); 137 149 msg = "Caught SIG???"; 138 150 throw ( CaughtSignalExc(msg, s) ); -
trunk/SophyaLib/SysTools/psighand.h
r480 r913 2 2 // Pour la gestion des signaux a travers des exceptions 3 3 4 #ifndef PSIGHANDLE_SEEN5 #define PSIGHANDLE_SEEN4 #ifndef SOPHYASIGHANDLE_SEEN 5 #define SOPHYASIGHANDLE_SEEN 6 6 7 7 #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 9 namespace SOPHYA { 10 void 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 11 15 #endif
Note:
See TracChangeset
for help on using the changeset viewer.