KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
AggregateIdentifier.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: AggregateIdentifier
32  created: 07/02/2009
33  author: Karl Jones
34 
35  purpose: Aggregate Identifier Field. Used only to provide a unique,
36  exercise-wide number to identify aggregates and/or to
37  address specific simulation applications.
38  size: 48 bits / 6 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./SimulationIdentifier.h"
44 
45 namespace KDIS {
46 namespace DATA_TYPE {
47 
49 {
50 protected:
51 
53 
54 public:
55 
56  static const KUINT16 AGGREGATE_IDENTIFER_SIZE = 6;
57 
59 
60  AggregateIdentifier( KUINT16 SiteID, KUINT16 ApplicatonID, KUINT16 AggregateID );
61 
62  AggregateIdentifier( const SimulationIdentifier & SimID, KUINT16 AggregateID );
63 
64  AggregateIdentifier( KDataStream & stream ) throw( KException );
65 
66  virtual ~AggregateIdentifier();
67 
68  //************************************
69  // FullName: KDIS::DATA_TYPE::AggregateIdentifier::SetAggregateID
70  // KDIS::DATA_TYPE::AggregateIdentifier::GetAggregateID
71  //!Description: Aggregate ID
72  // Parameter: KUINT16 ID, void
73  //************************************
74  void SetAggregateID( KUINT16 ID );
75  KUINT16 GetAggregateID() const;
76 
77  //************************************
78  // FullName: KDIS::DATA_TYPE::AggregateIdentifier::GetAsString
79  //!Description: Returns a string representation
80  //************************************
81  virtual KString GetAsString() const;
82 
83  //************************************
84  // FullName: KDIS::DATA_TYPE::AggregateIdentifier::Decode
85  //!Description: Convert From Network Data.
86  // Parameter: KDataStream & stream
87  //************************************
88  virtual void Decode( KDataStream & stream ) throw( KException );
89 
90  //************************************
91  // FullName: KDIS::DATA_TYPE::AggregateIdentifier::Encode
92  //!Description: Convert To Network Data.
93  // Parameter: KDataStream & stream
94  //************************************
95  virtual KDataStream Encode() const;
96  virtual void Encode( KDataStream & stream ) const;
97 
98  KBOOL operator == ( const AggregateIdentifier & Value ) const;
99  KBOOL operator != ( const AggregateIdentifier & Value ) const;
100  KBOOL operator < ( const AggregateIdentifier & Value ) const;
101 };
102 
103 } // END namespace DATA_TYPES
104 } // END namespace KDIS
105 
Definition: SimulationIdentifier.h:51
Definition: AggregateIdentifier.h:48
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16AggregateID
Definition: AggregateIdentifier.h:52
Definition: KDefines.h:182
Definition: KDataStream.h:48
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
#define KDIS_EXPORT
Definition: KDefines.h:82