KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
APA.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: APA
32  created: 2009/01/05
33  author: Karl Jones
34 
35  purpose: Additional Passive Activity ( APA )
36  size: 32 bits / 4 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
50  union
51  {
52  struct
53  {
54  KUINT16 m_ui16APPI : 14;
55  KUINT16 m_ui16Status2 : 1;
56  KUINT16 m_ui16Status1 : 1;
57  };
59  }m_ApaUnion;
60 
62 
63 public:
64 
65  static const KUINT16 APA_SIZE = 4;
66 
67  APA();
68 
69  APA( KDataStream & stream ) throw( KException );
70 
72 
73  virtual ~APA();
74 
75  //************************************
76  // FullName: KDIS::DATA_TYPE::APA::SetAPPI
77  // KDIS::DATA_TYPE::APA::GetAPPI
78  //!Description: Indicates which database record ( or file ) shall be used to describe
79  //! an additional acoustic source such as transient effects, pre-launch
80  //! data( i.e torpedo tube floodings ), additional sources, and the
81  //! states available for each source type. This index shall be used to
82  //! identify data from databases such as the Special Event Database
83  //! ( SEDB )and an Additional Narrow band Database ( ANDB ).
84  // Parameter: AdditionalPassiveParameterIndex RPM, void
85  //************************************
88 
89  //************************************
90  // FullName: KDIS::DATA_TYPE::APA::SetStatus
91  // KDIS::DATA_TYPE::APA::GetStatus
92  //!Description: The left most 2 bits are used to indicate
93  //! on/off/change status of the record.
94  //! A value of ( 1, 1 ) shall be used to indicate
95  //! the record shall be activated commensurate
96  //! with the conditions in the database and the following APA value
97  //! field. A value of ( 0, 0 ) shall be used to indicate
98  //! that the record has been deselected or turned off.
99  //! A value of ( 1, 0 ) shall indicate a state change has occurred.
100  //! A value of ( 0, 1 ) shall indicate the state has not
101  //! changed, but the corresponding APA value field has changed.
102  // Parameter: KBOOL Val1, void
103  // Parameter: KBOOL Val2
104  //************************************
105  void SetStatus( KBOOL Val1, KBOOL Val2 );
106  KBOOL GetStatusVal1() const;
107  KBOOL GetStatusVal2() const;
108 
109  //************************************
110  // FullName: KDIS::DATA_TYPE::APA::SetValue
111  // KDIS::DATA_TYPE::APA::GetValue
112  //!Description: Represents the value of a state change
113  //! defined in the APA param index field.
114  // Parameter: KINT16 V, void
115  //************************************
116  void SetValue( KINT16 V );
117  KINT16 GetValue() const;
118 
119  //************************************
120  // FullName: KDIS::DATA_TYPE::APA::GetAsString
121  //!Description: Returns a string representation
122  //************************************
123  virtual KString GetAsString() const;
124 
125  //************************************
126  // FullName: KDIS::DATA_TYPE::APA::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::APA::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 APA & Value ) const;
141  KBOOL operator != ( const APA & Value ) const;
142 };
143 
144 } // END namespace DATA_TYPES
145 } // END namespace KDIS
146 
short int KINT16
Definition: KDefines.h:102
unsigned short int KUINT16
Definition: KDefines.h:101
KINT16 m_i16Value
Definition: APA.h:61
KUINT16 m_ui16ParamIndex
Definition: APA.h:58
AdditionalPassiveParameterIndex
Definition: EnumEmitter.h:1370
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
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: APA.h:46