KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minefield_Header.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
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.
13 
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.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: Minefield_Header
32  DIS: (6) 1278.1a - 1998
33  created: 13/04/2010
34  author: Karl Jones
35 
36  purpose: Contains common attributes for all minefield PDU.
37 
38  size: 144 bits / 18 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./../Header.h"
44 #include "./../../DataTypes/EntityIdentifier.h"
45 
46 namespace KDIS {
47 namespace PDU {
48 
50 {
51 protected:
52 
54 
55 public:
56 
57  static const KUINT16 MINEFIELD_HEADER_SIZE = 18;
58 
60 
61  Minefield_Header( const Header & H );
62 
63  Minefield_Header( KDataStream & stream ) throw( KException );
64 
65  Minefield_Header( const Header & H, KDataStream & stream ) throw( KException );
66 
67  virtual ~Minefield_Header();
68 
69  //************************************
70  // FullName: KDIS::PDU::Minefield_Header::SetMinefieldID
71  // KDIS::PDU::Minefield_Header::GetMinefieldID
72  //!Description: The Minefield Identifier (Minefield ID) does not represent an entity but
73  //! rather an aggregation of mine entities for the purpose of conserving bandwidth.
74  // Parameter: const EntityIdentifier & ID
75  //************************************
76  void SetMinefieldID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
77  const KDIS::DATA_TYPE::EntityIdentifier & GetMinefieldID() const;
78  KDIS::DATA_TYPE::EntityIdentifier & GetMinefieldID();
79 
80  //************************************
81  // FullName: KDIS::PDU::Minefield_Header::GetAsString
82  //!Description: Returns a string representation of the PDU
83  //************************************
84  virtual KString GetAsString() const;
85 
86  //************************************
87  // FullName: KDIS::PDU::Minefield_Header::Decode
88  //!Description: Convert From Network Data.
89  // Parameter: KDataStream & stream
90  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
91  //************************************
92  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
93 
94  //************************************
95  // FullName: KDIS::PDU::Minefield_Header::Encode
96  //!Description: Convert To Network Data.
97  // Parameter: KDataStream & stream
98  //************************************
99  virtual KDataStream Encode() const;
100  virtual void Encode( KDataStream & stream ) const;
101 
102  KBOOL operator == ( const Minefield_Header & Value ) const;
103  KBOOL operator != ( const Minefield_Header & Value ) const;
104 };
105 
106 } // END namespace PDU
107 } // END namespace KDIS
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
Definition: Minefield_Header.h:49
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
KDIS::DATA_TYPE::EntityIdentifier m_MinefieldID
Definition: Minefield_Header.h:53
Definition: Header7.h:142
#define KDIS_EXPORT
Definition: KDefines.h:82