Merge pull request #5 from intothevoid/master
[KDIS.git] / KDIS / KDIS / DataTypes / SimulationIdentifier.h
blob32abf8404de21ee6cebb278186773220f27f5b9c
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: SimulationIdentifier
32 created: 2009/11/24
33 author: Karl Jones
35 purpose: Simulation Identifier. Site and Application number.
36 Also known as the Simulation Address record in DIS 7.
38 Note: If you are looking for the DIS 7 Simulation Identifier(the one with the extra 16 bits)
39 then see EntityIdentifier.
41 size: 32 bits / 4 octets
42 *********************************************************************/
44 #pragma once
46 #include "./DataTypeBase.h"
48 namespace KDIS {
49 namespace DATA_TYPE {
51 class KDIS_EXPORT SimulationIdentifier : public DataTypeBase
53 protected:
55 KUINT16 m_ui16SiteID;
57 KUINT16 m_ui16ApplicationID;
59 public:
61 static const KUINT16 SIMULATION_IDENTIFIER_SIZE = 4;
63 SimulationIdentifier();
65 SimulationIdentifier( KUINT16 SiteID, KUINT16 ApplicatonID );
67 SimulationIdentifier( KDataStream & stream ) ;
69 virtual ~SimulationIdentifier();
71 //************************************
72 // FullName: KDIS::DATA_TYPE::SimulationIdentifier::SetSiteID
73 // KDIS::DATA_TYPE::SimulationIdentifier::GetSiteID
74 // Description: Site ID.
75 // A site is defined as a facility, installation, organizational unit or a geographic
76 // location that has one or more simulation applications capable of participating in a
77 // distributed event. A facility, installation, organizational unit or geographic location
78 // may have multiple sites associated with it.
79 // Each site participating in an event (e.g., training exercise, experiment, test) shall be
80 // assigned a unique Site Number that is different from any other site that is part of the same event.
81 // A simulation site is a site that generates simulated objects based on simulated data. A live site
82 // is a site that is associated with producing live objects from live sources such as producing
83 // entities representing live aircraft flying in a live training range. A simulation associated
84 // with a live site may issue Live Entity PDUs (e.g., the TSPI PDU) for the live objects or may
85 // issue Entity State PDUs for them.
86 // Parameter: KUINT16 ID
87 //************************************
88 void SetSiteID( KUINT16 ID );
89 KUINT16 GetSiteID() const;
91 //************************************
92 // FullName: KDIS::DATA_TYPE::SimulationIdentifier::SetApplicationID
93 // KDIS::DATA_TYPE::SimulationIdentifier::GetApplicationID
94 // Description: Application ID.
95 // An application is defined as a software program that is used to generate and process
96 // distributed simulation data including live, virtual and constructive data.
97 // Each application participating in an event (e.g., training exercise) shall be
98 // assigned a unique Application Number for the site with which the application is associated.
99 // Parameter: KUINT16 ID
100 //************************************
101 void SetApplicationID( KUINT16 ID );
102 KUINT16 GetApplicationID() const;
104 //************************************
105 // FullName: KDIS::DATA_TYPE::SimulationIdentifier::GetAsString
106 // Description: Returns a string representation.
107 //************************************
108 virtual KString GetAsString() const;
110 //************************************
111 // FullName: KDIS::DATA_TYPE::SimulationIdentifier::Decode
112 // Description: Convert From Network Data.
113 // Parameter: KDataStream & stream
114 //************************************
115 virtual void Decode( KDataStream & stream ) ;
117 //************************************
118 // FullName: KDIS::DATA_TYPE::SimulationIdentifier::Encode
119 // Description: Convert To Network Data.
120 // Parameter: KDataStream & stream
121 //************************************
122 virtual KDataStream Encode() const;
123 virtual void Encode( KDataStream & stream ) const;
125 KBOOL operator == ( const SimulationIdentifier & Value ) const;
126 KBOOL operator != ( const SimulationIdentifier & Value ) const;
127 KBOOL operator < ( const SimulationIdentifier & Value ) const;
130 } // END namespace DATA_TYPES
131 } // END namespace KDIS