- Main Page
- Classes
- Files

- Search for |

# TimePacket.h

    00001 /*****************************
    00002 File:      TimePacket.h
    00003 Language:   C++ (header)
    00004 Project:    H3DNetworkingUtils
    00005 The contents of this file are subject to the Mozilla Public License
    00006 Version 1.1 (the "License"); you may not use this file except in
    00007 compliance with the License. You may obtain a copy of the License at
    00008 http://www.mozilla.org/MPL/
    00009
    00010 Software distributed under the License is distributed on an "AS IS"
    00011 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    00012 License for the specific language governing rights and limitations
    00013 under the License.
    00014
    00015 The Original Code is H3DNetworkingUtils v1.0.
    00016
    00017 The Initial Developer of the Original Code is CSIRO.
    00018 Portions created by the Initial Developer are Copyright (C) 1009 CSIRO. All Rights Reserved.
    00019 Contributor(s):
    00020     Chris Gunn  <Chris.Gunn@csiro.au> <ChrisJGunn@gmail.com>
    00021 ***************************/
    00022
    00023 // The TimePacket class provides a packet of data representing a time value that can be sent across a network.
    00024
    00025 #ifndef TimePacket_H
    00026 #define TimePacket_H
    00027
    00028 #include <iostream>
    00029
    00030 #include <H3DUtil/H3DBasicTypes.h>
    00031
    00032 class H3D_NETWORKING_UTILS_DLL_SPEC TimePacket {
    00033 public:
    00034   bool state;
    00035   H3D::H3DTime send_time;
    00036   H3D::H3DTime remote_time;
    00037   H3D::H3DTime receive_time;
    00038   bool operator==(TimePacket const & other) const {
    00039     return ((send_time == other.send_time) &&
    00040             (remote_time == other.remote_time) &&
    00041             (receive_time == other.receive_time));
    00042   }
    00043   TimePacket() : state (false), send_time(0), remote_time(0), receive_time(0) {}
    00044   virtual ~TimePacket() {std::cerr << "~TimePacket" << std::endl;}
    00045   TimePacket & operator=(TimePacket const & other) {
    00046     if (this == &other)
    00047       return *this;
    00048     send_time = other.send_time;
    00049     remote_time = other.remote_time;
    00050     receive_time = other.receive_time;
    00051     state = other.state;
    00052     return *this;
    00053   }
    00054   TimePacket(TimePacket const & other) :
    00055     send_time (other.send_time),
    00056     remote_time (other.remote_time),
    00057     receive_time (other.receive_time),
    00058     state (other.state) {}
    00059 };
    00060
    00061 inline std::ostream& operator<<(std::ostream& out, const TimePacket& T) {
    00062   out << T.send_time << '.. ' << T.remote_time << '.. ' << T.receive_time << std::endl;
    00063   return out;
    00064 }
    00065
    00066 //inline bool TimePacket::operator==(const & TimePacket other) const {
    00067 //  return ((send_time == other.send_time) &&
    00068 //          (remote_time == other.remote_time) &&
    00069 //          (receive_time == other.receive_time));
    00070 //}
    00071
    00072 #endif