casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLSupport.h
Go to the documentation of this file.
1 //# GLSupport.h: GLLogIO and a couple support routines.
2 //# Copyright (C) 2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 // <summary>
29 // Support functions for GLPixelCanvas.
30 // </summary>
31 // <synopsis>
32 // The GLLogIO class extends the casacore::LogIO class to add tracing support.
33 // Also, a couple of miscellaneous support routines are defined.
34 // </synopsis>
35 // <prerequisite>
36 // <li> <linkto class="casacore::LogIO">casacore::LogIO</linkto>
37 // </prerequisite>
38 // <use visibility=local>
39 //
40 // <thrown>
41 // None
42 // </thrown>
43 //
44 
45 #ifndef TRIALDISPLAY_GLSUPPORT_H
46 #define TRIALDISPLAY_GLSUPPORT_H
47 
48 #include <casa/aips.h>
49 #include <casa/Logging/LogIO.h>
50 #include <casa/BasicSL/String.h>
51 
52 namespace casa { //# NAMESPACE CASA - BEGIN
53 
54 // GLLogIO adds tracing support to the AIPS++ casacore::LogIO object.
55  class GLLogIO : public casacore::LogIO {
56  public:
57  GLLogIO();
58  virtual ~GLLogIO();
59  // Print tracing information. Also calls glcheck.
60  // This is the main use for GLLogIO.
61  // nspaces is the number of spaces to indent name and any errors.
62  // If errorsonly is true, don't print anything if there are no
63  // errors.
64  void trace(const char *name, int nspaces, casacore::Bool errorsonly=false);
65 
66  // Append a line to buffer then add a newline.
67  // msg is indented by nspaces spaces. msg may contain newline
68  // characters.
69  void append(const char *msg, casacore::uInt nspaces=0);
70  // Adds nspaces to buffer.
71  void indent(casacore::uInt nspaces=0);
72  // Deletes current buffer contents.
73  void clear();
74  // Copies any current OpenGL error messages to internal buffer.
75  int glcheck(casacore::uInt nspaces);
76 
77  // Logging to standard AIPS++ disrupts trace formatting. These
78  // routines allow redirecting or delaying output.
79  // NOTE: There is only 1 instance of the use iostream flag or String
80  // for all instances of GLLogIO.
81 
82  // Post messages to an iostream instead of casacore::LogIO object.
83  static void postToStream(casacore::Bool useStream=false);
84 
85  // Post messages to str for later use. Disables if NULL.
86  // If str is non NULL, no output is done until postString is called.
87  // Replacing an existing string does not cause the existing string
88  // to be posted.
89  static void postToString(casacore::String *str=NULL);
90 
91  // If an output string exists, copy it to an output stream if
92  // it exists. If the output stream doesn't exist, copy it to
93  // the casacore::LogIO object. The string is then cleared.
94  // Ignore if the string doesn't exist.
95  void postString();
96  // Copy string to either output stream or casacore::LogIO object. The string
97  // is not cleared.
98  void postString(const casacore::String &str);
99  // Copy internal buffer to output. Then clear internal buffer.
100  void post();
101  private:
102  private:
106  };
107 
113  };
114 
115 // Convert various OpenGL constants to their string representations.
116  const char *GLbufferToString(int b);
117  const char *GLformatToString(GLenum format);
118 // Given a glPushAttrib argument, append the string with the arg's
119 // string representation.
120  void GLAttribToString(GLbitfield bits, casacore::String &str);
121 
122 //const char *GLtypeToString(GLenum type);
123 
124 } //# NAMESPACE CASA - END
125 
126 #endif
void postString()
If an output string exists, copy it to an output stream if it exists.
void trace(const char *name, int nspaces, casacore::Bool errorsonly=false)
Print tracing information.
static casacore::Bool postToStream_
Definition: GLSupport.h:104
static void postToString(casacore::String *str=NULL)
Post messages to str for later use.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
void GLAttribToString(GLbitfield bits, casacore::String &str)
Given a glPushAttrib argument, append the string with the arg&#39;s string representation.
void post()
Copy internal buffer to output.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void append(const char *msg, casacore::uInt nspaces=0)
Append a line to buffer then add a newline.
static void postToStream(casacore::Bool useStream=false)
Logging to standard AIPS++ disrupts trace formatting.
GLTraceLevel
Definition: GLSupport.h:108
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
int glcheck(casacore::uInt nspaces)
Copies any current OpenGL error messages to internal buffer.
void clear()
Deletes current buffer contents.
static casacore::String * ostring_
Definition: GLSupport.h:105
void indent(casacore::uInt nspaces=0)
Adds nspaces to buffer.
const char * GLbufferToString(int b)
Convert various OpenGL constants to their string representations.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const char * GLformatToString(GLenum format)
casacore::String buffer_
Definition: GLSupport.h:103
GLLogIO adds tracing support to the AIPS++ casacore::LogIO object.
Definition: GLSupport.h:55
unsigned int uInt
Definition: aipstype.h:51
virtual ~GLLogIO()