KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
AttributeRecordSet.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: AttributeRecordSet
32  created: 15/03/2011
33  author: Karl Jones
34 
35  purpose: Attribute record set for Attribute_PDU.
36  Defines a entity/object and its attributes.
37  size: 64 bits / 8 octets - Min size
38 *********************************************************************/
39 
40 #pragma once
41 
42 #include "./EntityIdentifier.h"
43 #include "./StandardVariable.h"
44 
45 namespace KDIS {
46 namespace DATA_TYPE {
47 
49 {
50 protected:
51 
53 
55 
56  std::vector<StdVarPtr> m_vAttrRec;
57 
58 public:
59 
60  static const KUINT16 ATTRIBUTE_RECORD_SET_SIZE = 8; // Min size
61 
63 
64  AttributeRecordSet( KDataStream & stream ) throw( KException );
65 
67 
68  virtual ~AttributeRecordSet();
69 
70  //************************************
71  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::SetEntityIdentifier
72  // KDIS::DATA_TYPE::AttributeRecordSet::GetEntityIdentifier
73  //!Description: The entity or object to which all Attribute records in this set apply.
74  // Parameter: const EntityIdentifier & EI
75  //************************************
76  void SetEntityIdentifier( const EntityIdentifier & EI );
77  const EntityIdentifier & GetEntityIdentifier() const;
78  EntityIdentifier & GetEntityIdentifier();
79 
80  //************************************
81  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::GetNumberOfAttributeRecords
82  //!Description: The number of Attribute Records contained within this set.
83  //************************************
84  KUINT16 GetNumberOfAttributeRecords() const;
85 
86  //************************************
87  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::AddAttributeRecord
88  // KDIS::DATA_TYPE::AttributeRecordSet::SetAttributeRecords
89  // KDIS::DATA_TYPE::AttributeRecordSet::GetAttributeRecords
90  // KDIS::DATA_TYPE::AttributeRecordSet::ClearAttributeRecords
91  //!Description: Add/Set the Attribute Record/s.
92  //! Adding will update the Number of Attribute Records Params field.
93  // Parameter: StdVarPtr AR, const vector<StdVarPtr> & AR
94  //************************************
95  void AddAttributeRecord( StdVarPtr AR );
96  void SetAttributeRecords( const std::vector<StdVarPtr> & AR );
97  const std::vector<StdVarPtr> & GetAttributeRecords() const;
98  void ClearAttributeRecords();
99 
100  //************************************
101  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::GetRecordLength
102  //!Description: Returns the length of the set in octets.
103  // Note: This field is not part of the data type, this is just a helper function.
104  //************************************
105  KUINT16 GetRecordLength() const;
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::GetAsString
109  //!Description: Returns a string representation.
110  //************************************
111  virtual KString GetAsString() const;
112 
113  //************************************
114  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::Decode
115  //!Description: Convert From Network Data.
116  // Parameter: KDataStream & stream
117  //************************************
118  virtual void Decode( KDataStream & stream ) throw( KException );
119 
120  //************************************
121  // FullName: KDIS::DATA_TYPE::AttributeRecordSet::Encode
122  //!Description: Convert To Network Data.
123  // Parameter: KDataStream & stream
124  //************************************
125  virtual KDataStream Encode() const;
126  virtual void Encode( KDataStream & stream ) const;
127 
128  KBOOL operator == ( const AttributeRecordSet & Value ) const;
129  KBOOL operator != ( const AttributeRecordSet & Value ) const;
130 };
131 
132 } // END namespace DATA_TYPES
133 } // END namespace KDIS
134 
std::vector< StdVarPtr > m_vAttrRec
Definition: AttributeRecordSet.h:56
unsigned short int KUINT16
Definition: KDefines.h:101
EntityIdentifier m_EntityID
Definition: AttributeRecordSet.h:52
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
KUINT16 m_ui16NumAttrRecs
Definition: AttributeRecordSet.h:54
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
Definition: EntityIdentifier.h:49
Definition: AttributeRecordSet.h:48
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: KRef_Ptr.h:73