KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Transfer_Control_Request_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: Transfer_Control_Request_PDU
32  DIS: (6) 1278.1A - 1998
33  created: 2009/03/14
34  author: Karl Jones
35 
36  purpose: Contains information initiating the dynamic allocation and
37  control of simulation entities between two simulation applications.
38 
39  Note: Also known as Transfer Ownership PDU.
40 
41  size: 320 bits / 40 octets - min size
42 *********************************************************************/
43 
44 #pragma once
45 
46 #include "./../Simulation_Management/Simulation_Management_Header.h"
47 #include "./../../DataTypes/RecordSet.h"
48 
49 namespace KDIS {
50 namespace PDU {
51 
56 using std::vector;
57 
59 {
60 protected:
61 
63 
65 
67 
69 
71 
72  std::vector<KDIS::DATA_TYPE::RecordSet> m_vRecs;
73 
74 public:
75 
76  static const KUINT16 TRANSFER_CONTROL_REQUEST_PDU_SIZE = 40; // Min size
77 
79 
81 
82  Transfer_Control_Request_PDU( const Header & H, KDataStream & stream ) throw( KException );
83 
85  const KDIS::DATA_TYPE::EntityIdentifier & TrnsEntID );
86 
88 
89  //************************************
90  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::SetRequestID
91  // KDIS::PDU::Transfer_Control_Request_PDU::GetRequestID
92  //!Description: Identifies the transfer of control request being requested.
93  // Parameter: KUINT32 ID
94  //************************************
95  void SetRequestID( KUINT32 ID );
96  KUINT32 GetRequestID() const;
97 
98  //************************************
99  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::SetRequiredReliabilityService
100  // KDIS::PDU::Transfer_Control_Request_PDU::GetRequiredReliabilityService
101  //!Description: specifies the required level of reliability service to be
102  //! used for this transaction/PDU.
103  // Parameter: RequiredReliabilityService RRS
104  //************************************
105  void SetRequiredReliabilityService( KDIS::DATA_TYPE::ENUMS::RequiredReliabilityService RRS );
106  KDIS::DATA_TYPE::ENUMS::RequiredReliabilityService GetRequiredReliabilityService() const;
107 
108  //************************************
109  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::SetTransferType
110  // KDIS::PDU::Transfer_Control_Request_PDU::GetTransferType
111  //!Description: Type of transfer desired.
112  // Parameter: TransferType TT
113  //************************************
114  void SetTransferType( KDIS::DATA_TYPE::ENUMS::TransferType TT );
115  KDIS::DATA_TYPE::ENUMS::TransferType GetTransferType() const;
116 
117  //************************************
118  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::SetTransferEntityID
119  // KDIS::PDU::Transfer_Control_Request_PDU::GetTransferEntityID
120  //!Description: Identifies the entity for which control is being
121  //! requested to transfer.
122  // Parameter: const EntityIdentifier & ID
123  //************************************
124  void SetTransferEntityID( const KDIS::DATA_TYPE::EntityIdentifier & ID );
125  const KDIS::DATA_TYPE::EntityIdentifier & GetTransferEntityID() const;
126  KDIS::DATA_TYPE::EntityIdentifier & GetTransferEntityID();
127 
128  //************************************
129  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::GetNumberOfRecords
130  //!Description: Returns number of records.
131  //************************************
132  KUINT32 GetNumberOfRecords() const;
133 
134  //************************************
135  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::AddRecordSet
136  // KDIS::PDU::Transfer_Control_Request_PDU::SetRecordSets
137  // KDIS::PDU::Transfer_Control_Request_PDU::GetRecordSets
138  //!Description:
139  // Parameter: const RecordSet & RS, vector<RecordSet> & RC
140  //************************************
141  void AddRecordSet( const KDIS::DATA_TYPE::RecordSet & RS );
142  void SetRecordSets( const std::vector<KDIS::DATA_TYPE::RecordSet> & RS );
143  const std::vector<KDIS::DATA_TYPE::RecordSet> & GetRecordSets() const;
144 
145  //************************************
146  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::GetAsString
147  //!Description: Returns a string representation of the PDU.
148  //************************************
149  virtual KString GetAsString() const;
150 
151  //************************************
152  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::Decode
153  //!Description: Convert From Network Data.
154  // Parameter: KDataStream & stream
155  // Parameter: bool ignoreHeader = false - Decode the header from the stream?
156  //************************************
157  virtual void Decode( KDataStream & stream, bool ignoreHeader = false ) throw( KException );
158 
159  //************************************
160  // FullName: KDIS::PDU::Transfer_Control_Request_PDU::Encode
161  //!Description: Convert To Network Data.
162  // Parameter: KDataStream & stream
163  //************************************
164  virtual KDataStream Encode() const;
165  virtual void Encode( KDataStream & stream ) const;
166 
167  KBOOL operator == ( const Transfer_Control_Request_PDU & Value ) const;
168  KBOOL operator != ( const Transfer_Control_Request_PDU & Value ) const;
169 };
170 
171 } // END namespace PDU
172 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
Definition: Simulation_Management_Header.h:48
KUINT32 m_ui32ReqID
Definition: Transfer_Control_Request_PDU.h:62
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT8 m_ui8ReqRelSrv
Definition: Transfer_Control_Request_PDU.h:64
RequiredReliabilityService
Definition: EnumSimulationManagement.h:64
Definition: Transfer_Control_Request_PDU.h:58
Definition: KDefines.h:182
Definition: KDataStream.h:48
KUINT8 m_ui8TrnTyp
Definition: Transfer_Control_Request_PDU.h:66
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
std::vector< KDIS::DATA_TYPE::RecordSet > m_vRecs
Definition: Transfer_Control_Request_PDU.h:72
Definition: RecordSet.h:47
Definition: Header7.h:142
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
KUINT32 m_ui32NumRecSets
Definition: Transfer_Control_Request_PDU.h:70
KDIS::DATA_TYPE::EntityIdentifier m_TrnsEntID
Definition: Transfer_Control_Request_PDU.h:68
TransferType
Definition: EnumEntityManagement.h:144