nidas  v1.2-1520
StatusHandler.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2005, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 #ifndef NIDAS_CORE_STATUSHANDLER_H
27 #define NIDAS_CORE_STATUSHANDLER_H
28 
29 #include <xercesc/sax2/XMLReaderFactory.hpp> // provides SAX2XMLReader
30 #include <xercesc/sax2/DefaultHandler.hpp>
31 #include <nidas/util/Exception.h>
32 #include <string>
33 
34 namespace nidas { namespace core {
35 
36 class StatusListener;
37 
41 class StatusHandler:public xercesc::DefaultHandler
42 {
43 public:
45  _listener(lstn), _element(NONE),_src()
46  {
47  }
48 
49  // -----------------------------------------------------------------------
50  // Implementations of the SAX ErrorHandler interface
51  // -----------------------------------------------------------------------
52  void warning(const xercesc::SAXParseException & exc);
53  void error(const xercesc::SAXParseException & exc);
54  void fatalError(const xercesc::SAXParseException & exc);
55 
56  // -----------------------------------------------------------------------
57  // Implementations of the SAX DocumentHandler interface
58  // -----------------------------------------------------------------------
59  void startElement(const XMLCh * const uri,
60  const XMLCh * const localname,
61  const XMLCh * const qname,
62  const xercesc::Attributes & attributes);
63 
64  void endElement(const XMLCh * const uri,
65  const XMLCh * const localname,
66  const XMLCh * const qname);
67 
68  void characters(const XMLCh * const chars,
69 #if XERCES_VERSION_MAJOR < 3
70  const unsigned int length);
71 #else
72  const XMLSize_t length);
73 #endif
74 
76 
77 private:
78 
81 
83 
85  std::string _src;
86 
89 
92 };
93 
94 }} // namespace nidas namespace core
95 
96 #endif
Definition: StatusHandler.h:75
void fatalError(const xercesc::SAXParseException &exc)
Definition: StatusHandler.cc:61
Definition: StatusHandler.h:75
std::string _src
host name of socket source
Definition: StatusHandler.h:85
This class implements handling routines for the SAX2 parser.
Definition: StatusHandler.h:41
Definition: StatusHandler.h:75
enum elementType _element
Definition: StatusHandler.h:82
StatusListener * _listener
reference to listener thread
Definition: StatusHandler.h:80
void error(const xercesc::SAXParseException &exc)
Definition: StatusHandler.cc:53
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const xercesc::Attributes &attributes)
Definition: StatusHandler.cc:73
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
Definition: StatusHandler.cc:96
StatusHandler & operator=(const StatusHandler &)
No assignment.
StatusHandler(StatusListener *lstn)
Definition: StatusHandler.h:44
void characters(const XMLCh *const chars, const unsigned int length)
Definition: StatusHandler.cc:103
Definition: StatusHandler.h:75
thread that listens to multicast messages from all of the DSMs.
Definition: StatusListener.h:45
void warning(const xercesc::SAXParseException &exc)
Definition: StatusHandler.cc:45
elementType
Definition: StatusHandler.h:75
Definition: StatusHandler.h:75