source: Sophya/trunk/SophyaLib/BaseTools/sophyainit.cc@ 2660

Last change on this file since 2660 was 2660, checked in by ansari, 20 years ago

1/ Ajout de la classe PPFWrapperSTLVector<T> pour gestion de persistence
PPF des vecteurs de STL (fichier ppfwrapstlv.h)
2/ Ajout de la classe SegDataBlock<T> (et l'interface SegDBInterface<T>)
pour la gestion de blocs de donnees segmentes (segdatablock.h) et son
gestionnaire PPF FIO_SegDataBlock<T> (fichier fiosegdb.h )
3/ Ajout de la classe SwSegDataBlock<T> (Data bloc segmente avec gestion
de swap) et la classe swapper PPF PPFDataSwapper<T> (fichiers
ppfswapper.h et swsegdb.h)
4/ Ajout de la classes utilitaire PPF_TPointer_IO<T> (fichier
ppftpointer.h)
5/ Enregistrement des classes handler PPF ds sophyainit.cc
6/ Amelioration de l'impression ds AnalyseTags (ppfbinstream.cc)
7/ MAJ Makefile et objlist.list (ajout de TimeStamp.cc en particulier)

Reza , 7 Avril 2005

File size: 6.8 KB
Line 
1#include "sopnamsp.h"
2#include "machdefs.h"
3
4#include <unistd.h>
5#include <stdlib.h>
6#include <stdio.h>
7#include <complex>
8
9#include "sophyainit.h"
10
11#include "pexceptions.h"
12
13#include "ppersist.h"
14#include "fiondblock.h"
15#include "dvlist.h"
16
17#include "fiosegdb.h"
18#include "ppfwrapstlv.h"
19
20#include "sversion.h"
21
22// --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier)
23int SophyaInitiator::FgInit = 0;
24
25/*!
26 \namespace SOPHYA
27 \brief This is the namespace for the whole Sophya package
28*/
29
30/*!
31 \class SOPHYA::SophyaInitiator
32 \ingroup BaseTools
33 Each Sophya module may contain an initialiser class which should
34 be a sub-class of SophyaInitiator.
35*/
36
37SophyaInitiator::SophyaInitiator()
38{
39#if defined(Darwin)
40 // Il semble y avoir un probleme sous MacOSX ...
41 if (FgInit == 0)
42 cout << " SophyaInitiator::SophyaInitiator() BaseTools Init" << endl;
43#endif
44 FgInit++;
45 if (FgInit > 1) return;
46
47 InitFailNewHandler();
48
49 #ifdef xx__mac__
50 //InitToolBox();
51 //SIOUXSettings.initializeTB = FALSE;
52 SIOUXSettings.autocloseonquit = FALSE;
53 SIOUXSettings.asktosaveonclose = FALSE;
54 SIOUXSettings.showstatusline = TRUE;
55 #endif
56
57 // Initialisation des mecanismes PPF I/O
58 PIOPersist::Initialize();
59 // Enregistrement des handlers PPF pour les NDataBlock<T>
60 PPRegister(FIO_NDataBlock<uint_1>);
61 DObjRegister(FIO_NDataBlock<uint_1>, NDataBlock<uint_1>);
62 PPRegister(FIO_NDataBlock<uint_2>);
63 DObjRegister(FIO_NDataBlock<uint_2>, NDataBlock<uint_2>);
64 PPRegister(FIO_NDataBlock<int_2>);
65 DObjRegister(FIO_NDataBlock<int_2>, NDataBlock<int_2>);
66 PPRegister(FIO_NDataBlock<int_4>);
67 DObjRegister(FIO_NDataBlock<int_4>, NDataBlock<int_4>);
68 PPRegister(FIO_NDataBlock<int_8>);
69 DObjRegister(FIO_NDataBlock<int_8>, NDataBlock<int_8>);
70 PPRegister(FIO_NDataBlock<uint_4>);
71 DObjRegister(FIO_NDataBlock<uint_4>, NDataBlock<uint_4>);
72 PPRegister(FIO_NDataBlock<uint_8>);
73 DObjRegister(FIO_NDataBlock<uint_8>, NDataBlock<uint_8>);
74 PPRegister(FIO_NDataBlock<r_4>);
75 DObjRegister(FIO_NDataBlock<r_4>, NDataBlock<r_4>);
76 PPRegister(FIO_NDataBlock<r_8>);
77 DObjRegister(FIO_NDataBlock<r_8>, NDataBlock<r_8>);
78 PPRegister(FIO_NDataBlock< complex<r_4> >);
79 DObjRegister(FIO_NDataBlock< complex<r_4> >, NDataBlock< complex<r_4> >);
80 PPRegister(FIO_NDataBlock< complex<r_8> >);
81 DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
82
83 // Enregistrement des handlers PPF pour les DVList
84 PPRegister(ObjFileIO<DVList>);
85 DObjRegister(ObjFileIO<DVList>, DVList);
86
87 // Enregistrement des handlers PPF pour les SegDataBlock<T>
88 PPRegister(FIO_SegDataBlock<uint_2>);
89 DObjRegister(FIO_SegDataBlock<uint_2>, SegDataBlock<uint_2>);
90 PPRegister(FIO_SegDataBlock<int_2>);
91 DObjRegister(FIO_SegDataBlock<int_2>, SegDataBlock<int_2>);
92 PPRegister(FIO_SegDataBlock<int_4>);
93 DObjRegister(FIO_SegDataBlock<int_4>, SegDataBlock<int_4>);
94 PPRegister(FIO_SegDataBlock<int_8>);
95 DObjRegister(FIO_SegDataBlock<int_8>, SegDataBlock<int_8>);
96 PPRegister(FIO_SegDataBlock<uint_4>);
97 DObjRegister(FIO_SegDataBlock<uint_4>, SegDataBlock<uint_4>);
98 PPRegister(FIO_SegDataBlock<uint_8>);
99 DObjRegister(FIO_SegDataBlock<uint_8>, SegDataBlock<uint_8>);
100 PPRegister(FIO_SegDataBlock<r_4>);
101 DObjRegister(FIO_SegDataBlock<r_4>, SegDataBlock<r_4>);
102 PPRegister(FIO_SegDataBlock<r_8>);
103 DObjRegister(FIO_SegDataBlock<r_8>, SegDataBlock<r_8>);
104 PPRegister(FIO_SegDataBlock< complex<r_4> >);
105 DObjRegister(FIO_SegDataBlock< complex<r_4> >, SegDataBlock< complex<r_4> >);
106 PPRegister(FIO_SegDataBlock< complex<r_8> >);
107 DObjRegister(FIO_SegDataBlock< complex<r_8> >, SegDataBlock< complex<r_8> >);
108 PPRegister(FIO_SegDataBlock<string>);
109 DObjRegister(FIO_SegDataBlock<string>, SegDataBlock<string>);
110
111 // Enregistrement des handlers PPF pour les vecteurs de la STL
112 PPRegister(PPFWrapperSTLVector<uint_2>);
113 DObjRegister(PPFWrapperSTLVector<uint_2>, std::vector<uint_2>);
114 PPRegister(PPFWrapperSTLVector<int_2>);
115 DObjRegister(PPFWrapperSTLVector<int_2>, std::vector<int_2>);
116 PPRegister(PPFWrapperSTLVector<int_4>);
117 DObjRegister(PPFWrapperSTLVector<int_4>, std::vector<int_4>);
118 PPRegister(PPFWrapperSTLVector<int_8>);
119 DObjRegister(PPFWrapperSTLVector<int_8>, std::vector<int_8>);
120 PPRegister(PPFWrapperSTLVector<uint_4>);
121 DObjRegister(PPFWrapperSTLVector<uint_4>, std::vector<uint_4>);
122 PPRegister(PPFWrapperSTLVector<uint_8>);
123 DObjRegister(PPFWrapperSTLVector<uint_8>, std::vector<uint_8>);
124 PPRegister(PPFWrapperSTLVector<r_4>);
125 DObjRegister(PPFWrapperSTLVector<r_4>, std::vector<r_4>);
126 PPRegister(PPFWrapperSTLVector<r_8>);
127 DObjRegister(PPFWrapperSTLVector<r_8>, std::vector<r_8>);
128 PPRegister(PPFWrapperSTLVector< complex<r_4> >);
129 DObjRegister(PPFWrapperSTLVector< complex<r_4> >, std::vector< complex<r_4> >);
130 PPRegister(PPFWrapperSTLVector< complex<r_8> >);
131 DObjRegister(PPFWrapperSTLVector< complex<r_8> >, std::vector< complex<r_8> >);
132 PPRegister(PPFWrapperSTLVector<string>);
133 DObjRegister(PPFWrapperSTLVector<string>, std::vector<string>);
134
135
136#if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
137 // pas de bufferisation pour printf cmv 18/3/97 selon E.A.
138 // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
139 setlinebuf(stdout);
140 setlinebuf(stderr);
141#endif
142
143 // si var env SOPHYA_NOPRTVER definie pas de print
144 if(!getenv("SOPHYA_NOPRTVER")) Version(true);
145
146 int pnice;
147 char* snice = getenv("SOPHYA_NICE");
148 if (!snice) pnice=8;
149 else pnice = atoi(snice);
150 nice(pnice);
151
152}
153
154SophyaInitiator::~SophyaInitiator()
155{
156 FgInit--;
157/*
158 if (FgInit == 0)
159 {
160 delete PPersistMgr::classList; PPersistMgr::classList = NULL;
161 delete PShPersist::objList; PShPersist::objList = NULL;
162 }
163 */
164}
165
166double SophyaInitiator::Version(bool fgprt)
167{
168if (fgprt) {
169 char* compiler = 0;
170 #ifdef __GNUG__
171 compiler = "gcc " __VERSION__;
172 #endif
173 #ifdef __DECCXX
174 compiler = "cxx " ;
175 #endif
176 #ifdef __aCC__
177 compiler = const_cast<char *>("HP-aCC ") ;
178 #endif
179 #ifdef __KCC__
180 compiler = const_cast<char *>("KCC ") ;
181 #endif
182 #ifdef __SGICC__
183 #ifdef SGI_ARCH64
184 compiler = const_cast<char *>("SGI-CC (-64) ") ;
185 #else
186 compiler = const_cast<char *>("SGI-CC ") ;
187 #endif
188 #endif
189 #ifdef __MWERKS__
190 compiler = const_cast<char *>("Codewarrior ");
191 #endif
192 fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
193 SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
194 __DATE__, __TIME__, compiler);
195}
196return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
197}
198
199double SOPHYA::SophyaVersion()
200{
201return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
202}
203
204// On met un objet initiator en statique, pour les loaders qui savent
205// appeler le constructeur des objets statiques Reza 08/98
206#if !defined(Darwin)
207// La presence de l'objet statique psophyainit semble poserun probleme
208// sur MacOSX 10.2 qui se plante a l'initialisation avec les shared-libs
209static SophyaInitiator psophyainit;
210#endif
Note: See TracBrowser for help on using the repository browser.