AGENT++
4.0.3
Main Page
Related Pages
Classes
Files
File List
File Members
include
agent_pp
tools.h
Go to the documentation of this file.
1
/*_############################################################################
2
_##
3
_## AGENT++ 4.0 - tools.h
4
_##
5
_## Copyright (C) 2000-2013 Frank Fock and Jochen Katz (agentpp.com)
6
_##
7
_## Licensed under the Apache License, Version 2.0 (the "License");
8
_## you may not use this file except in compliance with the License.
9
_## You may obtain a copy of the License at
10
_##
11
_## http://www.apache.org/licenses/LICENSE-2.0
12
_##
13
_## Unless required by applicable law or agreed to in writing, software
14
_## distributed under the License is distributed on an "AS IS" BASIS,
15
_## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
_## See the License for the specific language governing permissions and
17
_## limitations under the License.
18
_##
19
_##########################################################################*/
20
21
22
#ifndef tools_h_
23
#define tools_h_
24
25
#include <sys/types.h>
26
#include <time.h>
27
#include <stdio.h>
28
29
#include <
agent_pp/agent++.h
>
30
31
#ifdef AGENTPP_NAMESPACE
32
namespace
Agentpp {
33
#endif
34
35
36
class
AGENTPP_DECL
AgentTools
{
37
public
:
45
static
char
* make_concatenation(
const
char
*,
const
char
*);
46
52
static
long
file_size(FILE*);
53
};
54
56
// class Timer
57
//
58
59
60
class
AGENTPP_DECL
Timer
{
61
public
:
62
Timer
(): timestamp(0), lifetime(0) { }
63
Timer
(
int
life): timestamp(0), lifetime(life) { }
64
65
int
get_life
() {
return
lifetime; }
66
void
set_life
(
unsigned
int
sec) { lifetime = sec; }
67
68
bool
in_time();
69
int
due_time();
70
bool
in_time(
int
frac);
71
void
set_timestamp
() { time(×tamp); }
72
time_t
get_timestamp
() {
return
timestamp; }
73
74
protected
:
75
time_t
timestamp
;
76
int
lifetime
;
77
};
78
79
#ifdef AGENTPP_NAMESPACE
80
}
81
#endif
82
83
84
#endif
Generated by
1.8.2