nidas v1.2.3
DOMable.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 ** 2004, 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
27#ifndef NIDAS_CORE_DOMABLE_H
28#define NIDAS_CORE_DOMABLE_H
29
31
32#include "DOMObjectFactory.h"
33#include "XDOM.h"
34#include "XMLStringConverter.h"
35
36#include <xercesc/util/XMLUniDefs.hpp>
37#include <xercesc/util/XMLString.hpp>
38#include <xercesc/dom/DOMDocument.hpp>
39#include <xercesc/dom/DOMNode.hpp>
40#include <xercesc/dom/DOMElement.hpp>
41#include <xercesc/dom/DOMException.hpp>
42#include <xercesc/dom/DOMNamedNodeMap.hpp>
43
44namespace nidas { namespace core {
45
51class DOMable {
52public:
53
57 virtual ~DOMable() {}
58
64 virtual void fromDOMElement(const xercesc::DOMElement*) = 0;
65
71 virtual xercesc::DOMElement*
72 toDOMParent(xercesc::DOMElement* parent, bool complete) const;
73
79 virtual xercesc::DOMElement*
80 toDOMElement(xercesc::DOMElement* node, bool complete) const;
81
82 static const XMLCh* getNamespaceURI() {
84 xercesc::XMLString::transcode(
85 "http://www.eol.ucar.edu/nidas");
86 return namespaceURI;
87 }
88
89private:
90 static XMLCh* namespaceURI;
91
92};
93
94}} // namespace nidas namespace core
95
154#define NIDAS_CREATOR_FUNCTION(CLASSNAME) \
155extern "C" {\
156 nidas::core::DOMable* create_nidas_dynld_##CLASSNAME()\
157 {\
158 return new nidas::dynld::CLASSNAME();\
159 }\
160}
161
168#define NIDAS_CREATOR_FUNCTION_NS(NS,CLASSNAME) \
169extern "C" {\
170 nidas::core::DOMable* create_nidas_dynld_##NS##_##CLASSNAME()\
171 {\
172 return new nidas::dynld::NS::CLASSNAME();\
173 }\
174}
175
176#endif
Interface of an object that can be instantiated from a DOM element, via the fromDOMElement method,...
Definition DOMable.h:51
virtual xercesc::DOMElement * toDOMParent(xercesc::DOMElement *parent, bool complete) const
Create a DOMElement and append it to the parent.
Definition DOMable.cc:41
virtual void fromDOMElement(const xercesc::DOMElement *)=0
Initialize myself from a xercesc::DOMElement.
static XMLCh * namespaceURI
Definition DOMable.h:90
virtual xercesc::DOMElement * toDOMElement(xercesc::DOMElement *node, bool complete) const
Add my content into a DOMElement.
Definition DOMable.cc:58
static const XMLCh * getNamespaceURI()
Definition DOMable.h:82
virtual ~DOMable()
Virtual destructor.
Definition DOMable.h:57
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31