INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
timeout.h
1 /*
2  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3  * http://gearbox.sf.net/
4  * Copyright (c) 2008 Geoffrey Biggs
5  *
6  * flexiport flexible hardware data communications library.
7  *
8  * This distribution is licensed to you under the terms described in the LICENSE file included in
9  * this distribution.
10  *
11  * This work is a product of the National Institute of Advanced Industrial Science and Technology,
12  * Japan. Registration number: H20PRO-881
13  *
14  * This file is part of flexiport.
15  *
16  * flexiport is free software: you can redistribute it and/or modify it under the terms of the GNU
17  * Lesser General Public License as published by the Free Software Foundation, either version 3 of
18  * the License, or (at your option) any later version.
19  *
20  * flexiport is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
21  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License along with flexiport.
25  * If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef __TIMEOUT_H
29 #define __TIMEOUT_H
30 
31 #if defined (WIN32)
32  #if defined (FLEXIPORT_STATIC)
33  #define FLEXIPORT_EXPORT
34  #elif defined (FLEXIPORT_EXPORTS)
35  #define FLEXIPORT_EXPORT __declspec (dllexport)
36  #else
37  #define FLEXIPORT_EXPORT __declspec (dllimport)
38  #endif
39  #if !defined (timespec)
40  // No timespec on Windows
41  typedef struct timespec
42  {
43  int tv_sec;
44  int tv_nsec;
45  } timespec;
46  #endif
47 #else
48  #define FLEXIPORT_EXPORT
49 #endif
50 
51 struct timeval;
52 struct timespec;
53 
58 namespace flexiport
59 {
60 
62 class FLEXIPORT_EXPORT Timeout
63 {
64  public:
65  Timeout (int sec, int usec) : _sec (sec), _usec (usec) {}
66  Timeout (const Timeout &rhs) : _sec (rhs._sec), _usec (rhs._usec) {}
67 
68  void AsTimeval (struct timeval &dest) const;
69  void FromTimeval (const struct timeval &src);
70  void AsTimespec (struct timespec &dest) const;
71  void FromTimespec (const struct timespec &src);
72 
73  Timeout& operator= (const Timeout &rhs);
74  Timeout& operator= (const struct timeval &rhs);
75  Timeout& operator= (const struct timespec &rhs);
76 
77  int _sec;
78  int _usec;
79 };
80 
81 } // namespace flexiport
82 
85 #endif // __TIMEOUT_H
An object used to represent timeouts.
Definition: timeout.h:62
FlexiPort data communications library.
 

Generated for GearBox by  doxygen 1.4.5