timeout.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __TIMEOUT_H
00030 #define __TIMEOUT_H
00031
00032 #if defined (WIN32)
00033 #if defined (FLEXIPORT_STATIC)
00034 #define FLEXIPORT_EXPORT
00035 #elif defined (flexiport_EXPORTS)
00036 #define FLEXIPORT_EXPORT __declspec (dllexport)
00037 #else
00038 #define FLEXIPORT_EXPORT __declspec (dllimport)
00039 #endif
00040 #if !defined (timespec)
00041
00042 typedef struct timespec
00043 {
00044 int tv_sec;
00045 int tv_nsec;
00046 } timespec;
00047 #endif
00048 #else
00049 #define FLEXIPORT_EXPORT
00050 #endif
00051
00052 struct timeval;
00053 struct timespec;
00054
00059 namespace flexiport
00060 {
00061
00063 class FLEXIPORT_EXPORT Timeout
00064 {
00065 public:
00066 Timeout (int sec, int usec) : _sec (sec), _usec (usec) {}
00067 Timeout (const Timeout &rhs) : _sec (rhs._sec), _usec (rhs._usec) {}
00068
00069 void AsTimeval (struct timeval &dest) const;
00070 void FromTimeval (const struct timeval &src);
00071 void AsTimespec (struct timespec &dest) const;
00072 void FromTimespec (const struct timespec &src);
00073
00074 Timeout& operator= (const Timeout &rhs);
00075 Timeout& operator= (const struct timeval &rhs);
00076 Timeout& operator= (const struct timespec &rhs);
00077
00078 int _sec;
00079 int _usec;
00080 };
00081
00082 }
00083
00086 #endif // __TIMEOUT_H
00087