1 /*********************************************************************
2 Copyright 2013 Karl Jones
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
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: PerimeterPointCoordinate
35 purpose: The location of each perimeter point, relative to the Minefield Location field.
36 size: 64 bits / 8 octets
37 *********************************************************************/
41 #include "./DataTypeBase.h"
46 class KDIS_EXPORT PerimeterPointCoordinate
: public DataTypeBase
56 static const KUINT16 PERIMETER_POINT_COORDINATE_SIZE
= 8;
58 PerimeterPointCoordinate();
60 PerimeterPointCoordinate( KFLOAT32 X
, KFLOAT32 Y
);
62 PerimeterPointCoordinate( KDataStream
& stream
) ;
64 virtual ~PerimeterPointCoordinate();
66 //************************************
67 // FullName: KDIS::DATA_TYPE::PerimeterPointCoordinate::SetX
68 // KDIS::DATA_TYPE::PerimeterPointCoordinate::GetX
69 // Description: First Value / X
70 // Parameter: KFLOAT32 X, void
71 //************************************
72 void SetX( KFLOAT32 X
);
73 KFLOAT32
GetX() const;
75 //************************************
76 // FullName: KDIS::DATA_TYPE::PerimeterPointCoordinate::SetY
77 // KDIS::DATA_TYPE::PerimeterPointCoordinate::GetY
78 // Description: Second Value / Y
79 // Parameter: KFLOAT32 Y, void
80 //************************************
81 void SetY( KFLOAT32 Y
);
82 KFLOAT32
GetY() const;
84 //************************************
85 // FullName: KDIS::DATA_TYPE::PerimeterPointCoordinate::GetAsString
86 // Description: Returns a string representation
87 //************************************
88 virtual KString
GetAsString() const;
90 //************************************
91 // FullName: KDIS::DATA_TYPE::PerimeterPointCoordinate::Decode
92 // Description: Convert From Network Data.
93 // Parameter: KDataStream & stream
94 //************************************
95 virtual void Decode( KDataStream
& stream
) ;
97 //************************************
98 // FullName: KDIS::DATA_TYPE::PerimeterPointCoordinate::Encode
99 // Description: Convert To Network Data.
100 // Parameter: KDataStream & stream
101 //************************************
102 virtual KDataStream
Encode() const;
103 virtual void Encode( KDataStream
& stream
) const;
105 KBOOL
operator == ( const PerimeterPointCoordinate
& Value
) const;
106 KBOOL
operator != ( const PerimeterPointCoordinate
& Value
) const;
108 // Valid values 0 - X, 1 - Y. throws OUT_OF_BOUNDS exception for any other value.
109 KFLOAT32
& operator[] ( KUINT16 i
) ;
110 const KFLOAT32
& operator[] ( KUINT16 i
) const ;
113 } // END namespace DATA_TYPES
114 } // END namespace KDIS