MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
mbsleep.h
Go to the documentation of this file.
1 /*
2  * MBDyn (C) is a multibody analysis code.
3  * http://www.mbdyn.org
4  *
5  * Copyright (C) 1996-2017
6  *
7  * Pierangelo Masarati <masarati@aero.polimi.it>
8  * Paolo Mantegazza <mantegazza@aero.polimi.it>
9  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29  */
30 
31 #ifndef MBSLEEP_H
32 #define MBSLEEP_H
33 
34 #include "ac/f2c.h"
35 #include "math.h"
36 
37 #ifdef __cplusplus
38 #include <ostream>
39 extern "C" {
40 #endif /* __cplusplus */
41 
42 #if defined(HAVE_NANOSLEEP)
43 #include <time.h>
44 typedef struct timespec mbsleep_t;
45 #define MBSLEEP_ISZERO(mbs) (((mbs).tv_sec == 0) && ((mbs).tv_nsec == 0))
46 #elif defined(HAVE_USLEEP)
47 #include <unistd.h>
48 typedef useconds_t mbsleep_t;
49 #define MBSLEEP_ISZERO(mbs) ((mbs) == 0)
50 #else /* ! USLEEP */
51 typedef unsigned long mbsleep_t;
52 #define MBSLEEP_ISZERO(mbs) ((mbs) == 0)
53 #endif /* ! SLEEP */
54 
55 extern mbsleep_t mbsleep_init(long t);
56 extern int mbsleep_real2sleep(doublereal d, mbsleep_t *t);
57 extern int mbsleep_sleep2real(const mbsleep_t *t, doublereal *d);
58 extern int mbsleep(const mbsleep_t *t);
59 
60 #ifdef __cplusplus
61 }
62 
63 #ifdef HAVE_NANOSLEEP
64 extern std::ostream& operator << (std::ostream& out, const mbsleep_t& t);
65 
66 extern bool operator < (const mbsleep_t& t1, const mbsleep_t& t2);
67 extern bool operator > (const mbsleep_t& t1, const mbsleep_t& t2);
68 extern bool operator <= (const mbsleep_t& t1, const mbsleep_t& t2);
69 extern bool operator >= (const mbsleep_t& t1, const mbsleep_t& t2);
70 extern bool operator == (const mbsleep_t& t1, const mbsleep_t& t2);
71 extern bool operator != (const mbsleep_t& t1, const mbsleep_t& t2);
72 
73 extern bool operator < (const mbsleep_t& t1, const long& t2);
74 extern bool operator > (const mbsleep_t& t1, const long& t2);
75 extern bool operator <= (const mbsleep_t& t1, const long& t2);
76 extern bool operator >= (const mbsleep_t& t1, const long& t2);
77 extern bool operator == (const mbsleep_t& t1, const long& t2);
78 extern bool operator != (const mbsleep_t& t1, const long& t2);
79 /* otherwise operators are not needed */
80 #endif /* HAVE_NANOSLEEP */
81 
82 #endif /* __cplusplus */
83 
84 #endif /* MBSLEEP_H */
GradientExpression< BoolExpr< FuncLessEqual, LhsExpr, RhsExpr > > operator<=(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2966
GradientExpression< BoolExpr< FuncNotEqualTo, LhsExpr, RhsExpr > > operator!=(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2970
GradientExpression< BoolExpr< FuncEqualTo, LhsExpr, RhsExpr > > operator==(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2969
int mbsleep(const mbsleep_t *t)
Definition: mbsleep.c:90
mbsleep_t mbsleep_init(long t)
Definition: mbsleep.c:38
unsigned long mbsleep_t
Definition: mbsleep.h:51
int mbsleep_sleep2real(const mbsleep_t *t, doublereal *d)
Definition: mbsleep.c:74
GradientExpression< BoolExpr< FuncGreaterEqual, LhsExpr, RhsExpr > > operator>=(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2968
GradientExpression< BoolExpr< FuncLessThan, LhsExpr, RhsExpr > > operator<(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2965
GradientExpression< BoolExpr< FuncGreaterThan, LhsExpr, RhsExpr > > operator>(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2967
std::ostream & operator<<(std::ostream &out, const FullMatrixHandler &m)
Definition: fullmh.cc:352
double doublereal
Definition: colamd.c:52
int mbsleep_real2sleep(doublereal d, mbsleep_t *t)
Definition: mbsleep.c:49