-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.h
73 lines (65 loc) · 1.81 KB
/
template.h
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
typedef enum {failure,success} retstat;
typedef struct IdNode {
struct IdNode *next;
unsigned int id;
}IdNode;
typedef struct SmartGridTransaction{
unsigned int transID;
unsigned int sellerID;
unsigned int buyerID;
float amtOfEnergy;
float pricePerKWh;
char date[11];
char time[6];
int flag;
}SmartGridTransaction;
typedef struct TransNode{
SmartGridTransaction entry;
struct TransNode* next;
}TransNode;
typedef struct SellerAttrib{
unsigned int sellerID;
float b300;
float a300;
IdNode *regularBuyersHead;
IdNode *regularBuyersTail;
}SellerAttrib;
typedef struct SellersList{
SellerAttrib attributes;
struct SellersList* next;
}SellersList;
typedef struct seller_buyer{
unsigned int id;
float revenue;
float totalenergy;
TransNode *memberhead;
struct seller_buyer* next;
}seller_buyer;
typedef struct pair {
int count;
int flag;
unsigned int sellerID;
unsigned int buyerID;
struct pair* next;
}Pair;
retstat addEntry(TransNode **,TransNode **,SellersList *);
void cleanTransList(TransNode **);
void displayData(TransNode *);
void readTransactions(TransNode** , TransNode**);
void loadSellersFromFile(SellersList** , SellersList** );
void cleanSellersList(SellersList** );
void listTransinTime(TransNode*);
void saveTransactions(TransNode *);
TransNode* createTransNode(SmartGridTransaction *);
retstat createSellersList(seller_buyer**,TransNode*);
void clearSellersList(seller_buyer**);
retstat createBuyersList(seller_buyer**,TransNode*);
void clearBuyersList(seller_buyer**);
Pair* sort_pairs(TransNode*,Pair*);
void update(TransNode*,SellersList*);
TransNode* max_ener(TransNode *);
void revenueGenerated(seller_buyer *);
seller_buyer* calculateEnergy(seller_buyer *);
void clearPairs(Pair**);
void createListRegular(SellersList *, Pair *);
void saveRegularBuyers(SellersList *);