timetable-aggregate.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 #ifndef __TIMETABLE_AGGREGATE_H__
00042 #define __TIMETABLE_AGGREGATE_H__
00043 
00044 #include "sys/timetable.h"
00045 #include "sys/cc.h"
00046 
00047 struct timetable_aggregate_entry {
00048   const char *id;
00049   unsigned short episodes;
00050   unsigned long time;
00051 };
00052 
00053 struct timetable_aggregate {
00054   struct timetable_aggregate_entry *entries;
00055   int ptr;
00056   const int size;
00057 };
00058 
00059 
00060 #define TIMETABLE_AGGREGATE_DECLARE(name)                               \
00061 struct timetable_aggregate name
00062 
00063 
00064 #define TIMETABLE_AGGREGATE(name, size)                         \
00065 static struct timetable_aggregate_entry CC_CONCAT(name,_entries)[size]; \
00066 static struct timetable_aggregate name = {                              \
00067   CC_CONCAT(name,_entries),                                             \
00068   0,                                                                    \
00069   size                                                                  \
00070 }
00071 
00072 #define TIMETABLE_AGGREGATE_NONSTATIC(name, size)                       \
00073 static struct timetable_aggregate_entry CC_CONCAT(name,_entries)[size]; \
00074 struct timetable_aggregate name = {                             \
00075   CC_CONCAT(name,_entries),                                             \
00076   0,                                                                    \
00077   size                                                                  \
00078 }
00079 
00080 void timetable_aggregate_print_detailed(struct timetable_aggregate *a);
00081 
00082 void timetable_aggregate_print_categories(struct timetable_aggregate *a);
00083 
00084 void timetable_aggregate_reset(struct timetable_aggregate *a);
00085 
00086 void timetable_aggregate_compute_detailed(struct timetable_aggregate *a,
00087                                           struct timetable *timetable);
00088 void timetable_aggregate_compute_categories(struct timetable_aggregate *a,
00089                                              struct timetable *timetable);
00090 
00091 
00092 
00093 #endif