KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Resupply_Received_PDU.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: Resupply_Received_PDU
32  DIS: (5) 1278.1 - 1995
33  created: 2008/09/22
34  author: Karl Jones
35 
36  purpose: Resupply Received PDU
37  Size: 224 bits / 28 octets + ( 96 bits / 12 octets * ( number of supplies ) )
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./Logistics_Header.h"
43 #include "./../../DataTypes/Supplies.h"
44 
45 namespace KDIS {
46 namespace PDU {
47 
49 {
50 protected:
51 
53 
55 
57 
58  std::vector<KDIS::DATA_TYPE::Supplies> m_vSupplies;
59 
60 public:
61 
62  static const KUINT16 RESUPPLY_RECEIVED_PDU_SIZE = 28; // Does not include supply size
63 
65 
66  Resupply_Received_PDU( const Header & H );
67 
68  Resupply_Received_PDU( KDataStream & stream ) throw( KException );
69 
70  Resupply_Received_PDU( const Header & H, KDataStream & stream ) throw( KException );
71 
72  Resupply_Received_PDU( const KDIS::DATA_TYPE::EntityIdentifier & ReceivingEntity, const KDIS::DATA_TYPE::EntityIdentifier & SupplyingEntity );
73 
74  virtual ~Resupply_Received_PDU();
75 
76  //************************************
77  // FullName: KDIS::PDU::Resupply_Received_PDU::SetNumberOfSupplyTypes
78  // KDIS::PDU::Resupply_Received_PDU::GetNumberOfSupplyTypes
79  //!Description: How many supplies are being provided.
80  //! This value is calculated automatically by
81  //! the number of supplies, only change
82  //! if you know what you are doing
83  // Parameter: KUINT8 UI, void
84  //************************************
85  void SetNumberOfSupplyTypes( KUINT8 UI );
86  KUINT8 GetNumberOfSupplyTypes() const;
87 
88  //************************************
89  // FullName: KDIS::PDU::Resupply_Received_PDU::AddSupply
90  // KDIS::PDU::Resupply_Received_PDU::SetSupplies
91  // KDIS::PDU::Resupply_Received_PDU::GetSupplies
92  //!Description: Add a supply, updates Number Of Supply Types and
93  //! PDU size fields automatically.
94  // Parameter: const Supplies & S, void
95  //************************************
96  void AddSupply( const KDIS::DATA_TYPE::Supplies & S );
97  void SetSupplies( const std::vector<KDIS::DATA_TYPE::Supplies> & S );
98  std::vector<KDIS::DATA_TYPE::Supplies> GetSupplies() const;
99 
100  //************************************
101  // FullName: KDIS::PDU::Resupply_Received_PDU::GetAsString
102  //!Description: Returns a string representation of the PDU.
103  //************************************
104  virtual KString GetAsString() const;
105 
106  //************************************
107  // FullName: KDIS::PDU::Resupply_Received_PDU::Decode
108  //!Description: Convert From Network Data.
109  // Parameter: KDataStream & stream
110  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
111  //************************************
112  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
113 
114  //************************************
115  // FullName: KDIS::PDU::Resupply_Received_PDU::Encode
116  //!Description: Convert To Network Data.
117  // Parameter: KDataStream & stream
118  //************************************
119  virtual KDataStream Encode() const;
120  virtual void Encode( KDataStream & stream ) const;
121 
122  KBOOL operator == ( const Resupply_Received_PDU & Value ) const;
123  KBOOL operator != ( const Resupply_Received_PDU & Value ) const;
124 };
125 
126 } // END namespace PDU
127 } // END namespace KDIS
KUINT16 m_ui16Padding1
Definition: Resupply_Received_PDU.h:54
KUINT8 m_ui8NumSupplyTypes
Definition: Resupply_Received_PDU.h:52
std::vector< KDIS::DATA_TYPE::Supplies > m_vSupplies
Definition: Resupply_Received_PDU.h:58
Definition: Resupply_Received_PDU.h:48
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
KUINT8 m_ui8Padding2
Definition: Resupply_Received_PDU.h:56
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
Definition: Supplies.h:46
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
Definition: Logistics_Header.h:48
#define KDIS_EXPORT
Definition: KDefines.h:82