KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EntityMarking.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: EntityMarking
32  created: 22/09/2008
33  author: Karl Jones
34 
35  purpose: Holds entity marking
36  Note - Currently only supports ASCII marking text, changes will need
37  to be made to support the other sets.
38  size: 96 bits / 12 Octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./DataTypeBase.h"
44 
45 namespace KDIS {
46 namespace DATA_TYPE {
47 
49 {
50 protected:
51 
53 
54  KCHAR8 m_sEntityMarkingString[12]; // Extra octet for terminator, not included in size
55 
56 public:
57 
58  static const KUINT16 ENTITY_MARKING_SIZE = 12;
59 
60  EntityMarking();
61 
62  EntityMarking( KDataStream & stream ) throw( KException );
63 
64  EntityMarking( const KDIS::DATA_TYPE::ENUMS::EntityMarkingCharacterSet MarkingCharSet, const KCHAR8 * MarkingText, KUINT16 TextSize ) throw( KException );
65 
66  EntityMarking( const KDIS::DATA_TYPE::ENUMS::EntityMarkingCharacterSet MarkingCharSet, const KString & MarkingText ) throw( KException );
67 
68  virtual ~EntityMarking();
69 
70  //************************************
71  // FullName: KDIS::DATA_TYPE::EntityMarking::SetEntityMarkingCharacterSet
72  // KDIS::DATA_TYPE::EntityMarking::GetEntityMarkingCharacterSet
73  //!Description: Marking Char set
74  // Parameter: EntityMarkingCharacterSet EMCS, void
75  //************************************
76  void SetEntityMarkingCharacterSet( KDIS::DATA_TYPE::ENUMS::EntityMarkingCharacterSet EMCS );
77  KDIS::DATA_TYPE::ENUMS::EntityMarkingCharacterSet GetEntityMarkingCharacterSet() const;
78 
79  //************************************
80  // FullName: KDIS::DATA_TYPE::EntityMarking::SetEntityMarkingString
81  // KDIS::DATA_TYPE::EntityMarking::GetEntityMarkingString
82  //!Description: Marking string. entity name etc. max 11 characters.. Throws exception if string is too big.
83  // Parameter: const KCHAR8 * EMS, const KString & EMS
84  // Parameter: KUINT16 StringSize
85  //************************************
86  void SetEntityMarkingString( const KCHAR8 * EMS, KUINT16 StringSize ) throw( KException );
87  void SetEntityMarkingString( const KString & EMS ) throw( KException );
88  KString GetEntityMarkingString() const;
89 
90  //************************************
91  // FullName: KDIS::DATA_TYPE::EntityMarking::GetAsString
92  //!Description: Returns a string representation
93  //************************************
94  virtual KString GetAsString() const;
95 
96  //************************************
97  // FullName: KDIS::DATA_TYPE::EntityMarking::Decode
98  //!Description: Convert From Network Data.
99  // Parameter: KDataStream & stream
100  //************************************
101  virtual void Decode( KDataStream & stream ) throw( KException );
102 
103  //************************************
104  // FullName: KDIS::DATA_TYPE::EntityMarking::Encode
105  //!Description: Convert To Network Data.
106  // Parameter: KDataStream & stream
107  //************************************
108  virtual KDataStream Encode() const;
109  virtual void Encode( KDataStream & stream ) const;
110 
111  KBOOL operator == ( const EntityMarking & Value ) const;
112  KBOOL operator != ( const EntityMarking & Value ) const;
113 };
114 
115 } // END namespace DATA_TYPES
116 } // END namespace KDIS
117 
char KCHAR8
Definition: KDefines.h:110
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
EntityMarkingCharacterSet
Definition: EnumEntityInfoInteraction.h:867
std::string KString
Definition: KDefines.h:116
unsigned char KUINT8
Definition: KDefines.h:99
KUINT8 m_ui8EntityMarkingCharacterSet
Definition: EntityMarking.h:52
Definition: EntityMarking.h:48
#define KDIS_EXPORT
Definition: KDefines.h:82