Changeset 9304 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 17, 2006, 1:42:41 PM (18 years ago)
- Location:
- branches/proxy/src/lib
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/coord/p_node.h
r8711 r9304 20 20 21 21 #include "base_object.h" 22 #include "stdincl.h"23 22 #include "synchronizeable.h" 24 23 … … 74 73 75 74 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent. 76 class PNode : virtual public BaseObject, virtualpublic Synchronizeable {75 class PNode : virtual public BaseObject, public Synchronizeable { 77 76 public: 78 77 PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT); … … 112 111 /** @returns the absolute position */ 113 112 inline const Vector& getLastAbsCoor () const { return this->lastAbsCoordinate; }; 114 113 115 114 void shiftCoor (const Vector& shift); 116 115 void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); }; -
branches/proxy/src/lib/lang/base_object.cc
r8145 r9304 23 23 24 24 #include "synchronizeable.h" 25 26 using namespace std;27 25 28 26 -
branches/proxy/src/lib/network/netdefs.h
r9302 r9304 20 20 * @file network_manager.h 21 21 * Main interface for the network module. Manages all the modules 22 23 22 */ 24 23 -
branches/proxy/src/lib/util/ip.cc
r9303 r9304 1 1 /** 2 * @file timer.cc3 * @brief A Timerclass, that handles all about time.2 * @file ip.cc 3 * @brief A IP class, that handles all about time. 4 4 * 5 5 * code taken from audiere. 6 6 */ 7 7 8 #include "timer.h" 8 #include "ip.h" 9 10 IP::IP() 11 {} 9 12 10 13 11 #include <time.h> 12 #include <sys/time.h> 14 IP::IP(int ip) 15 { 16 this->_ip = ip; 17 } 13 18 14 #ifdef __WIN32__ 15 #include <windows.h> 16 int gettimeofday 17 (struct timeval* tp, void* tzp) { 18 DWORD t; 19 t = timeGetTime(); 20 tp->tv_sec = t / 1000; 21 tp->tv_usec = 1000 * (t % 1000 ); 22 /* 0 indicates success. */ 23 return 0; 19 IP::IP(const std::string& ip) 20 { 21 this->_ip = IP::stringToIP(ip); 24 22 } 25 #endif26 23 27 /**28 * @returns the current time in Second exact to the micro-second29 */30 double Timer::getNow() {31 24 32 #if HAVE_CLOCK_GETTIME 25 int IP::stringToIP(const std::string& ip) 26 { 33 27 34 // use the POSIX realtime clock to get the current time35 struct timespec tp;36 int result = clock_gettime(CLOCK_REALTIME, &tp);37 if (result == 0) {38 return tp.tv_sec * tp.tv_nsec / 1000000000.0;39 }40 #endif41 28 42 // can't use realtime clock! Try to use gettimeofday43 struct timeval tv;44 gettimeofday(&tv, 0);45 return tv.tv_sec + tv.tv_usec / 1000000.0;46 29 } 30 31 const std::string& IP::ipToString(int ip) 32 { 33 std::string ipaddr; 34 35 number = SDLNet_Read32 (&addr.host); 36 printf ("Host-Reihenfolge: %d.%d.%d.%d\n", 37 (number & 0xFF000000)>>24, (number & 0x00FF0000)>>16, 38 (number & 0x0000FF00)>>8, (number & 0x000000FF)); 39 } 40 -
branches/proxy/src/lib/util/ip.h
r9303 r9304 1 1 2 2 /*! 3 * @file timer.h3 * @file ip.h 4 4 * @brief Definition of Time Class. 5 5 * … … 7 7 */ 8 8 9 #ifndef __TIMER_H__ 10 #define __TIMER_H__ 9 #ifndef __IP_H__ 10 #define __IP_H__ 11 12 #include <string> 13 14 #include "netdefs.h" 15 11 16 12 17 //! A class to handle time itself 13 class Timer18 class IP 14 19 { 15 public: 16 static double getNow(); 20 public: 21 IP(); 22 IP(const std::string& ip); 23 IP(int ip); 24 25 26 float ip() const; 27 float ip(unsigned int part) const; 28 29 std::string& ipString() const; 30 31 32 33 public: 34 static int stringToIP(const std::string& ip); 35 static const std::string& ipToString(int ip); 36 37 private: 38 int _ip; //!< the IP in int form. 17 39 18 40 19 41 }; 20 42 21 #endif /* __ TIMER_H__ */43 #endif /* __IP_H__ */
Note: See TracChangeset
for help on using the changeset viewer.