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

Last change on this file since 802 was 802, checked in by ansari, 25 years ago

Mise au point du nouveau schema (Version=2) de PPersist - Mise en place

de tag complet pour toutes les donnees/objets ecrits - Gestion a peu
pres correct des objets references plusieurs fois, ecrit une seule fois.
Mecanisme d'enregistrement pour les DataObject associe et Methodes
(PutObject/GetObjet) facilitant l'ecriture/lecture de DataObject.
Separation du fichier de la classe FIO_NDataBlock<T>.

Reza03/04/2000

File size: 3.4 KB
Line 
1#include "machdefs.h"
2
3#include <unistd.h>
4#include <stdlib.h>
5#include <stdio.h>
6#include <complex>
7
8#include "sophyainit.h"
9
10#include "pexceptions.h"
11
12#include "ppersist.h"
13#include "fiondblock.h"
14#include "dvlist.h"
15
16#include "sversion.h"
17
18// --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier)
19int SophyaInitiator::FgInit = 0;
20
21SophyaInitiator::SophyaInitiator()
22{
23 FgInit++;
24 if (FgInit > 1) return;
25
26 InitFailNewHandler();
27
28 #ifdef xx__mac__
29 //InitToolBox();
30 //SIOUXSettings.initializeTB = FALSE;
31 SIOUXSettings.autocloseonquit = FALSE;
32 SIOUXSettings.asktosaveonclose = FALSE;
33 SIOUXSettings.showstatusline = TRUE;
34 #endif
35
36 PIOPersist::Initialize();
37 PPRegister(FIO_NDataBlock<uint_1>);
38 DObjRegister(FIO_NDataBlock<uint_1>, NDataBlock<uint_1>);
39 PPRegister(FIO_NDataBlock<uint_2>);
40 DObjRegister(FIO_NDataBlock<uint_2>, NDataBlock<uint_2>);
41 PPRegister(FIO_NDataBlock<int_2>);
42 DObjRegister(FIO_NDataBlock<int_2>, NDataBlock<int_2>);
43 PPRegister(FIO_NDataBlock<int_4>);
44 DObjRegister(FIO_NDataBlock<int_4>, NDataBlock<int_4>);
45 PPRegister(FIO_NDataBlock<int_8>);
46 DObjRegister(FIO_NDataBlock<int_8>, NDataBlock<int_8>);
47 PPRegister(FIO_NDataBlock<uint_4>);
48 DObjRegister(FIO_NDataBlock<uint_4>, NDataBlock<uint_4>);
49 PPRegister(FIO_NDataBlock<uint_8>);
50 DObjRegister(FIO_NDataBlock<uint_8>, NDataBlock<uint_8>);
51 PPRegister(FIO_NDataBlock<r_4>);
52 DObjRegister(FIO_NDataBlock<r_4>, NDataBlock<r_4>);
53 PPRegister(FIO_NDataBlock<r_8>);
54 DObjRegister(FIO_NDataBlock<r_8>, NDataBlock<r_8>);
55 PPRegister(FIO_NDataBlock< complex<r_4> >);
56 DObjRegister(FIO_NDataBlock< complex<r_4> >, NDataBlock< complex<r_4> >);
57 PPRegister(FIO_NDataBlock< complex<r_8> >);
58 DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
59
60 PPRegister(ObjFileIO<DVList>);
61 DObjRegister(ObjFileIO<DVList>, DVList);
62
63
64#if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
65 // pas de bufferisation pour printf cmv 18/3/97 selon E.A.
66 // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
67 setlinebuf(stdout);
68 setlinebuf(stderr);
69#endif
70
71 // si var env SOPHYA_NOPRTVER definie pas de print
72 if(!getenv("SOPHYA_NOPRTVER")) Version(true);
73
74 int pnice;
75 char* snice = getenv("SOPHYA_NICE");
76 if (!snice) pnice=8;
77 else pnice = atoi(snice);
78 nice(pnice);
79
80}
81
82SophyaInitiator::~SophyaInitiator()
83{
84 FgInit--;
85/*
86 if (FgInit == 0)
87 {
88 delete PPersistMgr::classList; PPersistMgr::classList = NULL;
89 delete PShPersist::objList; PShPersist::objList = NULL;
90 }
91 */
92}
93
94double SophyaInitiator::Version(bool fgprt)
95{
96if (fgprt) {
97 char* compiler = 0;
98 #ifdef __GNUG__
99 compiler = "gcc " __VERSION__;
100 #endif
101 #ifdef __DECCXX
102 compiler = "cxx " ;
103 #endif
104 #ifdef __aCC__
105 compiler = const_cast<char *>("HP-aCC ") ;
106 #endif
107 #ifdef __KCC__
108 compiler = const_cast<char *>("KCC ") ;
109 #endif
110 #ifdef __SGICC__
111 compiler = const_cast<char *>("SGI-CC ") ;
112 #endif
113 #ifdef __MWERKS__
114 compiler = const_cast<char *>("Codewarrior ");
115 #endif
116 fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
117 SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
118 __DATE__, __TIME__, compiler);
119}
120return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
121}
122
123// On met un objet initiator en statique, pour les loaders qui savent
124// appeler le constructeur des objets statiques Reza 08/98
125static SophyaInitiator psophyainit;
Note: See TracBrowser for help on using the repository browser.