chore(include): changed include files from .h to .hpp
[KDIS.git] / include / KDIS / DataTypes / CommunicationsNodeID.hpp
blob9e46cc046e0445900d951b2c3a2c54f536beba88
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
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
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
30 /********************************************************************
31 class: CommunicationsNodeID
32 created: 04/12/2010
33 author: Karl Jones
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.
40 size: 64 bits / 8 octets
41 *********************************************************************/
43 #pragma once
45 #include "./EntityIdentifier.h"
47 namespace KDIS {
48 namespace DATA_TYPE {
50 class KDIS_EXPORT CommunicationsNodeID : public EntityIdentifier
52 protected:
54 KUINT16 m_ui16ElementID;
56 public:
58 static const KUINT16 COMMUNICATIONS_NODE_ID_SIZE = 8;
60 CommunicationsNodeID();
62 CommunicationsNodeID( KDataStream & stream ) ;
64 CommunicationsNodeID( KUINT16 Site, KUINT16 App, KUINT16 Obj, KUINT16 Element );
66 CommunicationsNodeID( const SimulationIdentifier & SimID, KUINT16 Obj, KUINT16 Element );
68 CommunicationsNodeID( const EntityIdentifier & EntID, KUINT16 Element );
70 virtual ~CommunicationsNodeID();
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;
85 //************************************
86 // FullName: KDIS::DATA_TYPE::CommunicationsNodeID::GetAsString
87 // Description: Returns a string representation.
88 //************************************
89 virtual KString GetAsString() const;
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 ) ;
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;
106 KBOOL operator == ( const CommunicationsNodeID & Value ) const;
107 KBOOL operator != ( const CommunicationsNodeID & Value ) const;
110 } // END namespace DATA_TYPES
111 } // END namespace KDIS