Jpp  15.0.1
the software that should make you happy
 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 JDAQUTCExtended min ()
 Get minimum possible value. More...
 
static JDAQUTCExtended max ()
 Get maximum possible value. More...
 
static JUINT32_t getMask ()
 Get mask for seconds data. More...
 
static double getTick ()
 Get number of nano-seconds per tick. More...
 

Protected Attributes

JUINT32_t UTC_seconds
 
JUINT32_t UTC_16nanosecondcycles
 

Friends

size_t getSizeof ()
 Definition of method to get size of data type. More...
 
JReaderoperator>> (JReader &, JDAQUTCExtended &)
 Read UTC from input. More...
 
JWriteroperator<< (JWriter &, const JDAQUTCExtended &)
 Write UTC to output. More...
 
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...
 

Detailed Description

Data structure for UTC time.

Definition at line 22 of file JDAQUTCExtended.hh.

Member Typedef Documentation

Definition at line 26 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 & getMask());
81  }
static JUINT32_t getMask()
Get mask for seconds data.
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 getUTCseconds() * 1.0e9 + getUTC16nanosecondcycles() * getTick();
103  }
static double getTick()
Get number of nano-seconds per tick.
JUINT32_t getUTC16nanosecondcycles() const
Get time.
JUINT32_t getUTCseconds() const
Get time.
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) / getTick());
115  }
static double getTick()
Get number of nano-seconds per tick.
static JDAQUTCExtended KM3NETDAQ::JDAQUTCExtended::min ( )
inlinestatic

Get minimum possible value.

Returns
minimum possible value

Definition at line 123 of file JDAQUTCExtended.hh.

124  {
125  return JDAQUTCExtended(0,0);
126  }
JDAQUTCExtended()
Default constructor.
static JDAQUTCExtended KM3NETDAQ::JDAQUTCExtended::max ( )
inlinestatic

Get maximum possible value.

Returns
maximum possible value

Definition at line 134 of file JDAQUTCExtended.hh.

135  {
136  return JDAQUTCExtended(std::numeric_limits<JUINT32_t>::max(),
137  std::numeric_limits<JUINT32_t>::max());
138  }
JDAQUTCExtended()
Default constructor.
static JUINT32_t KM3NETDAQ::JDAQUTCExtended::getMask ( )
inlinestatic

Get mask for seconds data.

Returns
mask

Definition at line 146 of file JDAQUTCExtended.hh.

147  {
148  return 0x7FFFFFFF;
149  }
static double KM3NETDAQ::JDAQUTCExtended::getTick ( )
inlinestatic

Get number of nano-seconds per tick.

Returns
time [ns]

Definition at line 157 of file JDAQUTCExtended.hh.

158  {
159  return 16.0;
160  }
KM3NETDAQ::JDAQUTCExtended::ClassDef ( JDAQUTCExtended  ,
 
)

Friends And Related Function Documentation

size_t getSizeof ( )
friend

Definition of method to get size of data type.

This method should be specialised for each desired data type with fixed length.

Returns
number of bytes
JReader& operator>> ( JReader in,
JDAQUTCExtended utc 
)
friend

Read UTC from input.

Parameters
inreader
utcUTC
Returns
reader

Definition at line 33 of file JDAQUTCExtendedIO.hh.

34  {
35  in >> utc.UTC_seconds;
36  in >> utc.UTC_16nanosecondcycles;
37 
38  return in;
39  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
JWriter& operator<< ( JWriter out,
const JDAQUTCExtended utc 
)
friend

Write UTC to output.

Parameters
outwriter
utcUTC
Returns
writer

Definition at line 49 of file JDAQUTCExtendedIO.hh.

50  {
51  out << utc.UTC_seconds;
52  out << utc.UTC_16nanosecondcycles;
53 
54  return out;
55  }
std::istream& operator>> ( std::istream &  in,
JDAQUTCExtended utc 
)
friend

Read UTC time.

Parameters
inintput stream
utcUTC extended time
Returns
intput stream

Definition at line 170 of file JDAQUTCExtended.hh.

171  {
172  in >> utc.UTC_seconds;
173  in.get();
174  in >> utc.UTC_16nanosecondcycles;
175 
176  return in;
177  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
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 187 of file JDAQUTCExtended.hh.

188  {
189  using namespace std;
190 
191  const char c = out.fill();
192 
193  out << setw(10) << utc.getUTCseconds();
194  out << ':';
195  out << setw(10) << setfill('0') << utc.getUTC16nanosecondcycles() << setfill(c);
196 
197  return out;
198  }
JUINT32_t getUTC16nanosecondcycles() const
Get time.
JUINT32_t getUTCseconds() const
Get time.

Member Data Documentation

JUINT32_t KM3NETDAQ::JDAQUTCExtended::UTC_seconds
protected

Definition at line 205 of file JDAQUTCExtended.hh.

JUINT32_t KM3NETDAQ::JDAQUTCExtended::UTC_16nanosecondcycles
protected

Definition at line 206 of file JDAQUTCExtended.hh.


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