00001 // Filename: pStatClient.I 00002 // Created by: drose (16Jul00) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: PStatClient::set_client_name 00022 // Access: Public 00023 // Description: Sets the name of the client. This is reported to the 00024 // PStatsServer, and will presumably be written in the 00025 // title bar or something. 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE void PStatClient:: 00028 set_client_name(const string &name) { 00029 _client_name = name; 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: PStatClient::get_client_name 00034 // Access: Public 00035 // Description: Retrieves the name of the client as set. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE string PStatClient:: 00038 get_client_name() const { 00039 return _client_name; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: PStatClient::set_max_rate 00044 // Access: Public 00045 // Description: Controls the number of packets that will be sent to 00046 // the server. Normally, one packet is sent per frame, 00047 // but this can flood the server with more packets than 00048 // it can handle if the frame rate is especially good 00049 // (e.g. if nothing is onscreen at the moment). Set 00050 // this parameter to a reasonable number to prevent this 00051 // from happening. 00052 // 00053 // This number specifies the maximum number of packets 00054 // that will be sent to the server per second, per 00055 // thread. 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE void PStatClient:: 00058 set_max_rate(float rate) { 00059 _max_rate = rate; 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: PStatClient::get_max_rate 00064 // Access: Public 00065 // Description: Returns the maximum number of packets that will be 00066 // sent to the server per second, per thread. See 00067 // set_max_rate(). 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE float PStatClient:: 00070 get_max_rate() const { 00071 return _max_rate; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: PStatClient::connect 00076 // Access: Published 00077 // Description: Attempts to establish a connection to the indicated 00078 // PStatServer. Returns true if successful, false on 00079 // failure. 00080 //////////////////////////////////////////////////////////////////// 00081 INLINE bool PStatClient:: 00082 connect(const string &hostname, int port) { 00083 return get_global_pstats()->client_connect(hostname, port); 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function: PStatClient::disconnect 00088 // Access: Published 00089 // Description: Closes the connection previously established. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE void PStatClient:: 00092 disconnect() { 00093 get_global_pstats()->client_disconnect(); 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: PStatClient::is_connected 00098 // Access: Published 00099 // Description: Returns true if the client believes it is connected 00100 // to a working PStatServer, false otherwise. 00101 //////////////////////////////////////////////////////////////////// 00102 INLINE bool PStatClient:: 00103 is_connected() { 00104 return get_global_pstats()->client_is_connected(); 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: PStatClient::resume_after_pause 00109 // Access: Published 00110 // Description: Resumes the PStatClient after the simulation has been 00111 // paused for a while. This allows the stats to 00112 // continue exactly where it left off, instead of 00113 // leaving a big gap that would represent a chug. 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE void PStatClient:: 00116 resume_after_pause() { 00117 get_global_pstats()->client_resume_after_pause(); 00118 }