#endif
#include <simgear/compiler.h>
+#include <simgear/debug/logstream.hxx>
#include <stdio.h>
#include <time.h>
SG_USING_STD( string );
SG_USING_STD( vector );
-SG_USING_STD( cout );
-SG_USING_STD( endl );
enum {
while ( size < s ) {
size *= 2;
}
- cout << "Creating a new buffer of size = " << size << endl;
+ SG_LOG(SG_EVENT, SG_DEBUG, "Creating a new buffer of size = " << size);
ptr = new char[size];
}
while ( size < s ) {
size *= 2;
}
- cout << "resizing buffer to size = " << size << endl;
+ SG_LOG(SG_EVENT, SG_DEBUG, "resizing buffer to size = " << size);
ptr = new char[size];
}
}
if ( (fp = gzopen( file.c_str(), "rb" )) == NULL ) {
string filegz = file + ".gz";
if ( (fp = gzopen( filegz.c_str(), "rb" )) == NULL ) {
- cout << "ERROR: opening " << file << " or " << filegz
- << "for reading!" << endl;
+ SG_LOG( SG_EVENT, SG_ALERT,
+ "ERROR: opening " << file << " or " << filegz << "for reading!");
return false;
}
local_tm = localtime( &calendar_time );
char time_str[256];
strftime( time_str, 256, "%a %b %d %H:%M:%S %Z %Y", local_tm);
- cout << "File created on " << time_str << endl;
+ SG_LOG( SG_EVENT, SG_DEBUG, "File created on " << time_str);
#endif
// read number of top level objects
return;
}
- cout << "[ 20%] allocating memory \r";
+ // cout << "[ 20%] allocating memory \r";
point = new double*[numPoints];
tmppoint = new double*[numPoints+3];
f[i] = _f[i];
}
- cout << "[ 30%] creating delaunay diagram \r";
+ // cout << "[ 30%] creating delaunay diagram \r";
Delaunay2D();
}
nts = 1; // number of triangles
i4 = 1;
- cout << "[ 40%] create triangulation \r";
+ // cout << "[ 40%] create triangulation \r";
// compute triangulation
for (i0 = 0; i0 < numPoints; i0++)
}
// count the number of triangles
- cout << "[ 50%] count the number of triangles \r";
+ // cout << "[ 50%] count the number of triangles \r";
numTriangles = 0;
i0 = -1;
}
// create the triangles
- cout << "[ 60%] create the triangles \r";
+ // cout << "[ 60%] create the triangles \r";
triangle = new Triangle[numTriangles];
}
// build edge table
- cout << "[ 70%] build the edge table \r";
+ // cout << "[ 70%] build the edge table \r";
numEdges = 0;
edge = new Edge[3*numTriangles];
int j, j0, j1;
for (i = 0; i < numTriangles; i++)
{
- if ( (i%500) == 0)
- cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r";
+ // if ( (i%500) == 0)
+ // cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r";
Triangle& t = triangle[i];
}
// establish links between adjacent triangles
- cout << "[ 80%] establishing links between adjacent triangles \r";
+ // cout << "[ 80%] establishing links between adjacent triangles \r";
for (i = 0; i < numEdges; i++)
{
delete[] ccr[0];
delete[] ccr;
- cout << "[ 90%] finsishes delauney triangulation \r";
+ // cout << "[ 90%] finsishes delauney triangulation \r";
return result;
}
// For complete spherical coverage, include the two antipodal points
// (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set.
- cout << "Initialising spherical interpolator.\n";
- cout << "[ 0%] Allocating memory \r";
+ // cout << "Initialising spherical interpolator.\n";
+ // cout << "[ 0%] Allocating memory \r";
theta = new double[3*n];
phi = new double[3*n];
}
// use periodicity to get wrap-around in the Delaunay triangulation
- cout << "[ 10%] copying vertices for wrap-around\r";
+ // cout << "[ 10%] copying vertices for wrap-around\r";
int j, k;
for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++)
{
pInterp = new mgcLinInterp2D<T>(3*n,theta,phi,func);
- cout << "[100%] Finished initialising spherical interpolator. \n";
+ // cout << "[100%] Finished initialising spherical interpolator. \n";
}
template<class T>
// Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n.
// For complete spherical coverage, include the two antipodal points
// (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set.
- cout << "Initialising spherical interpolator.\n";
- cout << "[ 0%] Allocating memory \r";
+ // cout << "Initialising spherical interpolator.\n";
+ // cout << "[ 0%] Allocating memory \r";
theta = new double[3*n];
phi = new double[3*n];
func = new T[3*n];
// convert data to spherical coordinates
- cout << "[ 10%] copying vertices for wrap-around \r";
+ // cout << "[ 10%] copying vertices for wrap-around \r";
int i, j, k;
for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++)
pInterp = new mgcLinInterp2D<T>(3*n,theta,phi,func);
- cout << "[100%] Finished initialising spherical interpolator. \n";
+ // cout << "[100%] Finished initialising spherical interpolator. \n";
}
//---------------------------------------------------------------------------
template<class T>
props_test_LDADD = libsgmisc.a ../xml/libsgxml.a ../debug/libsgdebug.a
tabbed_value_test_SOURCES = tabbed_values_test.cxx
-tabbed_value_test_LDADD = libsgmisc.a ../debug/libsgdebug.a
+tabbed_value_test_LDADD = libsgmisc.a ../xml/libsgxml.a ../debug/libsgdebug.a
INCLUDES = -I$(top_srcdir)
SGTabbedValues tv(string1);
- if (tv[0] != "Hello") {
+ if (tv[0] != string("Hello")) {
cerr << "failed to read string at index 0" << endl;
return 1;
}
- if (tv[1] != "World") {
+ if (tv[1] != string("World")) {
cerr << "failed to read string at index 1" << endl;
return 1;
}
- if (tv[2] != "34") {
+ if (tv[2] != string("34")) {
cerr << "failed to read string at index 2" << endl;
return 1;
}
return 3;
}
- if (tv[5] != "There Is No Spoon") {
+ if (tv[5] != string("There Is No Spoon")) {
cerr << "failed to read string at index 5 (got [" << tv[5] << "]" << endl;
return 1;
}
texSize = width * width;
if ( !sun_texbuf ) {
- cout << "ouch ..." << endl;
+ SG_LOG( SG_EVENT, SG_ALERT,
+ "Could not allocate memroy for the sun texture");
exit(-1); // Ugly!
}
#include <simgear/compiler.h>
+#include <simgear/debug/logstream.hxx>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>
-SG_USING_STD(cout);
-SG_USING_STD(endl);
-
// return a sphere object as an ssgBranch
ssgBranch *ssgMakeSphere( ssgSimpleState *state, ssgColourArray *cl,
new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, nl, tl, cl );
if ( vl->getNum() != nl->getNum() ) {
- cout << "bad sphere1" << endl;
+ SG_LOG( SG_EVENT, SG_ALERT, "bad sphere1");
exit(-1);
}
if ( vl->getNum() != tl->getNum() ) {
- cout << "bad sphere2" << endl;
+ SG_LOG( SG_EVENT, SG_ALERT, "bad sphere2");
exit(-1);
}
slice->setState( state );
#include <simgear/compiler.h>
+#include <simgear/debug/logstream.hxx>
#include <stdio.h>
#include STL_IOSTREAM
#include "stars.hxx"
-SG_USING_STD(cout);
-SG_USING_STD(endl);
-
// Set up star rendering call backs
static int sgStarPreDraw( ssgEntity *e ) {
ssgBranch * SGStars::build( int num, sgdVec3 *star_data, double star_dist ) {
sgVec4 color;
- if ( star_data == NULL ) {
- cout << "WARNING: null star data passed to SGStars::build()" << endl;
- }
+ if ( star_data == NULL )
+ SG_LOG( SG_EVENT, SG_WARN, "null star data passed to SGStars::build()");
+
// set up the orb state
state = new ssgSimpleState();
stars_transform->addKid( stars_obj );
- cout << "stars = " << stars_transform << endl;
+ SG_LOG( SG_EVENT, SG_INFO, "stars = " << stars_transform);
return stars_transform;
}
#include "serial.hxx"
-SG_USING_STD(cout);
-SG_USING_STD(endl);
-
FGSerialPort::FGSerialPort()
: dev_open(false)
{
struct termios config;
fd = open(device.c_str(), O_RDWR | O_NONBLOCK);
- cout << "Serial fd created = " << fd << endl;
+ SG_LOG( SG_EVENT, SG_DEBUG, "Serial fd created = " << fd);
if ( fd == -1 ) {
SG_LOG( SG_IO, SG_ALERT, "Cannot open " << device
cur_time = time(NULL);
}
- cout << "Current greenwich mean time = " << asctime(gmtime(&cur_time))
- << endl;
- cout << "Current local time = "
- << asctime(localtime(&cur_time)) << endl;
+ SG_LOG( SG_EVENT, SG_INFO,
+ "Current greenwich mean time = " << asctime(gmtime(&cur_time)));
+ SG_LOG( SG_EVENT, SG_INFO,
+ "Current local time = " << asctime(localtime(&cur_time)));
if ( !root.empty()) {
SGPath zone( root );