KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityIdentifier.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: EntityIdentifier
32  created: 18/09/2008
33  author: Karl Jones
34 
35  purpose: Entity Identifier Field found in PDU's.
36  Also known as:
37  Object Identifier. - where entity id is object id.
38  Event Identifier. - where entity id is event id.
39  size: 48 bits / 6 octets
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./SimulationIdentifier.h"
45 
46 namespace KDIS {
47 namespace DATA_TYPE {
48 
50 {
51 protected:
52 
54 
55 public:
56 
57  static const KUINT16 ENTITY_IDENTIFER_SIZE = 6;
58 
60 
61  EntityIdentifier( KUINT16 SiteID, KUINT16 ApplicatonID, KUINT16 EntityID );
62 
63  EntityIdentifier( const SimulationIdentifier & SimID, KUINT16 EntityID );
64 
65  EntityIdentifier( KDataStream & stream ) throw( KException );
66 
67  virtual ~EntityIdentifier();
68 
69  //************************************
70  // FullName: KDIS::DATA_TYPE::EntityIdentifier::SetEntityID
71  // KDIS::DATA_TYPE::EntityIdentifier::GetEntityID
72  //!Description: Entity ID, also known as 'Object ID', 'Process Numbers', 'Event ID' or 'Reference Number'.
73  // Parameter: KUINT16 ID, void
74  //************************************
75  void SetEntityID( KUINT16 ID );
76  KUINT16 GetEntityID() const;
77 
78  //************************************
79  // FullName: KDIS::DATA_TYPE::EntityIdentifier::GetAsString
80  //!Description: Returns a string representation
81  //************************************
82  virtual KString GetAsString() const;
83 
84  //************************************
85  // FullName: KDIS::DATA_TYPE::EntityIdentifier::Decode
86  //!Description: Convert From Network Data.
87  // Parameter: KDataStream & stream
88  //************************************
89  virtual void Decode( KDataStream & stream ) throw( KException );
90 
91  //************************************
92  // FullName: KDIS::DATA_TYPE::EntityIdentifier::Encode
93  //!Description: Convert To Network Data.
94  // Parameter: KDataStream & stream
95  //************************************
96  virtual KDataStream Encode() const;
97  virtual void Encode( KDataStream & stream ) const;
98 
99  KBOOL operator == ( const EntityIdentifier & Value ) const;
100  KBOOL operator != ( const EntityIdentifier & Value ) const;
101  KBOOL operator < ( const EntityIdentifier & Value ) const;
102 };
103 
104 } // END namespace DATA_TYPES
105 } // END namespace KDIS
106 
Definition: SimulationIdentifier.h:51
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16EntityID
Definition: EntityIdentifier.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
#define KDIS_EXPORT
Definition: KDefines.h:82