KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CommunicationsNodeID.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: CommunicationsNodeID
32  created: 04/12/2010
33  author: Karl Jones
34 
35  purpose: The identification of a communications node is conveyed using
36  the Communications Node ID record.
37  The combination of Entity ID and Element ID uniquely identify
38  an IO communications node within a simulation exercise.
39 
40  size: 64 bits / 8 octets
41 *********************************************************************/
42 
43 #pragma once
44 
45 #include "./EntityIdentifier.h"
46 
47 namespace KDIS {
48 namespace DATA_TYPE {
49 
51 {
52 protected:
53 
55 
56 public:
57 
58  static const KUINT16 COMMUNICATIONS_NODE_ID_SIZE = 8;
59 
61 
62  CommunicationsNodeID( KDataStream & stream ) throw( KException );
63 
64  CommunicationsNodeID( KUINT16 Site, KUINT16 App, KUINT16 Obj, KUINT16 Element );
65 
66  CommunicationsNodeID( const SimulationIdentifier & SimID, KUINT16 Obj, KUINT16 Element );
67 
68  CommunicationsNodeID( const EntityIdentifier & EntID, KUINT16 Element );
69 
70  virtual ~CommunicationsNodeID();
71 
72  //************************************
73  // FullName: KDIS::DATA_TYPE::CommunicationsNodeID::SetElementID
74  // KDIS::DATA_TYPE::CommunicationsNodeID::GetElementID
75  //!Description: Identifies a particular communications element (e.g. radio,
76  //! network component, or modem) within a given entity.
77  //! If this element is a radio for which a Transmitter PDU
78  //! is being issued, this value shall correspond to the Radio
79  //! ID in that PDU.
80  // Parameter: KUINT16 ID, void
81  //************************************
82  void SetElementID( KUINT16 ID );
83  KUINT16 GetElementID() const;
84 
85  //************************************
86  // FullName: KDIS::DATA_TYPE::CommunicationsNodeID::GetAsString
87  //!Description: Returns a string representation.
88  //************************************
89  virtual KString GetAsString() const;
90 
91  //************************************
92  // FullName: KDIS::DATA_TYPE::CommunicationsNodeID::Decode
93  //!Description: Convert From Network Data.
94  // Parameter: KDataStream & stream
95  //************************************
96  virtual void Decode( KDataStream & stream ) throw( KException );
97 
98  //************************************
99  // FullName: KDIS::DATA_TYPE::CommunicationsNodeID::Encode
100  //!Description: Convert To Network Data.
101  // Parameter: KDataStream & stream
102  //************************************
103  virtual KDataStream Encode() const;
104  virtual void Encode( KDataStream & stream ) const;
105 
106  KBOOL operator == ( const CommunicationsNodeID & Value ) const;
107  KBOOL operator != ( const CommunicationsNodeID & Value ) const;
108 };
109 
110 } // END namespace DATA_TYPES
111 } // END namespace KDIS
Definition: SimulationIdentifier.h:51
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
Definition: CommunicationsNodeID.h:50
KUINT16 m_ui16ElementID
Definition: CommunicationsNodeID.h:54
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
#define KDIS_EXPORT
Definition: KDefines.h:82