Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
bdc03058
Commit
bdc03058
authored
Nov 30, 2012
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Для того, чтобы не ломать сборку старых проектов, вернул файл SandClock.h,
но объявил его DEPRECATED.
parent
266585aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
1 deletion
+133
-1
libuniset.spec
conf/libuniset.spec
+4
-1
SandClock.h
include/SandClock.h
+129
-0
No files found.
conf/libuniset.spec
View file @
bdc03058
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.5
Release: alt
6
Release: alt
7
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -211,6 +211,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Nov 30 2012 Pavel Vainerman <pv@altlinux.ru> 1.5-alt7
- returned file 'SandClock.h' back and declared it obsolete
* Thu Nov 29 2012 Pavel Vainerman <pv@altlinux.ru> 1.5-alt6
- add DelayTimer class
- rename SandClock --> HourGlass
...
...
include/SandClock.h
0 → 100644
View file @
bdc03058
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
// idea: lav@etersoft.ru
// realisation: pv@etersoft.ru, lav@etersoft.ru
// --------------------------------------------------------------------------
#ifndef SandClock_H_
#define SandClock_H_
// --------------------------------------------------------------------------
/*! WARNING! This class is DEPRECATED! Use HourGlass.. */
// --------------------------------------------------------------------------
#include "PassiveTimer.h"
// --------------------------------------------------------------------------
/*! WARNING! This class is DEPRECATED! Use HourGlass.. */
class
SandClock
{
public
:
SandClock
()
:
_state
(
false
),
_sand
(
0
),
_size
(
0
){}
~
SandClock
(){}
// запустить часы (заново)
inline
void
run
(
int
msec
)
{
t
.
setTiming
(
msec
);
_state
=
true
;
_sand
=
msec
;
_size
=
msec
;
}
inline
void
reset
()
{
run
(
_size
);
}
inline
int
duration
()
{
return
_size
;
}
// перевернуть часы
// true - засечь время
// false - перевернуть часы (обратный ход)
// возвращает аргумент (т.е. идёт ли отсчёт времени)
inline
bool
rotate
(
bool
st
)
{
if
(
st
==
_state
)
return
st
;
_state
=
st
;
if
(
!
_state
)
{
int
cur
=
t
.
getCurrent
();
_sand
-=
cur
;
if
(
_sand
<
0
)
_sand
=
0
;
// std::cout << "перевернули: прошло " << cur
// << " осталось " << sand
// << " засекаем " << cur << endl;
t
.
setTiming
(
cur
);
}
else
{
_sand
+=
t
.
getCurrent
();
if
(
_sand
>
_size
)
_sand
=
_size
;
// std::cout << "вернули: прошло " << t.getCurrent()
// << " осталось " << sand
// << " засекам " << sand << endl;
t
.
setTiming
(
_sand
);
}
return
st
;
}
// получить прошедшее время
// для положения st
inline
int
current
(
bool
st
)
{
return
t
.
getCurrent
();
}
// получить заданное время
// для положения st
inline
int
interval
(
bool
st
)
{
return
t
.
getInterval
();
}
// проверить наступление
inline
bool
check
()
{
// пока часы не "стоят"
// всегда false
if
(
!
_state
)
return
false
;
return
t
.
checkTime
();
}
inline
bool
state
(){
return
_state
;
}
protected
:
PassiveTimer
t
;
bool
_state
;
int
_sand
;
int
_size
;
};
// --------------------------------------------------------------------------
#endif
// --------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment