KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EnvironmentRecord.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: EnvironmentRecord
32  created: 18/08/2009
33  author: Karl Jones
34 
35  purpose: This is the base class for all state and geometry records
36  used in the Environmental_Process_PDU.
37  size: 64 bits / 8 octets
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./DataTypeBase.h"
43 #include "./FactoryDecoder.h"
44 #include "./../Extras/KRef_Ptr.h"
45 
46 namespace KDIS {
47 namespace DATA_TYPE {
48 
49 /************************************************************************/
50 // Define the type of pointer we are using for VariableDatum Records,
51 // do we want a weak reference or a ref counter?
52 // By default we use a ref pointer, however if you want to use a standard
53 // pointer or one of your own then simply change it below.
54 /************************************************************************/
57 //typedef EnvironmentRecord* EnviromentRecordPtr; // Weak ref
58 
59 class KDIS_EXPORT EnvironmentRecord : public DataTypeBase, public FactoryDecoderUser<EnvironmentRecord>
60 {
61 protected:
62 
64 
66 
68 
70 
71 public:
72 
73  static const KUINT16 ENVIRONMENT_RECORD_SIZE = 8;
74 
76 
77  virtual ~EnvironmentRecord();
78 
79  //************************************
80  // FullName: KDIS::DATA_TYPE::EnvironmentRecord::GetEnvironmentRecordType
81  //!Description: Specifies the record type.
82  // Parameter: EnvironmentRecordType RT, void
83  //************************************
84  KDIS::DATA_TYPE::ENUMS::EnvironmentRecordType GetEnvironmentRecordType() const;
85 
86  //************************************
87  // FullName: KDIS::DATA_TYPE::EnvironmentRecord::GetLength
88  //!Description: Specifies the length in bits of the Environment record.
89  //************************************
90  virtual KUINT16 GetLength() const;
91 
92  //************************************
93  // FullName: KDIS::DATA_TYPE::EnvironmentRecord::SetIndex
94  // KDIS::DATA_TYPE::EnvironmentRecord::GetIndex
95  //!Description: Identifies the sequentially numbered record index.
96  // Parameter: KUINT8 I, void
97  //************************************
98  void SetIndex( KUINT8 I );
99  KUINT8 GetIndex() const;
100 
101  //************************************
102  // FullName: KDIS::DATA_TYPE::EnvironmentRecord::GetAsString
103  //!Description: Returns a string representation
104  //************************************
105  virtual KString GetAsString() const;
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::EnvironmentRecord::FactoryDecodeEnvironmentRecord
109  //!Description: Decode method for decoding any EnvironmentRecord child classes.
110  // First checks for a custom decode, if one can not be found then uses one of the KDIS EnvironmentRecord data types.
111  //! Throws exception for unknown records(UNSUPPORTED_DATATYPE) or when stream is
112  //! too small(NOT_ENOUGH_DATA_IN_BUFFER).
113  // Parameter: KDataStream & stream
114  //************************************
115  static EnviromentRecordPtr FactoryDecodeEnvironmentRecord( KDataStream & stream ) throw( KException );
116 
117  KBOOL operator == ( const EnvironmentRecord & Value )const;
118  KBOOL operator != ( const EnvironmentRecord & Value )const;
119 };
120 
121 } // END namespace DATA_TYPES
122 } // END namespace KDIS
unsigned int KUINT32
Definition: KDefines.h:103
KDIS::UTILS::KRef_Ptr< EnvironmentRecord > EnviromentRecordPtr
Definition: EnvironmentRecord.h:55
KUINT8 m_ui8Index
Definition: EnvironmentRecord.h:67
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT16 m_ui16Length
Definition: EnvironmentRecord.h:65
Definition: KDefines.h:182
Definition: KDataStream.h:48
EnvironmentRecordType
Definition: EnumSyntheticEnviroment.h:53
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
unsigned char KUINT8
Definition: KDefines.h:99
KUINT32 m_ui32EnvRecTyp
Definition: EnvironmentRecord.h:63
Definition: FactoryDecoder.h:104
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: KRef_Ptr.h:73
Definition: EnvironmentRecord.h:59
KUINT8 m_ui8Padding
Definition: EnvironmentRecord.h:69