KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityType.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: EntityType
32  created: 22/09/2008
33  author: Karl Jones
34 
35  purpose: Holds DIS enum for Entity Type.
36  size: 64 bits / 8 Octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
51 
53 
55 
57 
59 
61 
63 
64 public:
65 
66  static const KUINT16 ENTITY_TYPE_SIZE = 8;
67 
68  EntityType();
69 
71  KUINT8 SubCategory, KUINT8 Specific, KUINT8 Extra );
72 
73  EntityType( KUINT8 Kind, KUINT8 Domain, KUINT16 Country, KUINT8 Categoy,
74  KUINT8 SubCategory, KUINT8 Specific, KUINT8 Extra );
75 
76  EntityType( KDataStream & stream ) throw( KException );
77 
78  virtual ~EntityType();
79 
80  //************************************
81  // FullName: KDIS::DATA_TYPE::EntityType::SetEntityKind
82  // KDIS::DATA_TYPE::EntityType::GetEntityKind
83  //!Description: Kind.
84  // Parameter: EntityKind UI
85  //************************************
86  void SetEntityKind( KDIS::DATA_TYPE::ENUMS::EntityKind UI );
87  KDIS::DATA_TYPE::ENUMS::EntityKind GetEntityKind() const;
88 
89  //************************************
90  // FullName: KDIS::DATA_TYPE::EntityType::SetDomain
91  // KDIS::DATA_TYPE::EntityType::GetDomain
92  //!Description: Domain.
93  // Parameter: EntityDomain UI
94  //************************************
95  void SetDomain( KDIS::DATA_TYPE::ENUMS::EntityDomain UI );
96  KDIS::DATA_TYPE::ENUMS::EntityDomain GetDomain() const;
97 
98  //************************************
99  // FullName: KDIS::DATA_TYPE::EntityType::SetCountry
100  // KDIS::DATA_TYPE::EntityType::GetCountry
101  //!Description: Country.
102  // Parameter: Country UI
103  //************************************
104  void SetCountry( KDIS::DATA_TYPE::ENUMS::Country UI );
105  KDIS::DATA_TYPE::ENUMS::Country GetCountry() const;
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::EntityType::SetCategory
109  // KDIS::DATA_TYPE::EntityType::GetCategory
110  //!Description: Category.
111  // Parameter: KUINT8 UI
112  //************************************
113  void SetCategory( KUINT8 UI );
114  KUINT8 GetCategory() const;
115 
116  //************************************
117  // FullName: KDIS::DATA_TYPE::EntityType::SetSubCategory
118  // KDIS::DATA_TYPE::EntityType::GetSubCategory
119  //!Description: Sub Category.
120  // Parameter: KUINT8 UI
121  //************************************
122  void SetSubCategory( KUINT8 UI );
123  KUINT8 GetSubCategory() const;
124 
125  //************************************
126  // FullName: KDIS::DATA_TYPE::EntityType::SetSpecific
127  // KDIS::DATA_TYPE::EntityType::GetSpecific
128  //!Description: Specific.
129  // Parameter: KUINT8 UI
130  //************************************
131  void SetSpecific( KUINT8 UI );
132  KUINT8 GetSpecific() const;
133 
134  //************************************
135  // FullName: KDIS::DATA_TYPE::EntityType::SetExtra
136  // KDIS::DATA_TYPE::EntityType::GetExtra
137  //!Description: Extra.
138  // Parameter: KUINT8 UI
139  //************************************
140  void SetExtra( KUINT8 UI );
141  KUINT8 GetExtra() const;
142 
143  //************************************
144  // FullName: KDIS::DATA_TYPE::EntityType::ReadFromTokenisedString
145  //!Description: Create a tokenised string to represent the type, such as csv.
146  //! E.G a csv string such as "1, 1, 224, 0, 0, 0, 0"
147  //! ReadFromTokenisedString Throws INVALID_DATA if 7 integer values are not found.
148  //! Note: Any values less than 0 will be changed to 0.
149  // Parameter: const KString & String
150  // Parameter: KString & Seperator = ","
151  //************************************
152  void ReadFromTokenisedString( const KString & String, const KString & Seperator = "," ) throw( KException );
153  KString CreateTokenisedString( const KString & Seperator = "," ) const;
154 
155  //************************************
156  // FullName: KDIS::DATA_TYPE::EntityType::GetAsString
157  //!Description: Returns a string representation.
158  //************************************
159  virtual KString GetAsString() const;
160 
161  //************************************
162  // FullName: KDIS::DATA_TYPE::EntityType::Decode
163  //!Description: Convert From Network Data.
164  // Parameter: KDataStream & stream
165  //************************************
166  virtual void Decode( KDataStream & stream ) throw( KException );
167 
168  //************************************
169  // FullName: KDIS::DATA_TYPE::EntityType::Encode
170  //!Description: Convert To Network Data.
171  // Parameter: KDataStream & stream
172  //************************************
173  virtual KDataStream Encode() const;
174  virtual void Encode( KDataStream & stream ) const;
175 
176  KBOOL operator == ( const EntityType & Value ) const;
177  KBOOL operator != ( const EntityType & Value ) const;
178  KBOOL operator < ( const EntityType & Value ) const;
179 };
180 
181 } // END namespace DATA_TYPES
182 } // END namespace KDIS
183 
Definition: EntityType.h:46
Country
Definition: EnumEntityInfoInteraction.h:105
unsigned short int KUINT16
Definition: KDefines.h:101
EntityKind
Definition: EnumEntityInfoInteraction.h:71
KUINT8 m_ui8SubCategory
Definition: EntityType.h:58
Definition: KDefines.h:182
Definition: KDataStream.h:48
KUINT16 m_ui16Country
Definition: EntityType.h:54
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
KUINT8 m_ui8Domain
Definition: EntityType.h:52
KUINT8 m_ui8Category
Definition: EntityType.h:56
std::string KString
Definition: KDefines.h:116
KUINT8 m_ui8Specific
Definition: EntityType.h:60
EntityDomain
Definition: EnumEntityInfoInteraction.h:90
KUINT8 m_ui8EntityKind
Definition: EntityType.h:50
unsigned char KUINT8
Definition: KDefines.h:99
KUINT8 m_ui8Extra
Definition: EntityType.h:62
#define KDIS_EXPORT
Definition: KDefines.h:82