1 |
|
5 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuillière et Vincent FRANCOIS
|
5 |
|
|
// Département de Génie Mécanique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du département
|
8 |
|
|
// de génie mécanique de l'Université du Québec à
|
9 |
|
|
// Trois Rivières
|
10 |
|
|
// Les librairies ne peuvent être utilisées sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// affiche.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H26
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
//#include <strstream.h>
|
29 |
|
|
#include <iostream.h>
|
30 |
|
|
#include <time.h>
|
31 |
|
|
#include "affiche.h"
|
32 |
|
|
|
33 |
|
|
//using namespace std;
|
34 |
|
|
|
35 |
|
|
int affiche::verbosemode=1;
|
36 |
|
|
//affiche afficheur;
|
37 |
|
|
affiche_tous endaff;
|
38 |
|
|
affiche_verbose endaffwarning;
|
39 |
|
|
affiche_erreur enderr;
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
#ifdef WINDOWS_VERSION
|
44 |
|
|
void affiche::initialise(TVisuMagicform *fen)
|
45 |
|
|
{
|
46 |
|
|
fenetre=fen;
|
47 |
|
|
}
|
48 |
|
|
#endif
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
affiche::affiche(void)
|
53 |
|
|
{
|
54 |
|
|
o.precision(16);
|
55 |
|
|
o<<" ";
|
56 |
|
|
vide();
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
void affiche::vide( void )
|
63 |
|
|
{
|
64 |
|
|
o.seekg( ios::beg );
|
65 |
|
|
o.seekp( ios::beg );
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
void affiche::imprime_stdout( ostream& out )
|
70 |
|
|
{
|
71 |
|
|
#ifndef WINDOWS_VERSION
|
72 |
|
|
o << '\0';
|
73 |
|
|
out << o.str();
|
74 |
|
|
out << endl;
|
75 |
|
|
o.seekg( ios::beg );
|
76 |
|
|
o.seekp( ios::beg );
|
77 |
|
|
#else
|
78 |
|
|
o << '\0';
|
79 |
|
|
fenetre->Memo1->Lines->Add(o.str());
|
80 |
|
|
o.seekg( ios::beg );
|
81 |
|
|
o.seekp( ios::beg );
|
82 |
|
|
#endif
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
void affiche::refresh(void)
|
86 |
|
|
{
|
87 |
|
|
Application->ProcessMessages();
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
void affiche::init_cpu(void)
|
91 |
|
|
{
|
92 |
|
|
cpu_avant=clock();
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
double affiche::calcul_cpu(void)
|
96 |
|
|
{
|
97 |
|
|
long cpu=clock();
|
98 |
|
|
double res=((double)(cpu-cpu_avant)/CLK_TCK);
|
99 |
|
|
cpu_avant=cpu;
|
100 |
|
|
return res;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
affiche& affiche::operator<<(class affiche_tous mode)
|
106 |
|
|
{
|
107 |
|
|
this->imprime_stdout(cout);
|
108 |
|
|
return *this;
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
affiche& affiche::operator<<(class affiche_erreur mode)
|
112 |
|
|
{
|
113 |
|
|
this->imprime_stdout(cerr);
|
114 |
|
|
return *this;
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
affiche& affiche::operator<<(class affiche_verbose mode)
|
119 |
|
|
{
|
120 |
|
|
if (this->verbosemode==1) this->imprime_stdout(cout); else this->vide();
|
121 |
|
|
return *this;
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
affiche& affiche::operator<<(char* mess)
|
126 |
|
|
{
|
127 |
|
|
this->o << mess;
|
128 |
|
|
return *this;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
affiche& affiche::operator<<(const char* mess)
|
132 |
|
|
{
|
133 |
|
|
this->o << mess;
|
134 |
|
|
return *this;
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
affiche& affiche::operator<<(double num)
|
139 |
|
|
{
|
140 |
|
|
this->o<<num;
|
141 |
|
|
return *this;
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
affiche& affiche::operator<<(int num)
|
146 |
|
|
{
|
147 |
|
|
|
148 |
|
|
this->o<<num;
|
149 |
|
|
return *this;
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
affiche& affiche::operator<<(unsigned long num)
|
153 |
|
|
{
|
154 |
|
|
|
155 |
|
|
this->o<<num;
|
156 |
|
|
return *this;
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
affiche& affiche::operator<<(ostream& o)
|
161 |
|
|
{
|
162 |
|
|
this->o<<o;
|
163 |
|
|
return *this;
|
164 |
|
|
}
|