KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GroupAssignmentRecord.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: GroupAssignmentRecord
32  created: 2009/02/06
33  author: Karl Jones
34 
35  purpose: Used to assign a group bit field to a specific entity.
36  A bit set to one shall indicate membership in the corresponding group.
37  Multiple bits can be set to indicate membership in multiple groups.
38  size: 128 bits / 16 octets
39 *********************************************************************/
40 
41 #pragma once
42 
43 #include "./DataTypeBase.h"
44 #include "./EntityIdentifier.h"
45 #include <bitset>
46 
47 namespace KDIS {
48 namespace DATA_TYPE {
49 
51 {
52 protected:
53 
55 
57 
59 
61 
62  KUINT16 m_ui16Padding1; // 24 Bits - Reserved
63 
65 
66 public:
67 
68  static const KUINT16 GROUP_ASSIGNMENT_RECORD_SIZE = 16;
69 
71 
72  GroupAssignmentRecord( KDataStream & stream )throw( KException );
73 
74  GroupAssignmentRecord( KUINT32 GroupBitField, const EntityIdentifier & ID,
75  KUINT8 DeviceID, KUINT8 LineID );
76 
77  virtual ~GroupAssignmentRecord();
78 
79  //************************************
80  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::SetGroupBitField
81  // KDIS::DATA_TYPE::GroupAssignmentRecord::GetGroupBitField
82  //!Description: Sets the group/s the Entity will belong to.
83  //! Each group is represented by a single bit, 1 indicates membership of the group.
84  //! Exception thrown if a bit greater than 31 is specified in Group.
85  // Parameter: KUINT32 AllGroups, void, KUINT8 Group
86  // Parameter: KBOOL InGroup = true
87  //************************************
88  void SetGroupBitField( KUINT32 AllGroups );
89  KUINT32 GetGroupBitField() const;
90  void SetGroupBitField( KUINT8 Group, KBOOL InGroup = true ) throw( KException );
91  KBOOL IsGroupBitSet( KUINT8 Group ) const throw( KException );
92 
93  //************************************
94  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::SetDestinationEntityID
95  // KDIS::DATA_TYPE::GroupAssignmentRecord::GetDestinationEntityID
96  //!Description: Entity that is the recipient of the PDU.
97  // Parameter: const EntityIdentifier & ID, void
98  //************************************
99  void SetDestinationEntityID( const EntityIdentifier & ID );
100  const EntityIdentifier & GetDestinationEntityID() const;
101  EntityIdentifier & GetDestinationEntityID();
102 
103  //************************************
104  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::SetDestinationCommDeviceID
105  // KDIS::DATA_TYPE::GroupAssignmentRecord::GetDestinationCommDeviceID
106  //!Description: Identifies the specific intercom device being interfaced
107  //! and/or simulated within an entity.
108  //! All devices on an entity must have a unique ID.
109  //! Set to 0 if the entity does not have a simulated device.
110  // Parameter: KUINT16 ID, void
111  //************************************
112  void SetDestinationCommDeviceID( KUINT16 ID );
113  KUINT16 GetDestinationCommDeviceID() const;
114 
115  //************************************
116  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::SetDestinationLineID
117  // KDIS::DATA_TYPE::GroupAssignmentRecord::GetDestinationLineID
118  //!Description: Identifies the line number to which this intercom control refers.
119  //! E.G. For a intercom device with a single line the value would be 1.
120  // Parameter: KUINT8 ID, void
121  //************************************
122  void SetDestinationLineID( KUINT8 ID );
123  KUINT8 GetDestinationLineID() const;
124 
125  //************************************
126  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::GetAsString
127  //!Description: Returns a string representation
128  //************************************
129  virtual KString GetAsString() const;
130 
131  //************************************
132  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::Decode
133  //!Description: Convert From Network Data.
134  // Parameter: KDataStream & stream
135  //************************************
136  virtual void Decode( KDataStream & stream ) throw( KException );
137 
138  //************************************
139  // FullName: KDIS::DATA_TYPE::GroupAssignmentRecord::Encode
140  //!Description: Convert To Network Data.
141  // Parameter: KDataStream & stream
142  //************************************
143  virtual KDataStream Encode() const;
144  virtual void Encode( KDataStream & stream ) const;
145 
146  KBOOL operator == ( const GroupAssignmentRecord & Value ) const;
147  KBOOL operator != ( const GroupAssignmentRecord & Value ) const;
148 };
149 
150 } // END namespace DATA_TYPES
151 } // END namespace KDIS
KUINT8 m_ui8Padding2
Definition: GroupAssignmentRecord.h:64
unsigned int KUINT32
Definition: KDefines.h:103
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16DstCommsDvcID
Definition: GroupAssignmentRecord.h:58
EntityIdentifier m_Entity
Definition: GroupAssignmentRecord.h:56
KUINT8 m_ui8DstLineID
Definition: GroupAssignmentRecord.h:60
Definition: GroupAssignmentRecord.h:50
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
KUINT32 m_ui32GrpBtField
Definition: GroupAssignmentRecord.h:54
KUINT16 m_ui16Padding1
Definition: GroupAssignmentRecord.h:62
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82