Jpp
master_rocky-40-g5f0272dcd
the software that should make you happy
software
JNet
JSocketStatus.hh
Go to the documentation of this file.
1
#ifndef __JNET__JSOCKETSTATUS__
2
#define __JNET__JSOCKETSTATUS__
3
4
#include "
JLang/JException.hh
"
5
6
7
/**
8
* \author mdejong
9
*/
10
11
namespace
JNET
{}
12
namespace
JPP
{
using namespace
JNET
; }
13
14
namespace
JNET
{
15
16
using
JLANG::JSocketException
;
17
18
19
/**
20
* Auxiliary class for non-blocking socket I/O.
21
*/
22
class
JSocketStatus
23
{
24
public
:
25
26
enum
JStatus_t
{
IO_RESET
= -1,
IO_READY
= 0,
IO_BUSY
= +1 };
27
28
29
/**
30
* Default constructor.
31
*/
32
JSocketStatus
() :
33
status
(
IO_RESET
),
34
counter
(0)
35
{}
36
37
38
/**
39
* Get status of I/O.
40
*
41
* \return status
42
*/
43
JStatus_t
getStatus
()
const
44
{
45
return
status
;
46
}
47
48
49
/**
50
* Check reset status.
51
*
52
* \return true if reset; else false
53
*/
54
bool
isReset
()
const
55
{
56
return
status
==
IO_RESET
;
57
}
58
59
60
/**
61
* Check busy status.
62
*
63
* \return true if busy; else false
64
*/
65
bool
isBusy
()
const
66
{
67
return
status
==
IO_BUSY
;
68
}
69
70
71
/**
72
* Check ready status.
73
*
74
* \return true if ready; else false
75
*/
76
bool
isReady
()
const
77
{
78
return
status
==
IO_READY
;
79
}
80
81
82
/**
83
* Get number of I/O attempts.
84
*
85
* \return number of I/O attempts
86
*/
87
int
getCounter
()
const
88
{
89
return
counter
;
90
}
91
92
93
/**
94
* Reset
95
*/
96
void
reset
()
97
{
98
status
=
IO_RESET
;
99
counter
= 0;
100
}
101
102
103
protected
:
104
/**
105
* Set status of I/O.
106
*
107
* \param status status
108
*/
109
void
setStatus
(
const
JStatus_t
status
)
110
{
111
this->status =
status
;
112
}
113
114
115
JStatus_t
status
;
116
int
counter
;
117
};
118
}
119
120
#endif
JException.hh
Exceptions.
JLANG::JSocketException
Exception for socket.
Definition:
JException.hh:468
JNET::JSocketStatus
Auxiliary class for non-blocking socket I/O.
Definition:
JSocketStatus.hh:23
JNET::JSocketStatus::JStatus_t
JStatus_t
Definition:
JSocketStatus.hh:26
JNET::JSocketStatus::IO_BUSY
@ IO_BUSY
Definition:
JSocketStatus.hh:26
JNET::JSocketStatus::IO_READY
@ IO_READY
Definition:
JSocketStatus.hh:26
JNET::JSocketStatus::IO_RESET
@ IO_RESET
Definition:
JSocketStatus.hh:26
JNET::JSocketStatus::getStatus
JStatus_t getStatus() const
Get status of I/O.
Definition:
JSocketStatus.hh:43
JNET::JSocketStatus::counter
int counter
Definition:
JSocketStatus.hh:116
JNET::JSocketStatus::setStatus
void setStatus(const JStatus_t status)
Set status of I/O.
Definition:
JSocketStatus.hh:109
JNET::JSocketStatus::getCounter
int getCounter() const
Get number of I/O attempts.
Definition:
JSocketStatus.hh:87
JNET::JSocketStatus::JSocketStatus
JSocketStatus()
Default constructor.
Definition:
JSocketStatus.hh:32
JNET::JSocketStatus::isReady
bool isReady() const
Check ready status.
Definition:
JSocketStatus.hh:76
JNET::JSocketStatus::isBusy
bool isBusy() const
Check busy status.
Definition:
JSocketStatus.hh:65
JNET::JSocketStatus::isReset
bool isReset() const
Check reset status.
Definition:
JSocketStatus.hh:54
JNET::JSocketStatus::reset
void reset()
Reset.
Definition:
JSocketStatus.hh:96
JNET::JSocketStatus::status
JStatus_t status
Definition:
JSocketStatus.hh:115
JNET
Definition:
JDataFilter.cc:73
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:43
Generated by
1.9.1