KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SilentEntitySystem.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: SilentEntitySystem
32  created: 2009/02/08
33  author: Karl Jones
34 
35  purpose: Contains information about entities not producing
36  Entity State PDUs.
37  size: 96 bits / 12 octets - Min size
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./DataTypeBase.h"
43 #include "./EntityType.h"
44 #include "./EntityAppearance.h"
45 #include <vector>
46 
47 namespace KDIS {
48 namespace DATA_TYPE {
49 
51 {
52 protected:
53 
55 
57 
59 
60  std::vector<EntityAppearance> m_vEA;
61 
62 public:
63 
64  static const KUINT16 SILENT_ENTITY_SYSTEM_SIZE = 12; // Min Size
65 
67 
68  SilentEntitySystem( KDataStream & stream ) throw( KException );
69 
70  virtual ~SilentEntitySystem();
71 
72  //************************************
73  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::SetNumberOfEntities
74  // KDIS::DATA_TYPE::SilentEntitySystem::GetNumberOfEntities
75  //!Description: Number of entities of this type.
76  // Parameter: KUINT16 NOE
77  //************************************
78  void SetNumberOfEntities( KUINT16 NOE );
79  KUINT16 GetNumberOfEntities() const;
80 
81  //************************************
82  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::GetNumberOfAppearanceRecords
83  //!Description: Number of appearance records.
84  //************************************
85  KUINT16 GetNumberOfAppearanceRecords() const;
86 
87  //************************************
88  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::AddEntityAppearance
89  // KDIS::DATA_TYPE::SilentEntitySystem::SetEntityAppearanceList
90  // KDIS::DATA_TYPE::SilentEntitySystem::GetEntityAppearanceList
91  // KDIS::DATA_TYPE::SilentEntitySystem::ClearEntityAppearanceList
92  //!Description: The number of Entity Appearance records should be between zero and the number of
93  //! entities of this type.
94  //! Simulation applications representing the aggregate that do not model
95  //! entity appearances shall set this field to zero.
96  //! Simulation applications representing the aggregate that model entity
97  //! appearances shall set this field to the number of entity appearances
98  //! that deviate from the default appearance.
99  //! Other simulations can safely assume that any entity appearances not specified are
100  //! default appearances.
101  //! Exception thrown if the size of the list is greater than the number of entities.
102  // Parameter: const EntityAppearance & EA, const vector<EntityAppearance> & EA
103  //************************************
104  void AddEntityAppearance( const EntityAppearance & EA ) throw( KException );
105  void SetEntityAppearanceList( const std::vector<EntityAppearance> & EA ) throw( KException );
106  const std::vector<EntityAppearance> & GetEntityAppearanceList() const;
107  void ClearEntityAppearanceList();
108 
109  //************************************
110  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::SetEntityType
111  // KDIS::DATA_TYPE::SilentEntitySystem::GetEntityType
112  //!Description: Aggregate type for this record.
113  // Parameter: const EntityType & E
114  //************************************
115  void SetEntityType( const EntityType & A );
116  const EntityType & GetEntityType() const;
117  EntityType & GetEntityType();
118 
119  //************************************
120  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::GetAsString
121  //!Description: Returns a string representation
122  //************************************
123  virtual KString GetAsString() const;
124 
125  //************************************
126  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::Decode
127  //!Description: Convert From Network Data.
128  // Parameter: KDataStream & stream
129  //************************************
130  virtual void Decode( KDataStream & stream ) throw( KException );
131 
132  //************************************
133  // FullName: KDIS::DATA_TYPE::SilentEntitySystem::Encode
134  //!Description: Convert To Network Data.
135  // Parameter: KDataStream & stream
136  //************************************
137  virtual KDataStream Encode() const;
138  virtual void Encode( KDataStream & stream ) const;
139 
140  KBOOL operator == ( const SilentEntitySystem & Value ) const;
141  KBOOL operator != ( const SilentEntitySystem & Value ) const;
142 };
143 
144 } // END namespace DATA_TYPES
145 } // END namespace KDIS
146 
EntityType m_EntTyp
Definition: SilentEntitySystem.h:58
KUINT16 m_ui16NumEnts
Definition: SilentEntitySystem.h:54
Definition: EntityType.h:46
unsigned short int KUINT16
Definition: KDefines.h:101
std::vector< EntityAppearance > m_vEA
Definition: SilentEntitySystem.h:60
Definition: SilentEntitySystem.h:50
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
Definition: EntityAppearance.h:58
KUINT16 m_ui16NumOfAppearanceRecords
Definition: SilentEntitySystem.h:56
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
#define KDIS_EXPORT
Definition: KDefines.h:82