1 // Copyright (C) 2009 - 2012 Mathias Froehlich
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #ifndef HLAProxyDataElement_hxx
18 #define HLAProxyDataElement_hxx
20 #include <simgear/hla/HLADataElement.hxx>
24 class HLAProxyDataElement : public HLADataElement {
26 virtual ~HLAProxyDataElement()
29 virtual void accept(HLADataElementVisitor& visitor)
31 HLADataElement* dataElement = _getDataElement();
34 dataElement->accept(visitor);
36 virtual void accept(HLAConstDataElementVisitor& visitor) const
38 const HLADataElement* dataElement = _getDataElement();
41 dataElement->accept(visitor);
44 virtual bool encode(HLAEncodeStream& stream) const
46 const HLADataElement* dataElement = _getDataElement();
49 return dataElement->encode(stream);
51 virtual bool decode(HLADecodeStream& stream)
53 HLADataElement* dataElement = _getDataElement();
56 return dataElement->decode(stream);
59 virtual const HLADataType* getDataType() const
61 const HLADataElement* dataElement = _getDataElement();
64 return dataElement->getDataType();
66 virtual bool setDataType(const HLADataType* dataType)
68 HLADataElement* dataElement = _getDataElement();
71 return dataElement->setDataType(dataType);
75 virtual HLADataElement* _getDataElement() = 0;
76 virtual const HLADataElement* _getDataElement() const = 0;
78 virtual void _setStamp(Stamp* stamp)
80 HLADataElement::_setStamp(stamp);
81 HLADataElement* dataElement = _getDataElement();
84 dataElement->attachStamp(*this);