KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RecordSet.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: RecordSet
32  created: 2009/03/14
33  author: Karl Jones
34 
35  purpose: Record set contained within Record Specification.
36  size: 96 bits / 12 octets - Min size
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 #include <vector>
43 
44 namespace KDIS {
45 namespace DATA_TYPE {
46 
48 {
49 protected:
50 
52 
54 
56 
58 
59  std::vector<KUINT8> m_vui8RecVals;
60 
61 public:
62 
63  static const KUINT16 RECORD_SET_SIZE = 12; // Min size
64 
65  RecordSet();
66 
67  RecordSet( KDataStream & stream )throw( KException );
68 
70  const std::vector<KUINT8> & RecordValue, KUINT16 RecordCount );
71 
72  virtual ~RecordSet();
73 
74  //************************************
75  // FullName: KDIS::DATA_TYPE::RecordSet::SetRecordID
76  // KDIS::DATA_TYPE::RecordSet::GetRecordID
77  //!Description: Specifies the data structure used to convey
78  //! the parameters values of the record.
79  // Parameter: RecordID ID
80  //************************************
81  void SetRecordID( KDIS::DATA_TYPE::ENUMS::RecordID ID );
82  KDIS::DATA_TYPE::ENUMS::RecordID GetRecordID() const;
83 
84  //************************************
85  // FullName: KDIS::DATA_TYPE::RecordSet::SetSerialNumber
86  // KDIS::DATA_TYPE::RecordSet::GetSerialNumber
87  //!Description: Record serial number.
88  // Parameter: KUINT32 SN
89  //************************************
90  void SetSerialNumber( KUINT32 SN );
91  KUINT32 GetSerialNumber() const;
92 
93  //************************************
94  // FullName: KDIS::DATA_TYPE::RecordSet::GetRecordLength
95  //!Description: Specifies the total length in bytes/octets of the record set.
96  //************************************
97  KUINT16 GetRecordLength() const;
98 
99  //************************************
100  // FullName: KDIS::DATA_TYPE::RecordSet::SetRecordCount
101  // KDIS::DATA_TYPE::RecordSet::GetRecordCount
102  //!Description: Specifies the number of bits used in the record.
103  // Parameter: KUINT16 RC, void
104  //************************************
105  void SetRecordCount( KUINT16 RC );
106  KUINT16 GetRecordCount() const;
107 
108  //************************************
109  // FullName: KDIS::DATA_TYPE::RecordSet::SetRecordValues
110  // KDIS::DATA_TYPE::RecordSet::GetRecordValues
111  // KDIS::DATA_TYPE::RecordSet::ClearRecordValues
112  //!Description: Contains the concatenated records of the format specified by the Record ID.
113  //! You will need to set the record count, this is the number of bits in the
114  //! record values parameter(RV) that are used.
115  // Parameter: vector<KUINT8> & RC, void
116  // Parameter: KUINT16 RecNt - Number of bits used by the record.
117  //************************************
118  void SetRecordValues( const std::vector<KUINT8> & RV, KUINT16 RecCnt );
119  const std::vector<KUINT8> & GetRecordValues() const;
120  void ClearRecordValues();
121 
122  //************************************
123  // FullName: KDIS::DATA_TYPE::RecordSet::GetAsString
124  //!Description: Returns a string representation
125  //************************************
126  virtual KString GetAsString() const;
127 
128  //************************************
129  // FullName: KDIS::DATA_TYPE::RecordSet::Decode
130  //!Description: Convert From Network Data.
131  // Parameter: KDataStream & stream
132  //************************************
133  virtual void Decode( KDataStream & stream ) throw( KException );
134 
135  //************************************
136  // FullName: KDIS::DATA_TYPE::RecordSet::Encode
137  //!Description: Convert To Network Data.
138  // Parameter: KDataStream & stream
139  //************************************
140  virtual KDataStream Encode() const;
141  virtual void Encode( KDataStream & stream ) const;
142 
143  KBOOL operator == ( const RecordSet & Value ) const;
144  KBOOL operator != ( const RecordSet & Value ) const;
145 };
146 
147 } // END namespace DATA_TYPES
148 } // END namespace KDIS
std::vector< KUINT8 > m_vui8RecVals
Definition: RecordSet.h:59
unsigned int KUINT32
Definition: KDefines.h:103
ID_Enum
Definition: EnumEntityManagement.h:201
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT32 m_ui32RecSetSerialNum
Definition: RecordSet.h:53
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
KUINT32 m_ui32RecID
Definition: RecordSet.h:51
KUINT16 m_ui16RecCnt
Definition: RecordSet.h:57
std::string KString
Definition: KDefines.h:116
Definition: RecordSet.h:47
KUINT16 m_ui16RecLen
Definition: RecordSet.h:55
#define KDIS_EXPORT
Definition: KDefines.h:82