source: trunk/external/atnf/PKSIO/PKSmsg.h@ 1631

Last change on this file since 1631 was 1452, checked in by Malte Marquarding, 16 years ago

update from livedata CVS

File size: 2.9 KB
RevLine 
[1452]1//#---------------------------------------------------------------------------
2//# PKSmsg.h: Message handling for the PKSIO classes.
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2008
5//# Associated Universities, Inc. Washington DC, USA.
6//#
7//# This library is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU Library General Public License as published by
9//# the Free Software Foundation; either version 2 of the License, or (at your
10//# option) any later version.
11//#
12//# This library is distributed in the hope that it will be useful, but WITHOUT
13//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15//# License for more details.
16//#
17//# You should have received a copy of the GNU Library General Public License
18//# along with this library; if not, write to the Free Software Foundation,
19//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning AIPS++ should be addressed as follows:
22//# Internet email: aips2-request@nrao.edu.
23//# Postal address: AIPS++ Project Office
24//# National Radio Astronomy Observatory
25//# 520 Edgemont Road
26//# Charlottesville, VA 22903-2475 USA
27//#
28//# $Id: PKSmsg.h,v 1.2 2008-11-17 06:42:36 cal103 Exp $
29//#---------------------------------------------------------------------------
30//# Original: 2008/09/18, Mark Calabretta, ATNF
31//#---------------------------------------------------------------------------
32
33#ifndef ATNF_PKSMSG_H
34#define ATNF_PKSMSG_H
35
36#include <casa/stdio.h>
37
38using namespace std;
39
40// <summary>
41// Message handling for the PKSIO classes.
42// </summary>
43
44class PKSmsg
45{
46 public:
47 // Constructor.
48 PKSmsg();
49
50 // Destructor.
51 virtual ~PKSmsg();
52
53 // Set message disposition. If fd is non-zero messages will be written
54 // to that file descriptor, else stored for retrieval by getMsg().
55 virtual int setMsg(
56 FILE *fd = 0x0);
57
58 // Log a message.
59 virtual void logMsg(const char *msg = 0x0);
60
61 // Get a message string, or 0x0 if there is none. The null-terminated
62 // message string may contain embedded newline characters and will have
63 // a trailing newline.
64 const char *getMsg();
65
66 // Get the next group of messages by type: ERROR, WARNING, or otherwise.
67 // The null-terminated message string may contain embedded newline
68 // characters but will NOT have a trailing newline. Call this repeatedly
69 // to unwind the message stack (otherwise messages may be lost).
70 enum msgType {NORMAL, WARNING, ERROR};
71 const char *getMsg(msgType &type);
72
73 // Clear the message buffer.
74 void clearMsg(void);
75
76 protected:
77 // Initialize messaging.
78 void initMsg();
79
80 private:
81 // For messaging.
82 char *cMsgBuff, *cMsgIdx;
83 int cMsgLen, cNMsg;
84 FILE *cMsgFD;
85};
86
87#endif
Note: See TracBrowser for help on using the repository browser.