chore(include): changed include files from .h to .hpp
[KDIS.git] / include / KDIS / DataTypes / Descriptor.hpp
blob15fa6a889238ea046e79cd7cbe5e80a08ada9057
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: Descriptor
32 created: 22/04/2013
33 author: Karl Jones
35 purpose: Base class for Descriptor records.
37 In DIS < 7:
38 All descriptors should use the Munition Descriptor record AKA Burst descriptor.
40 In DIS 7 onwards:
41 A Fire PDU descriptor can be either a Munition(AKA Burst) or an Expendable descriptor.
42 A Detonation PDU descriptor can be either a Munition(AKA Burst), Expendable or an Explosion descriptor.
44 size: 128 bits / 16 octets
45 *********************************************************************/
47 #pragma once
49 #include "./DataTypeBase.h"
50 #include "./EntityType.h"
51 #include "./../Extras/KRef_Ptr.h"
53 namespace KDIS {
54 namespace DATA_TYPE {
56 /************************************************************************/
57 // Define the type of pointer we are using for Descriptor Records,
58 // do we want a weak reference or a ref counter?
59 // By default we use a ref pointer, however if you want to use a standard
60 // pointer or one of your own then simply change it below.
61 /************************************************************************/
62 class Descriptor;
63 typedef KDIS::UTILS::KRef_Ptr<Descriptor> DescPtr; // Ref counter
64 //typedef Descriptor* DescPtr; // Weak ref
67 class KDIS_EXPORT Descriptor : public DataTypeBase
69 protected:
71 EntityType m_Type;
73 public:
75 static const KUINT16 DESCRIPTOR_SIZE = 16;
77 Descriptor();
79 Descriptor( KDataStream & stream );
81 Descriptor( const EntityType & T );
83 virtual ~Descriptor();
85 //************************************
86 // FullName: KDIS::DATA_TYPE::Descriptor::SetMunition
87 // KDIS::DATA_TYPE::Descriptor::GetMunition
88 // Description: Munition, Explosion or Expendable Type.
89 // Parameter: const EntityType & T
90 //************************************
91 void SetType( const EntityType & T );
92 const EntityType & GetType() const;
93 EntityType & GetType();
95 //************************************
96 // FullName: KDIS::DATA_TYPE::Descriptor::GetAsString
97 // Description: Returns a string representation.
98 //************************************
99 virtual KString GetAsString() const;
101 //************************************
102 // FullName: KDIS::DATA_TYPE::Descriptor::Decode
103 // Description: Convert From Network Data.
104 // Parameter: KDataStream & stream
105 //************************************
106 virtual void Decode( KDataStream & stream ) ;
108 //************************************
109 // FullName: KDIS::DATA_TYPE::Descriptor::Encode
110 // Description: Convert To Network Data.
111 // Parameter: KDataStream & stream
112 //************************************
113 virtual KDataStream Encode() const;
114 virtual void Encode( KDataStream & stream ) const;
116 KBOOL operator == ( const Descriptor & Value ) const;
117 KBOOL operator != ( const Descriptor & Value ) const;
120 } // END namespace DATA_TYPES
121 } // END namespace KDIS