KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IOEffect.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: IOEffect
32  created: 05/12/2010
33  author: Karl Jones
34 
35  purpose: Identification of IO effects on an entity when calculated by an IO simulation.
36  size: 128 bits / 16 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./StandardVariable.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
51 
53 
55 
57 
59 
61 
63 
64 public:
65 
66  static const KUINT16 IO_EFFECT_TYPE_SIZE = 16;
67 
69  KUINT8 DutyCycle, KUINT16 Duration, KUINT16 Process ) throw( KException );
70 
71  IOEffect();
72 
73  IOEffect( KDataStream & stream ) throw( KException );
74 
75  virtual ~IOEffect();
76 
77  //************************************
78  // FullName: KDIS::DATA_TYPE::IOEffect::SetStatus
79  // KDIS::DATA_TYPE::IOEffect::GetStatus
80  //!Description: Indicates whether the IO effect has an effect on the sender,
81  //! receiver, message(s) or some combination of them.
82  // Parameter: IOStatus S
83  //************************************
84  void SetStatus( KDIS::DATA_TYPE::ENUMS::IOStatus S );
85  KDIS::DATA_TYPE::ENUMS::IOStatus GetStatus() const;
86 
87  //************************************
88  // FullName: KDIS::DATA_TYPE::IOEffect::SetLinkType
89  // KDIS::DATA_TYPE::IOEffect::GetLinkType
90  //!Description: The IO link type as a logical or physical link or node.
91  // Parameter: IOLinkType LT
92  //************************************
93  void SetLinkType( KDIS::DATA_TYPE::ENUMS::IOLinkType LT );
94  KDIS::DATA_TYPE::ENUMS::IOLinkType GetLinkType() const;
95 
96  //************************************
97  // FullName: KDIS::DATA_TYPE::IOEffect::SetEffectType
98  // KDIS::DATA_TYPE::IOEffect::GetEffectType
99  //!Description: The IO effect associated with this IO attack.
100  // Parameter: IOEffectType ET
101  //************************************
102  void SetEffectType( KDIS::DATA_TYPE::ENUMS::IOEffectType ET );
103  KDIS::DATA_TYPE::ENUMS::IOEffectType GetEffectType() const;
104 
105  //************************************
106  // FullName: KDIS::DATA_TYPE::IOEffect::SetEffectDutyCycle
107  // KDIS::DATA_TYPE::IOEffect::GetEffectDutyCycle
108  //!Description: The IO effect duty cycle represented as a percentage in
109  //! the range of 0 - 100% in one-percent increments.
110  //! Throws OUT_OF_BOUNDS exception if value is > 100.
111  // Parameter: KUINT8 EDC
112  //************************************
113  void SetEffectDutyCycle( KUINT8 EDC ) throw( KException );
114  KUINT8 GetEffectDutyCycle() const;
115 
116  //************************************
117  // FullName: KDIS::DATA_TYPE::IOEffect::SetEffectDuration
118  // KDIS::DATA_TYPE::IOEffect::GetEffectDuration
119  //!Description: Indicates the duration of the IO effect in seconds, from 1
120  //! to 65534 seconds.
121  //! It shall be set to indicate UNTIL_FURTHER_NOTICE (65535) if
122  //! the duration has no fixed amount of time.
123  //! It shall be set to zero only if the IO Effect field is set
124  //! to Terminate Effect(255).
125  // Parameter: KUINT16 ED
126  //************************************
127  void SetEffectDuration( KUINT16 ED );
128  KUINT16 GetEffectDuration() const;
129 
130  //************************************
131  // FullName: KDIS::DATA_TYPE::IOEffect::SetProcess
132  // KDIS::DATA_TYPE::IOEffect::GetProcess
133  //!Description: The IO process being performed.
134  // Parameter: KUINT16 P
135  //************************************
136  void SetProcess( KUINT16 P );
137  KUINT16 GetProcess() const;
138 
139  //************************************
140  // FullName: KDIS::DATA_TYPE::IOEffect::GetAsString
141  //!Description: Returns a string representation.
142  //************************************
143  virtual KString GetAsString() const;
144 
145  //************************************
146  // FullName: KDIS::DATA_TYPE::IOEffect::Decode
147  //!Description: Convert From Network Data.
148  // Parameter: KDataStream & stream
149  //************************************
150  virtual void Decode( KDataStream & stream ) throw( KException );
151 
152  //************************************
153  // FullName: KDIS::DATA_TYPE::IOEffect::Encode
154  //!Description: Convert To Network Data.
155  // Parameter: KDataStream & stream
156  //************************************
157  virtual KDataStream Encode() const;
158  virtual void Encode( KDataStream & stream ) const;
159 
160  KBOOL operator == ( const IOEffect & Value ) const;
161  KBOOL operator != ( const IOEffect & Value ) const;
162 };
163 
164 } // END namespace DATA_TYPES
165 } // END namespace KDIS
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: StandardVariable.h:62
KUINT16 m_ui16Proc
Definition: IOEffect.h:60
KUINT8 m_ui8EffDtyCyc
Definition: IOEffect.h:56
IOStatus
Definition: EnumInformationOperations.h:161
IOEffectType
Definition: EnumInformationOperations.h:205
Definition: KDefines.h:182
Definition: KDataStream.h:48
KUINT8 m_ui8Eff
Definition: IOEffect.h:54
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
unsigned char KUINT8
Definition: KDefines.h:99
IOLinkType
Definition: EnumInformationOperations.h:185
KUINT16 m_ui16EffDur
Definition: IOEffect.h:58
#define KDIS_EXPORT
Definition: KDefines.h:82
KUINT8 m_ui8Status
Definition: IOEffect.h:50
KUINT16 m_ui16Padding
Definition: IOEffect.h:62
Definition: IOEffect.h:46
KUINT8 m_ui8LnkTyp
Definition: IOEffect.h:52