KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ClockTime.h
Go to the documentation of this file.
1 /*********************************************************************
2 
3 Copyright 2013 Karl Jones
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8 
9 1. Redistributions of source code must retain the above copyright notice, this
10  list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 For Further Information Please Contact me at
27 Karljj1@yahoo.com
28 http://p.sf.net/kdis/UserGuide
29 *********************************************************************/
30 
31 /********************************************************************
32  class: ClockTime
33  created: 18/09/2008
34  author: Karl Jones
35 
36  purpose: Time measurements that surpass 1 hour are represented
37  by ClockTime. Time represented are either real world (UTC)
38  or simulation time.
39  size: 64 bits / 8 octets
40 *********************************************************************/
41 
42 #pragma once
43 
44 #include "./DataTypeBase.h"
45 
46 namespace KDIS {
47 namespace DATA_TYPE {
48 
50 {
51 protected:
52 
54 
56 
57 public:
58 
59  static const KUINT16 CLOCK_TIME_SIZE = 8;
60 
61  ClockTime();
62 
63  ClockTime( KINT32 Hour, KUINT32 TimePastHour );
64 
65  ClockTime( KDataStream & stream ) throw( KException );
66 
67  virtual ~ClockTime();
68 
69  //************************************
70  // FullName: KDIS::DATA_TYPE::ClockTime::SetHour
71  // KDIS::DATA_TYPE::ClockTime::GetHour
72  //!Description: Time.
73  // Parameter: KINT32 H, void
74  //************************************
75  void SetHour( KINT32 H );
76  KINT32 GetHour() const;
77 
78  //************************************
79  // FullName: KDIS::DATA_TYPE::ClockTime::SetTimePastHour
80  // KDIS::DATA_TYPE::ClockTime::GetTimePastHour
81  //!Description: Time Past Hour. The time past the hour field.
82  // Parameter: KFLOAT32 Z, void
83  //************************************
84  void SetTimePastHour( KUINT32 TPH );
85  KUINT32 GetTimePastHour() const;
86 
87  //************************************
88  // FullName: KDIS::DATA_TYPE::ClockTime::GetAsString
89  //!Description: Returns a string representation
90  //************************************
91  virtual KString GetAsString() const;
92 
93  //************************************
94  // FullName: KDIS::DATA_TYPE::ClockTime::Decode
95  //!Description: Convert From Network Data.
96  // Parameter: KDataStream & stream
97  //************************************
98  virtual void Decode( KDataStream & stream ) throw( KException );
99 
100  //************************************
101  // FullName: KDIS::DATA_TYPE::ClockTime::Encode
102  //!Description: Convert To Network Data.
103  // Parameter: KDataStream & stream
104  //************************************
105  virtual KDataStream Encode() const;
106  virtual void Encode( KDataStream & stream ) const;
107 
108  KBOOL operator == ( const ClockTime & Value ) const;
109  KBOOL operator != ( const ClockTime & Value ) const;
110  KBOOL operator < ( const ClockTime & Value ) const;
111 };
112 
113 } // END namespace DATA_TYPES
114 } // END namespace KDIS
115 
unsigned int KUINT32
Definition: KDefines.h:103
KUINT32 m_ui32TimePastHour
Definition: ClockTime.h:55
unsigned short int KUINT16
Definition: KDefines.h:101
Definition: KDefines.h:182
Definition: KDataStream.h:48
int KINT32
Definition: KDefines.h:104
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
std::string KString
Definition: KDefines.h:116
KINT32 m_i32Hour
Definition: ClockTime.h:53
#define KDIS_EXPORT
Definition: KDefines.h:82
Definition: ClockTime.h:49