Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/net/netDatagram.cxx

Go to the documentation of this file.
00001 // Filename: netDatagram.cxx
00002 // Created by:  jns (07Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "netDatagram.h"
00020 
00021 TypeHandle NetDatagram::_type_handle;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: NetDatagram::Constructor
00025 //       Access: Public
00026 //  Description: Constructs an empty datagram.
00027 ////////////////////////////////////////////////////////////////////
00028 NetDatagram::
00029 NetDatagram() {
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: NetDatagram::Constructor
00034 //       Access: Public
00035 //  Description: Constructs a datagram from an existing block of data.
00036 ////////////////////////////////////////////////////////////////////
00037 NetDatagram::
00038 NetDatagram(const void *data, size_t size) :
00039   Datagram(data, size) {
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: NetDatagram::Copy Constructor
00044 //       Access: Public
00045 //  Description:
00046 ////////////////////////////////////////////////////////////////////
00047 NetDatagram::
00048 NetDatagram(const Datagram &copy) :
00049   Datagram(copy)
00050 {
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: NetDatagram::Copy Constructor
00055 //       Access: Public
00056 //  Description:
00057 ////////////////////////////////////////////////////////////////////
00058 NetDatagram::
00059 NetDatagram(const NetDatagram &copy) :
00060   Datagram(copy),
00061   _connection(copy._connection),
00062   _address(copy._address)
00063 {
00064 }
00065 
00066 ////////////////////////////////////////////////////////////////////
00067 //     Function: NetDatagram::Copy Assignment Operator
00068 //       Access: Public
00069 //  Description:
00070 ////////////////////////////////////////////////////////////////////
00071 void NetDatagram::
00072 operator = (const Datagram &copy) {
00073   Datagram::operator = (copy);
00074   _connection.clear();
00075   _address.clear();
00076 }
00077 
00078 ////////////////////////////////////////////////////////////////////
00079 //     Function: NetDatagram::Copy Assignment Operator
00080 //       Access: Public
00081 //  Description:
00082 ////////////////////////////////////////////////////////////////////
00083 void NetDatagram::
00084 operator = (const NetDatagram &copy) {
00085   Datagram::operator = (copy);
00086   _connection = copy._connection;
00087   _address = copy._address;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: NetDatagram::clear
00092 //       Access: Public, Virtual
00093 //  Description: Resets the datagram to empty, in preparation for
00094 //               building up a new datagram.
00095 ////////////////////////////////////////////////////////////////////
00096 void NetDatagram::
00097 clear() {
00098   Datagram::clear();
00099   _connection.clear();
00100   _address.clear();
00101 }
00102 
00103 ////////////////////////////////////////////////////////////////////
00104 //     Function: NetDatagram::set_connection
00105 //       Access: Public
00106 //  Description: Specifies the socket to which the datagram should be
00107 //               written.
00108 ////////////////////////////////////////////////////////////////////
00109 void NetDatagram::
00110 set_connection(const PT(Connection) &connection) {
00111   _connection = connection;
00112 }
00113 
00114 ////////////////////////////////////////////////////////////////////
00115 //     Function: NetDatagram::set_connection
00116 //       Access: Public
00117 //  Description: Retrieves the socket from which the datagram was
00118 //               read, or to which it is scheduled to be written.
00119 ////////////////////////////////////////////////////////////////////
00120 PT(Connection) NetDatagram::
00121 get_connection() const {
00122   return _connection;
00123 }
00124 
00125 ////////////////////////////////////////////////////////////////////
00126 //     Function: NetDatagram::set_address
00127 //       Access: Public
00128 //  Description: Specifies the host to which the datagram should be
00129 //               sent.
00130 ////////////////////////////////////////////////////////////////////
00131 void NetDatagram::
00132 set_address(const NetAddress &address) {
00133   _address = address;
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////
00137 //     Function: NetDatagram::set_address
00138 //       Access: Public
00139 //  Description: Retrieves the host from which the datagram was
00140 //               read, or to which it is scheduled to be sent.
00141 ////////////////////////////////////////////////////////////////////
00142 const NetAddress &NetDatagram::
00143 get_address() const {
00144   return _address;
00145 }

Generated on Fri May 2 00:40:35 2003 for Panda by doxygen1.3