Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9304 in orxonox.OLD


Ignore:
Timestamp:
Jul 17, 2006, 1:42:41 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: virtual public and an ip class

Location:
branches/proxy/src/lib
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/coord/p_node.h

    r8711 r9304  
    2020
    2121#include "base_object.h"
    22 #include "stdincl.h"
    2322#include "synchronizeable.h"
    2423
     
    7473
    7574//! 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, virtual public Synchronizeable {
     75class PNode : virtual public BaseObject, public Synchronizeable {
    7776 public:
    7877  PNode (PNode* parent = PNode::getNullParent(), long nodeFlags = PNODE_PARENT_MODE_DEFAULT);
     
    112111  /** @returns the absolute position */
    113112  inline const Vector& getLastAbsCoor () const { return this->lastAbsCoordinate; };
    114  
     113
    115114  void shiftCoor (const Vector& shift);
    116115  void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); };
  • branches/proxy/src/lib/lang/base_object.cc

    r8145 r9304  
    2323
    2424#include "synchronizeable.h"
    25 
    26 using namespace std;
    2725
    2826
  • branches/proxy/src/lib/network/netdefs.h

    r9302 r9304  
    2020 * @file network_manager.h
    2121 *  Main interface for the network module. Manages all the modules
    22 
    2322 */
    2423
  • branches/proxy/src/lib/util/ip.cc

    r9303 r9304  
    11/**
    2  * @file timer.cc
    3  * @brief A Timer class, that handles all about time.
     2 * @file ip.cc
     3 * @brief A IP class, that handles all about time.
    44 *
    55 * code taken from audiere.
    66 */
    77
    8 #include "timer.h"
     8#include "ip.h"
     9
     10IP::IP()
     11{}
    912
    1013
    11 #include <time.h>
    12 #include <sys/time.h>
     14IP::IP(int ip)
     15{
     16  this->_ip = ip;
     17}
    1318
    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;
     19IP::IP(const std::string& ip)
     20{
     21  this->_ip = IP::stringToIP(ip);
    2422}
    25 #endif
    2623
    27 /**
    28  * @returns the current time in Second exact to the micro-second
    29  */
    30 double Timer::getNow() {
    3124
    32 #if HAVE_CLOCK_GETTIME
     25int IP::stringToIP(const std::string& ip)
     26{
    3327
    34    // use the POSIX realtime clock to get the current time
    35     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 #endif
    4128
    42     // can't use realtime clock!  Try to use gettimeofday
    43     struct timeval tv;
    44     gettimeofday(&tv, 0);
    45     return tv.tv_sec + tv.tv_usec / 1000000.0;
    4629}
     30
     31const 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  
    11
    22/*!
    3  * @file timer.h
     3 * @file ip.h
    44 * @brief Definition of Time Class.
    55 *
     
    77 */
    88
    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
    1116
    1217//! A class to handle time itself
    13 class Timer
     18class IP
    1419{
    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.
    1739
    1840
    1941};
    2042
    21 #endif /* __TIMER_H__ */
     43#endif /* __IP_H__ */
Note: See TracChangeset for help on using the changeset viewer.