GridComputing
Job Management in Grid Computing
Main Page
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
idleuser.h
Go to the documentation of this file.
1
#ifndef HASHTABLE_H_
2
#define HASHTABLE_H_
3
4
#include <unordered_map>
5
#include <string>
6
7
#include "
utils.h
"
8
#include "
interfaces.h
"
9
11
#define REMOVAL_TIME_SECS 3600
12
13
enum
UserType
;
14
class
User
;
15
17
20
class
IdleUser
:
public
IUpdate
,
public
ISave
,
public
IPrint
21
{
22
private
:
23
std::string
_name
;
24
uint
_id
;
25
UserType
_type
;
26
uint32
_elapsedTime
;
27
static
uint
_maxNameLength
;
28
29
public
:
30
IdleUser
(
const
std::string& name,
uint
id
,
UserType
type);
31
32
static
IdleUser
*
FromUser
(
const
User
* user);
33
34
const
std::string&
GetName
()
const
{
return
_name
; }
35
uint
GetId
()
const
{
return
_id
; }
36
UserType
GetUserType
()
const
{
return
_type
; }
37
uint32
GetElapsedTime
()
const
{
return
_elapsedTime
; }
38
39
virtual
bool
Save
(
ByteBuffer
& bb)
const
;
40
41
static
IdleUser
*
Load
(
ByteBuffer
& bb);
42
43
virtual
void
Update
(
uint32
diff);
44
45
virtual
void
Print
(std::ostream& os = std::cout)
const
;
46
static
void
PrintHeader
(std::ostream& os = std::cout);
47
};
48
50
53
class
IdleUserContainer
:
public
IUpdate
,
public
ISave
54
{
55
private
:
56
std::unordered_map<uint, IdleUser*>
_hashTable
;
57
58
public
:
59
const
std::unordered_map<uint, IdleUser*>&
GetContainer
()
const
{
return
_hashTable
; }
60
61
void
InsertUser
(
IdleUser
* user) {
_hashTable
[user->
GetId
()] = user; }
62
63
virtual
bool
Save
(
ByteBuffer
& bb)
const
;
64
65
static
IdleUserContainer
*
Load
(
ByteBuffer
& bb);
66
67
virtual
void
Update
(
uint32
diff);
68
};
69
70
#endif
src
idleuser.h
Generated on Sun Dec 30 2012 14:13:37 for GridComputing by
1.8.2