-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpwl.hh
1348 lines (1015 loc) · 35.8 KB
/
pwl.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* This is the header file of the Parma Watchdog Library.
Copyright (C) 2001-2009 Roberto Bagnara <[email protected]>
This file is part of the Parma Watchdog Library (PWL).
The PWL 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 3 of the License, or (at your
option) any later version.
The PWL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
For the most up-to-date information see the Parma Polyhedra Library
site: http://www.cs.unipr.it/ppl/ . */
#ifndef PWL_pwl_hh
#define PWL_pwl_hh 1
#ifdef NDEBUG
# define PWL_SAVE_NDEBUG 1
# undef NDEBUG
#endif
// Automatically generated from PPL source file ../pwl-config.h line 1
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#define PWL_HAVE_DECL_GETENV 0
/* Define to 1 if you have the <dlfcn.h> header file. */
#define PWL_HAVE_DLFCN_H 1
/* Define to 1 if you have the <fenv.h> header file. */
#define PWL_HAVE_FENV_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define PWL_HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define PWL_HAVE_MEMORY_H 1
/* Define to 1 if you have the `setitimer' function. */
#define HAVE_SETITIMER 1
/* Define to 1 if the system has the type `siginfo_t'. */
#define HAVE_SIGINFO_T 1
/* Define to 1 if you have the <stdint.h> header file. */
#define PWL_HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define PWL_HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define PWL_HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define PWL_HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define PWL_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define PWL_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define PWL_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define PWL_HAVE_UNISTD_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Assertions are disabled when this is defined */
#define NDEBUG 1
/* Define to the address where bug reports for this package should be sent. */
#define PWL_PACKAGE_BUGREPORT "[email protected]"
/* Define to the full name of this package. */
#define PWL_PACKAGE_NAME "the Parma Watchdog Library"
/* Define to the full name and version of this package. */
#define PWL_PACKAGE_STRING "the Parma Watchdog Library 0.7"
/* Define to the one symbol short name of this package. */
#define PWL_PACKAGE_TARNAME "pwl"
/* Define to the version of this package. */
#define PWL_PACKAGE_VERSION "0.7"
/* Define to 1 if you have the ANSI C header files. */
#define PWL_STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define PWL_TIME_WITH_SYS_TIME 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
#ifdef PWL_NDEBUG
# define NDEBUG 1
#endif
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Doubly_Linked_Object.types.hh line 1
#ifndef PWL_Doubly_Linked_Object_types_hh
#define PWL_Doubly_Linked_Object_types_hh 1
namespace Parma_Watchdog_Library {
class Doubly_Linked_Object;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Doubly_Linked_Object_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList.types.hh line 1
#ifndef PWL_EList_types_hh
#define PWL_EList_types_hh 1
namespace Parma_Watchdog_Library {
template <typename T>
class EList;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_EList_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.types.hh line 1
#ifndef PWL_EList_Iterator_types_hh
#define PWL_EList_Iterator_types_hh 1
namespace Parma_Watchdog_Library {
template <typename T>
class EList_Iterator;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_EList_Iterator_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Handler.types.hh line 1
#ifndef PWL_Handler_types_hh
#define PWL_Handler_types_hh 1
namespace Parma_Watchdog_Library {
class Handler;
template <typename Flag_Base, typename Flag>
class Handler_Flag;
class Handler_Function;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Handler_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Pending_Element.types.hh line 1
#ifndef PWL_Pending_Element_types_hh
#define PWL_Pending_Element_types_hh 1
namespace Parma_Watchdog_Library {
class Pending_Element;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Pending_Element_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Pending_List.types.hh line 1
#ifndef PWL_Pending_List_types_hh
#define PWL_Pending_List_types_hh 1
namespace Parma_Watchdog_Library {
class Pending_List;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Pending_List_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Time.types.hh line 1
#ifndef PWL_Time_types_hh
#define PWL_Time_types_hh 1
namespace Parma_Watchdog_Library {
class Time;
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Time_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Watchdog.types.hh line 1
#ifndef PWL_Watchdog_types_hh
#define PWL_Watchdog_types_hh 1
namespace Parma_Watchdog_Library {
class Watchdog;
class Flag;
class Init;
}
#endif // !defined(PWL_Watchdog_types_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Handler.defs.hh line 1
/* Handler and derived classes' declaration.
*/
#ifndef PWL_Handler_defs_hh
#define PWL_Handler_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Handler.defs.hh line 27
//! Abstract base class for handlers of the watchdog events.
class Parma_Watchdog_Library::Handler {
public:
//! Does the job.
virtual void act() const = 0;
//! Virtual destructor.
virtual ~Handler();
};
//! A kind of Handler that installs a flag onto a flag-holder.
/*!
The template class Handler_Flag<Flag_Base, Flag> is an handler whose
job is to install a flag onto an <EM>holder</EM> for the flag.
The flag is of type \p Flag and the holder is a (volatile) pointer
to \p Flag_Base. Installing the flag onto the holder means making
the holder point to the flag, so that it must be possible to assign
a value of type <CODE>Flag*</CODE> to an entity of type
<CODE>Flag_Base*</CODE>.
The class \p Flag must provide the method
\code
int priority() const
\endcode
returning an integer priority associated to the flag.
The handler will install its flag onto the holder only if the holder
is empty, namely, it is the null pointer, or if the holder holds a
flag of strictly lower priority.
*/
template <typename Flag_Base, typename Flag>
class Parma_Watchdog_Library::Handler_Flag : virtual public Handler {
public:
//! Constructor with a given function.
Handler_Flag(const Flag_Base* volatile& holder, Flag& flag);
//! Does its job: installs the flag onto the holder, if a flag with
//! an higher priority has not already been installed.
void act() const;
private:
// declare holder as reference to volatile pointer to const Flag_Base
const Flag_Base* volatile& h;
Flag& f;
};
//! A kind of Handler calling a given function.
class Parma_Watchdog_Library::Handler_Function : virtual public Handler {
public:
//! Constructor with a given function.
Handler_Function(void (*function)());
//! Does its job: calls the embedded function.
void act() const;
private:
//! Pointer to the embedded function.
void (*f)();
};
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Handler.inlines.hh line 1
/* Handler and derived classes' implementation: inline functions.
*/
#ifndef PWL_Handler_inlines_hh
#define PWL_Handler_inlines_hh 1
namespace Parma_Watchdog_Library {
inline
Handler::~Handler() {
}
template <typename Flag_Base, typename Flag>
Handler_Flag<Flag_Base, Flag>::Handler_Flag(const Flag_Base* volatile& holder,
Flag& flag)
: h(holder), f(flag) {
}
template <typename Flag_Base, typename Flag>
void
Handler_Flag<Flag_Base, Flag>::act() const {
if (h == 0 || static_cast<const Flag&>(*h).priority() < f.priority())
h = &f;
}
inline
Handler_Function::Handler_Function(void (*function)())
: f(function) {
}
inline void
Handler_Function::act() const {
(*f)();
}
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Handler_inlines_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Handler.defs.hh line 89
#endif // !defined(PWL_Handler_defs_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Time.defs.hh line 1
/* Time class declaration.
*/
#ifndef PWL_Time_defs_hh
#define PWL_Time_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Time.defs.hh line 27
namespace Parma_Watchdog_Library {
//! Returns <CODE>true</CODE> if and only if \p x and \p y are equal.
bool operator==(const Time& x, const Time& y);
//! Returns <CODE>true</CODE> if and only if \p x and \p y are different.
bool operator!=(const Time& x, const Time& y);
//! Returns <CODE>true</CODE> if and only if \p x is shorter than \p y.
bool operator<(const Time& x, const Time& y);
/*! \brief
Returns <CODE>true</CODE> if and only if \p x is shorter than
or equal to \p y.
*/
bool operator<=(const Time& x, const Time& y);
//! Returns <CODE>true</CODE> if and only if \p x is longer than \p y.
bool operator>(const Time& x, const Time& y);
/*! \brief
Returns <CODE>true</CODE> if and only if \p x is longer than
or equal to \p y.
*/
bool operator>=(const Time& x, const Time& y);
//! Returns the sum of \p x and \p y.
Time operator+(const Time& x, const Time& y);
/*! \brief
Returns the difference of \p x and \p y or the null interval,
if \p x is shorter than \p y.
*/
Time operator-(const Time& x, const Time& y);
} // namespace Parma_Watchdog_Library
//! A class for representing and manipulating positive time intervals.
class Parma_Watchdog_Library::Time {
public:
//! Zero seconds.
Time();
//! Constructor taking a number of hundredths of a second.
explicit Time(unsigned long hundredths_of_a_second);
//! Constructor with seconds and microseconds.
Time(unsigned long s, unsigned long m);
/*! \brief
Returns the number of whole seconds contained in the represented
time interval.
*/
unsigned long seconds() const;
/*! \brief
Returns the number of microseconds that, when added to the number
of seconds returned by seconds(), give the represent time interval.
*/
unsigned long microseconds() const;
//! Adds \p y to \p *this.
Time& operator+=(const Time& y);
/*! \brief
Subtracts \p y from \p *this; if \p *this is shorter than \p y,
\p *this is set to the null interval.
*/
Time& operator-=(const Time& y);
//! Checks if all the invariants are satisfied.
bool OK() const;
private:
//! Number of seconds.
unsigned long secs;
//! Number of microseconds.
unsigned long microsecs;
};
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Time.inlines.hh line 1
/* Time class implementation: inline functions.
*/
#ifndef PWL_Time_inlines_hh
#define PWL_Time_inlines_hh 1
#include <cassert>
namespace Parma_Watchdog_Library {
inline
Time::Time()
: secs(0), microsecs(0) {
assert(OK());
}
inline
Time::Time(unsigned long hundredths_of_a_second)
: secs(hundredths_of_a_second / 100),
microsecs((hundredths_of_a_second % 100) * 10000) {
assert(OK());
}
inline
Time::Time(unsigned long s, unsigned long m)
: secs(s),
microsecs(m) {
if (microsecs >= 1000000) {
secs += microsecs / 1000000;
microsecs %= 1000000;
}
assert(OK());
}
inline unsigned long
Time::seconds() const {
return secs;
}
inline unsigned long
Time::microseconds() const {
return microsecs;
}
inline Time&
Time::operator+=(const Time& y) {
unsigned long r_secs = secs + y.secs;
unsigned long r_microsecs = microsecs + y.microsecs;
if (r_microsecs >= 1000000) {
++r_secs;
r_microsecs %= 1000000;
}
secs = r_secs;
microsecs = r_microsecs;
assert(OK());
return *this;
}
inline Time&
Time::operator-=(const Time& y) {
long r_secs = secs - y.secs;
long r_microsecs = microsecs - y.microsecs;
if (r_microsecs < 0) {
--r_secs;
r_microsecs += 1000000;
}
if (r_secs < 0)
r_secs = r_microsecs = 0;
secs = r_secs;
microsecs = r_microsecs;
assert(OK());
return *this;
}
inline Time
operator+(const Time& x, const Time& y) {
Time z = x;
z += y;
return z;
}
inline Time
operator-(const Time& x, const Time& y) {
Time z = x;
z -= y;
return z;
}
inline bool
operator==(const Time& x, const Time& y) {
assert(x.OK() && y.OK());
return x.seconds() == y.seconds() && y.microseconds() == y.microseconds();
}
inline bool
operator!=(const Time& x, const Time& y) {
assert(x.OK() && y.OK());
return !(x == y);
}
inline bool
operator<(const Time& x, const Time& y) {
assert(x.OK() && y.OK());
return x.seconds() < y.seconds()
|| (x.seconds() == y.seconds() && x.microseconds() < y.microseconds());
}
inline bool
operator<=(const Time& x, const Time& y) {
return x < y || x == y;
}
inline bool
operator>(const Time& x, const Time& y) {
return y < x;
}
inline bool
operator>=(const Time& x, const Time& y) {
return y <= x;
}
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Time_inlines_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Time.defs.hh line 110
#endif // !defined(PWL_Time_defs_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Doubly_Linked_Object.defs.hh line 1
/* Doubly_Linked_Object class declaration.
*/
#ifndef PWL_Doubly_Linked_Object_defs_hh
#define PWL_Doubly_Linked_Object_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Doubly_Linked_Object.defs.hh line 29
//! A (base) class for doubly linked objects.
class Parma_Watchdog_Library::Doubly_Linked_Object {
public:
//! Default constructor.
Doubly_Linked_Object();
//! Creates a chain element with forward link \p f and backward link \p b.
Doubly_Linked_Object(Doubly_Linked_Object* f, Doubly_Linked_Object* b);
//! Inserts \p y before \p *this.
void insert_before(Doubly_Linked_Object& y);
//! Inserts \p y after \p *this.
void insert_after(Doubly_Linked_Object& y);
//! Erases \p *this from the chain and returns a pointer to the next element.
Doubly_Linked_Object* erase();
//! Erases \p *this from the chain.
~Doubly_Linked_Object();
private:
//! Forward link.
Doubly_Linked_Object* next;
//! Backward link.
Doubly_Linked_Object* prev;
template <typename T> friend class EList;
template <typename T> friend class EList_Iterator;
};
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Doubly_Linked_Object.inlines.hh line 1
/* Doubly_Linked_Object class implementation: inline functions.
*/
#ifndef PWL_Doubly_Linked_Object_inlines_hh
#define PWL_Doubly_Linked_Object_inlines_hh 1
namespace Parma_Watchdog_Library {
inline
Doubly_Linked_Object::Doubly_Linked_Object() {
}
inline
Doubly_Linked_Object::Doubly_Linked_Object(Doubly_Linked_Object* f,
Doubly_Linked_Object* b)
: next(f),
prev(b) {
}
inline void
Doubly_Linked_Object::insert_before(Doubly_Linked_Object& y) {
y.next = this;
y.prev = prev;
prev->next = &y;
prev = &y;
}
inline void
Doubly_Linked_Object::insert_after(Doubly_Linked_Object& y) {
y.next = next;
y.prev = this;
next->prev = &y;
next = &y;
}
inline Doubly_Linked_Object*
Doubly_Linked_Object::erase() {
next->prev = prev;
prev->next = next;
return next;
}
inline
Doubly_Linked_Object::~Doubly_Linked_Object() {
erase();
}
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_Doubly_Linked_Object_inlines_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Doubly_Linked_Object.defs.hh line 63
#endif // !defined(PWL_Doubly_Linked_Object_defs_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.defs.hh line 1
/* EList_Iterator class declaration.
*/
#ifndef PWL_EList_Iterator_defs_hh
#define PWL_EList_Iterator_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.defs.hh line 28
namespace Parma_Watchdog_Library {
//! Returns <CODE>true</CODE> if and only if \p x and \p y are equal.
template <typename T>
bool operator==(const EList_Iterator<T>& x, const EList_Iterator<T>& y);
//! Returns <CODE>true</CODE> if and only if \p x and \p y are different.
template <typename T>
bool operator!=(const EList_Iterator<T>& x, const EList_Iterator<T>& y);
} // namespace Parma_Watchdog_Library
//! A class providing iterators for embedded lists.
template <typename T>
class Parma_Watchdog_Library::EList_Iterator {
public:
//! Constructs an iterator pointing to nothing.
EList_Iterator();
//! Constructs an iterator pointing to \p p.
explicit EList_Iterator(Doubly_Linked_Object* p);
//! Changes \p *this so that it points to \p p.
EList_Iterator& operator=(Doubly_Linked_Object* p);
//! Indirect member selector.
T* operator->();
//! Dereference operator.
T& operator*();
//! Preincrement operator.
EList_Iterator& operator++();
//! Postincrement operator.
EList_Iterator operator++(int);
//! Predecrement operator.
EList_Iterator& operator--();
//! Postdecrement operator.
EList_Iterator operator--(int);
private:
//! Embedded pointer.
Doubly_Linked_Object* ptr;
friend bool operator==<T>(const EList_Iterator& x, const EList_Iterator& y);
friend bool operator!=<T>(const EList_Iterator& x, const EList_Iterator& y);
};
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.inlines.hh line 1
/* EList_Iterator class implementation: inline functions.
*/
#ifndef PWL_EList_Iterator_inlines_hh
#define PWL_EList_Iterator_inlines_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.inlines.hh line 27
namespace Parma_Watchdog_Library {
template <typename T>
inline
EList_Iterator<T>::EList_Iterator() {
}
template <typename T>
inline
EList_Iterator<T>::EList_Iterator(Doubly_Linked_Object* p)
: ptr(p) {
}
template <typename T>
inline EList_Iterator<T>&
EList_Iterator<T>::operator=(Doubly_Linked_Object* p) {
ptr = p;
return *this;
}
template <typename T>
inline T*
EList_Iterator<T>::operator->() {
return static_cast<T*>(ptr);
}
template <typename T>
inline T&
EList_Iterator<T>::operator*() {
return *operator->();
}
template <typename T>
inline EList_Iterator<T>&
EList_Iterator<T>::operator++() {
ptr = ptr->next;
return *this;
}
template <typename T>
inline EList_Iterator<T>
EList_Iterator<T>::operator++(int) {
EList_Iterator tmp = *this;
++*this;
return tmp;
}
template <typename T>
inline EList_Iterator<T>&
EList_Iterator<T>::operator--() {
ptr = ptr->prev;
return *this;
}
template <typename T>
inline EList_Iterator<T>
EList_Iterator<T>::operator--(int) {
EList_Iterator tmp = *this;
--*this;
return tmp;
}
template <typename T>
inline bool
operator==(const EList_Iterator<T>& x, const EList_Iterator<T>& y) {
return x.ptr == y.ptr;
}
template <typename T>
inline bool
operator!=(const EList_Iterator<T>& x, const EList_Iterator<T>& y) {
return x.ptr != y.ptr;
}
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_EList_Iterator_inlines_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList_Iterator.defs.hh line 82
#endif // !defined(PWL_EList_Iterator_defs_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList.defs.hh line 1
/* EList class declaration.
*/
#ifndef PWL_EList_defs_hh
#define PWL_EList_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList.defs.hh line 28
/*! \brief
A simple kind of embedded list (i.e., a doubly linked objects
where the links are embedded in the objects themselves).
*/
template <typename T>
class Parma_Watchdog_Library::EList : private Doubly_Linked_Object {
public:
//! A const iterator to traverse the list.
typedef EList_Iterator<const T> Const_Iterator;
//! A non-const iterator to traverse the list.
typedef EList_Iterator<T> Iterator;
//! Constructs an empty list.
EList();
//! Destructs the list and all the elements in it.
~EList();
//! Pushes \p obj to the front of the list.
void push_front(T& obj);
//! Pushes \p obj to the back of the list.
void push_back(T& obj);
/*! \brief
Inserts \p obj just before \p position and returns an iterator
that points to the inserted object.
*/
Iterator insert(Iterator position, T& obj);
/*! \brief
Removes the element pointed to by \p position, returning
an iterator pointing to the next element, if any, or end(), otherwise.
*/
Iterator erase(Iterator position);
//! Returns <CODE>true</CODE> if and only if the list is empty.
bool empty() const;
//! Returns an iterator pointing to the beginning of the list.
Iterator begin();
//! Returns an iterator pointing one past the last element in the list.
Iterator end();
//! Returns a const iterator pointing to the beginning of the list.
Const_Iterator begin() const;
//! Returns a const iterator pointing one past the last element in the list.
Const_Iterator end() const;
//! Checks if all the invariants are satisfied.
bool OK() const;
};
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList.inlines.hh line 1
/* EList class implementation: inline functions.
*/
#ifndef PWL_EList_inlines_hh
#define PWL_EList_inlines_hh 1
namespace Parma_Watchdog_Library {
template <typename T>
inline
EList<T>::EList()
: Doubly_Linked_Object(this, this) {
}
template <typename T>
inline void
EList<T>::push_front(T& obj) {
next->insert_before(obj);
}
template <typename T>
inline void
EList<T>::push_back(T& obj) {
prev->insert_after(obj);
}
template <typename T>
inline typename EList<T>::Iterator
EList<T>::insert(Iterator position, T& obj) {
position->insert_before(obj);
return Iterator(&obj);
}
template <typename T>
inline typename EList<T>::Iterator
EList<T>::begin() {
return Iterator(next);
}
template <typename T>
inline typename EList<T>::Iterator
EList<T>::end() {
return Iterator(this);
}
template <typename T>
inline typename EList<T>::Const_Iterator
EList<T>::begin() const {
return Const_Iterator(next);
}
template <typename T>
inline typename EList<T>::Const_Iterator
EList<T>::end() const {
return Const_Iterator(const_cast<EList<T>*>(this));
}
template <typename T>
inline bool
EList<T>::empty() const {
return begin() == end();
}
template <typename T>
inline typename EList<T>::Iterator
EList<T>::erase(Iterator position) {
assert(!empty());
return Iterator(position->erase());
}
template <typename T>
inline
EList<T>::~EList() {
// Erase and deallocate all the elements.
for (Iterator i = begin(), lend = end(), next; i != lend; i = next) {
next = erase(i);
delete &*i;
}
}
template <typename T>
inline bool
EList<T>::OK() const {
for (Const_Iterator i = begin(), lend = end(); i != lend; ++i)
if (!i->OK())
return false;
return true;
}
} // namespace Parma_Watchdog_Library
#endif // !defined(PWL_EList_inlines_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/EList.defs.hh line 86
#endif // !defined(PWL_EList_defs_hh)
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Pending_Element.defs.hh line 1
/* Pending_Element class declaration.
*/
#ifndef PWL_Pending_Element_defs_hh
#define PWL_Pending_Element_defs_hh 1
// Automatically generated from PPL source file /opt/FriendlyARM/mini2440/build-toolschain/working/src/ppl-0.10.2/Watchdog/src/Pending_Element.defs.hh line 30
//! A class for pending watchdog events with embedded links.
/*!
Each pending watchdog event is characterized by a deadline (a positive
time interval), an associated handler that will be invoked upon event
expiration, and a Boolean flag that indicates whether the event has already
expired or not.
*/
class Parma_Watchdog_Library::Pending_Element : public Doubly_Linked_Object {
public:
//! Constructs an element with the given attributes.
Pending_Element(const Time& deadline,
const Handler& handler,
bool& expired_flag);
//! Modifies \p *this so that it has the given attributes.
void assign(const Time& deadline,
const Handler& handler,
bool& expired_flag);
//! Returns the deadline of the event.
const Time& deadline() const;
//! Returns the handler associated to the event.
const Handler& handler() const;
//! Returns a reference to the "event-expired" flag.
bool& expired_flag() const;
//! Checks if all the invariants are satisfied.
bool OK() const;
private:
//! The deadline of the event.
Time d;