chore(include): changed include files from .h to .hpp
[KDIS.git] / include / KDIS / DataTypes / GridData.hpp
blob86354db8eec0364afe054d0cd4ca39243216c495
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: GridData
32 created: 18/11/2009
33 author: Karl Jones
35 purpose: This is the base class for all grid daya types 0, 1 and 2.
36 The data representation type value can be used to determine
37 the correct grid data type.
38 size: 32 bits / 4 octets
39 *********************************************************************/
41 #pragma once
43 #include "./DataTypeBase.h"
45 namespace KDIS {
46 namespace DATA_TYPE {
48 class KDIS_EXPORT GridData : public DataTypeBase
50 protected:
52 KUINT16 m_ui16SmpTyp;
54 KUINT16 m_ui16DtRep;
56 public:
58 static const KUINT16 GRID_DATA_SIZE = 4;
60 GridData();
62 GridData( KDataStream & stream ) ;
64 virtual ~GridData();
66 //************************************
67 // FullName: KDIS::DATA_TYPE::GridData::SetSampleType
68 // KDIS::DATA_TYPE::GridData::GetSampleType
69 // Description: Specifies the environmental data sample contained in
70 // the PDU (e.g. u-comconent of wind).
71 // Parameter: KUINT16 ST, void
72 //************************************
73 void SetSampleType( KUINT16 ST );
74 KUINT16 GetSampleType() const;
76 //************************************
77 // FullName: KDIS::DATA_TYPE::GridData::GetDataRepresentation
78 // Description: Specifies the value that describes the data representation method
79 // for the environmental state variable data contained within the Data
80 // Values fields of this record. Use this value to know what type you should up cast to.
81 // E.G if the value was 1 then you would upcast to a "GridDataType1" to get access to the data.
82 //************************************
83 KDIS::DATA_TYPE::ENUMS::GridDataRepresentation GetDataRepresentation() const;
85 //************************************
86 // FullName: KDIS::DATA_TYPE::GridData::GetDataRepresentation
87 // Description: Returns size of Grid Data in octets.
88 // Note this information is not encoded into the PDU.
89 //************************************
90 virtual KUINT16 GetSize() const = 0;
92 //************************************
93 // FullName: KDIS::DATA_TYPE::GridData::GetAsString
94 // Description: Returns a string representation
95 //************************************
96 virtual KString GetAsString() const;
98 //************************************
99 // FullName: KDIS::DATA_TYPE::GridData::Decode
100 // Description: Convert From Network Data.
101 // Parameter: KDataStream & stream
102 //************************************
103 virtual void Decode( KDataStream & stream ) ;
105 //************************************
106 // FullName: KDIS::DATA_TYPE::GridData::Encode
107 // Description: Convert To Network Data.
108 // Parameter: KDataStream & stream
109 //************************************
110 virtual KDataStream Encode() const;
111 virtual void Encode( KDataStream & stream ) const;
113 KBOOL operator == ( const GridData & Value ) const;
114 KBOOL operator != ( const GridData & Value ) const;
117 } // END namespace DATA_TYPES
118 } // END namespace KDIS