Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
KM3NETDAQ::JDAQUTCExtended Class Reference

Data structure for UTC time. More...

#include <JDAQUTCExtended.hh>

Inheritance diagram for KM3NETDAQ::JDAQUTCExtended:
JDETECTOR::JModuleGeometry

Public Types

typedef unsigned int JUINT32_t
 

Public Member Functions

 JDAQUTCExtended ()
 Default constructor. More...
 
 JDAQUTCExtended (const JUINT32_t seconds, const JUINT32_t cycles)
 Constructor. More...
 
 JDAQUTCExtended (const double nanoseconds)
 Constructor. More...
 
virtual ~JDAQUTCExtended ()
 Virtual destructor. More...
 
JUINT32_t getUTCseconds () const
 Get time. More...
 
JUINT32_t getUTC16nanosecondcycles () const
 Get time. More...
 
double getTimeNanoSecond () const
 Get time (limited to 16 ns cycles). More...
 
void setTimeNanoSecond (const double utc_ns)
 Set time. More...
 
 ClassDef (JDAQUTCExtended, 1)
 

Static Public Member Functions

static int sizeOf ()
 Get size of object. More...
 

Protected Attributes

JUINT32_t UTC_seconds
 
JUINT32_t UTC_16nanosecondcycles
 

Friends

std::istream & operator>> (std::istream &in, JDAQUTCExtended &utc)
 Read UTC time. More...
 
std::ostream & operator<< (std::ostream &out, const JDAQUTCExtended &utc)
 Write UTC time. More...
 
JReaderoperator>> (JReader &in, JDAQUTCExtended &utc)
 Read UTC from input. More...
 
JWriteroperator<< (JWriter &out, const JDAQUTCExtended &utc)
 Write UTC to output. More...
 

Detailed Description

Data structure for UTC time.

Definition at line 26 of file JDAQUTCExtended.hh.

Member Typedef Documentation

Definition at line 30 of file JDAQUTCExtended.hh.

Constructor & Destructor Documentation

KM3NETDAQ::JDAQUTCExtended::JDAQUTCExtended ( )
inline

Default constructor.

Definition at line 36 of file JDAQUTCExtended.hh.

36  :
37  UTC_seconds(0),
39  {}
KM3NETDAQ::JDAQUTCExtended::JDAQUTCExtended ( const JUINT32_t  seconds,
const JUINT32_t  cycles 
)
inline

Constructor.

Parameters
secondsseconds [s]
cyclescycles [16 ns]

Definition at line 48 of file JDAQUTCExtended.hh.

49  :
50  UTC_seconds(seconds),
52  {}
KM3NETDAQ::JDAQUTCExtended::JDAQUTCExtended ( const double  nanoseconds)
inline

Constructor.

Parameters
nanosecondstime [ns]

Definition at line 60 of file JDAQUTCExtended.hh.

61  {
62  setTimeNanoSecond(nanoseconds);
63  }
void setTimeNanoSecond(const double utc_ns)
Set time.
virtual KM3NETDAQ::JDAQUTCExtended::~JDAQUTCExtended ( )
inlinevirtual

Virtual destructor.

Definition at line 69 of file JDAQUTCExtended.hh.

70  {}

Member Function Documentation

JUINT32_t KM3NETDAQ::JDAQUTCExtended::getUTCseconds ( ) const
inline

Get time.

Returns
time [s]

Definition at line 78 of file JDAQUTCExtended.hh.

79  {
80  return UTC_seconds;
81  }
JUINT32_t KM3NETDAQ::JDAQUTCExtended::getUTC16nanosecondcycles ( ) const
inline

Get time.

Returns
time [16 ns]

Definition at line 89 of file JDAQUTCExtended.hh.

90  {
92  }
double KM3NETDAQ::JDAQUTCExtended::getTimeNanoSecond ( ) const
inline

Get time (limited to 16 ns cycles).

Returns
time [ns]

Definition at line 100 of file JDAQUTCExtended.hh.

101  {
102  return UTC_seconds*1.0e9 + UTC_16nanosecondcycles*16.0;
103  }
void KM3NETDAQ::JDAQUTCExtended::setTimeNanoSecond ( const double  utc_ns)
inline

Set time.

Parameters
utc_nstime [ns]

Definition at line 111 of file JDAQUTCExtended.hh.

112  {
113  UTC_seconds = (unsigned int) ( utc_ns / 1.0e9);
114  UTC_16nanosecondcycles = (unsigned int) ((utc_ns - UTC_seconds*1.0e9) / 16.0);
115  }
static int KM3NETDAQ::JDAQUTCExtended::sizeOf ( )
inlinestatic

Get size of object.

Returns
number of bytes

Definition at line 193 of file JDAQUTCExtended.hh.

194  {
195  return 2*sizeof(JUINT32_t);
196  }
KM3NETDAQ::JDAQUTCExtended::ClassDef ( JDAQUTCExtended  ,
 
)

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JDAQUTCExtended utc 
)
friend

Read UTC time.

Parameters
inintput stream
utcUTC extended time
Returns
intput stream

Definition at line 125 of file JDAQUTCExtended.hh.

126  {
127  in >> utc.UTC_seconds;
128  in.get();
129  in >> utc.UTC_16nanosecondcycles;
130 
131  return in;
132  }
std::ostream& operator<< ( std::ostream &  out,
const JDAQUTCExtended utc 
)
friend

Write UTC time.

Parameters
outoutput stream
utcUTC extended time
Returns
output stream

Definition at line 142 of file JDAQUTCExtended.hh.

143  {
144  using namespace std;
145 
146  const char c = out.fill();
147 
148  out << setw(10) << utc.getUTCseconds();
149  out << ':';
150  out << setw(10) << setfill('0') << utc.getUTC16nanosecondcycles() << setfill(c);
151 
152  return out;
153  }
JReader& operator>> ( JReader in,
JDAQUTCExtended utc 
)
friend

Read UTC from input.

Parameters
inreader
utcUTC
Returns
reader

Definition at line 163 of file JDAQUTCExtended.hh.

164  {
165  in >> utc.UTC_seconds;
166  in >> utc.UTC_16nanosecondcycles;
167 
168  return in;
169  }
JWriter& operator<< ( JWriter out,
const JDAQUTCExtended utc 
)
friend

Write UTC to output.

Parameters
outwriter
utcUTC
Returns
writer

Definition at line 179 of file JDAQUTCExtended.hh.

180  {
181  out << utc.UTC_seconds;
182  out << utc.UTC_16nanosecondcycles;
183 
184  return out;
185  }

Member Data Documentation

JUINT32_t KM3NETDAQ::JDAQUTCExtended::UTC_seconds
protected

Definition at line 203 of file JDAQUTCExtended.hh.

JUINT32_t KM3NETDAQ::JDAQUTCExtended::UTC_16nanosecondcycles
protected

Definition at line 204 of file JDAQUTCExtended.hh.


The documentation for this class was generated from the following file: