Give vector more specific type
[satune.git] / src / AST / order.c
1 #include "order.h"
2 #include "structs.h"
3 #include "set.h"
4 #include "boolean.h"
5
6 Order* allocOrder(OrderType type, Set * set){
7         Order* This = (Order*)ourmalloc(sizeof(Order));
8         This->set=set;
9         initDefVectorBooleanOrder(& This->constraints);
10         This->type=type;
11         initOrderEncoding(& This->order, This);
12         This->orderPairTable = NULL;
13         return This;
14 }
15
16 void initializeOrderHashTable(Order* This){
17         This->orderPairTable=allocHashTableOrderPair(HT_INITIAL_CAPACITY, HT_DEFAULT_FACTOR);
18 }
19
20 void addOrderConstraint(Order* This, BooleanOrder* constraint){
21         pushVectorBooleanOrder( &This->constraints, constraint);
22 }
23
24 void setOrderEncodingType(Order* This, OrderEncodingType type){
25         This->order.type = type;
26 }
27
28 void deleteOrder(Order* This){
29         deleteVectorArrayBooleanOrder(& This->constraints);
30         deleteOrderEncoding(& This->order);
31         if(This->orderPairTable != NULL) {
32                 resetAndDeleteHashTableOrderPair(This->orderPairTable);
33                 deleteHashTableOrderPair(This->orderPairTable);
34         }
35         ourfree(This);
36 }