1 #ifndef FRES_CONTRACT_H
2 #define FRES_CONTRACT_H
4 #include <fres_blocks.h>
5 #include <fres_container.h>
7 #include <fres_contract_type.h>
8 #include <fres_contract_idl.h>
9 #include <forb/server_id.h>
11 struct fres_contract {
12 fres_contract_id_t id;
13 struct fres_container *container; /**< Pointer to the container (opaque type). */
16 static inline int fres_contract_id_cmp(const fres_contract_id_t *a,
17 const fres_contract_id_t *b)
19 return forb_server_id_cmp((forb_server_id*)a,
23 struct fres_contract *fres_contract_new(void);
24 void fres_contract_destroy(struct fres_contract *contract);
25 struct fres_contract *fres_contract_duplicate(struct fres_contract *src);
27 #define FRES_CONTRACT_ACCESSOR(type) \
29 fres_contract_add_##type(struct fres_contract *contract, \
30 fres_block_##type *block) \
32 return fres_container_add_##type(contract->container, \
35 static inline fres_block_##type * \
36 fres_contract_get_##type(struct fres_contract *contract) \
38 return fres_container_get_##type(contract->container); \
41 fres_contract_del_##type(struct fres_contract *contract) \
43 fres_container_del_##type(contract->container); \
46 FRES_CONTRACT_ACCESSOR(label)
47 FRES_CONTRACT_ACCESSOR(resource)
48 FRES_CONTRACT_ACCESSOR(basic)
49 FRES_CONTRACT_ACCESSOR(timing_reqs)
50 FRES_CONTRACT_ACCESSOR(spare_capacity)