1 // Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Library 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.
18 #ifndef HLAArrayDataType_hxx
19 #define HLAArrayDataType_hxx
22 #include <simgear/structure/SGSharedPtr.hxx>
23 #include "HLADataType.hxx"
27 class HLAAbstractArrayDataElement;
29 class HLAArrayDataType : public HLADataType {
31 HLAArrayDataType(const std::string& name = "HLAArrayDataType");
32 virtual ~HLAArrayDataType();
34 virtual void accept(HLADataTypeVisitor& visitor) const;
36 virtual const HLAArrayDataType* toArrayDataType() const;
38 virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const = 0;
39 virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const = 0;
41 void setElementDataType(const HLADataType* elementDataType);
42 const HLADataType* getElementDataType() const
43 { return _elementDataType.get(); }
46 SGSharedPtr<const HLADataType> _elementDataType;
49 class HLAFixedArrayDataType : public HLAArrayDataType {
51 HLAFixedArrayDataType(const std::string& name = "HLAFixedArrayDataType");
52 virtual ~HLAFixedArrayDataType();
54 virtual void accept(HLADataTypeVisitor& visitor) const;
56 virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const;
57 virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const;
59 void setNumElements(unsigned numElements)
60 { _numElements = numElements; }
61 unsigned getNumElements() const
62 { return _numElements; }
65 unsigned _numElements;
68 class HLAVariableArrayDataType : public HLAArrayDataType {
70 HLAVariableArrayDataType(const std::string& name = "HLAVariableArrayDataType");
71 virtual ~HLAVariableArrayDataType();
73 virtual void accept(HLADataTypeVisitor& visitor) const;
75 virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const;
76 virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const;
78 void setSizeDataType(const HLADataType* sizeDataType);
79 const HLADataType* getSizeDataType() const
80 { return _sizeDataType.get(); }
83 SGSharedPtr<const HLADataType> _sizeDataType;
86 } // namespace simgear