Mercurial > flash_v2
comparison host/libcdl/transact.cxx @ 105:5a0cc6c243a9 ecos-sw-2000-06-30
Merge from eCos master repository on 2000-06-30-08:18:49-BST
| author | jlarmour |
|---|---|
| date | Fri, 30 Jun 2000 16:27:35 +0000 |
| parents | 70190fa0fe10 |
| children | 42f843b391aa |
comparison
equal
deleted
inserted
replaced
| 104:ad66e26a9e7c | 105:5a0cc6c243a9 |
|---|---|
| 64 | 64 |
| 65 // ---------------------------------------------------------------------------- | 65 // ---------------------------------------------------------------------------- |
| 66 // The callback class is very straightforward. The hard work is done in | 66 // The callback class is very straightforward. The hard work is done in |
| 67 // the transaction class. | 67 // the transaction class. |
| 68 | 68 |
| 69 CdlTransactionCallback::CdlTransactionCallback() | 69 CdlTransactionCallback::CdlTransactionCallback(CdlTransaction transact_arg) |
| 70 { | 70 { |
| 71 CYG_REPORT_FUNCNAME("CdlTransactionCallback:: constructor"); | 71 CYG_REPORT_FUNCNAME("CdlTransactionCallback:: constructor"); |
| 72 CYG_REPORT_FUNCARG1XV(this); | 72 CYG_REPORT_FUNCARG2XV(this, transact_arg); |
| 73 | 73 CYG_PRECONDITION_CLASSC(transact_arg); |
| 74 | |
| 74 // The vectors etc. will take care of themselves. | 75 // The vectors etc. will take care of themselves. |
| 76 transact = transact_arg; | |
| 75 cdltransactioncallback_cookie = CdlTransactionCallback_Magic; | 77 cdltransactioncallback_cookie = CdlTransactionCallback_Magic; |
| 76 | 78 |
| 77 CYG_POSTCONDITION_THISC(); | 79 CYG_POSTCONDITION_THISC(); |
| 78 CYG_REPORT_RETURN(); | 80 CYG_REPORT_RETURN(); |
| 79 } | 81 } |
| 83 CYG_REPORT_FUNCNAME("CdlTransactionCallback:: destructor"); | 85 CYG_REPORT_FUNCNAME("CdlTransactionCallback:: destructor"); |
| 84 CYG_REPORT_FUNCARG1XV(this); | 86 CYG_REPORT_FUNCARG1XV(this); |
| 85 CYG_PRECONDITION_THISC(); | 87 CYG_PRECONDITION_THISC(); |
| 86 | 88 |
| 87 cdltransactioncallback_cookie = CdlTransactionCallback_Invalid; | 89 cdltransactioncallback_cookie = CdlTransactionCallback_Invalid; |
| 90 transact = 0; | |
| 88 value_changes.clear(); | 91 value_changes.clear(); |
| 89 active_changes.clear(); | 92 active_changes.clear(); |
| 90 legal_values_changes.clear(); | 93 legal_values_changes.clear(); |
| 91 value_source_changes.clear(); | 94 value_source_changes.clear(); |
| 92 new_conflicts.clear(); | 95 new_conflicts.clear(); |
| 112 { | 115 { |
| 113 CYG_REPORT_FUNCNAMETYPE("CdlTransactionCallback::get_callback_fn", "result %p"); | 116 CYG_REPORT_FUNCNAMETYPE("CdlTransactionCallback::get_callback_fn", "result %p"); |
| 114 | 117 |
| 115 void (*result)(const CdlTransactionCallback&) = CdlTransactionBody::get_callback_fn(); | 118 void (*result)(const CdlTransactionCallback&) = CdlTransactionBody::get_callback_fn(); |
| 116 | 119 |
| 120 CYG_REPORT_RETVAL(result); | |
| 121 return result; | |
| 122 } | |
| 123 | |
| 124 CdlTransaction | |
| 125 CdlTransactionCallback::get_transaction() const | |
| 126 { | |
| 127 CYG_REPORT_FUNCNAMETYPE("CdlTransactionCallback::get_transaction", "result %p"); | |
| 128 CYG_PRECONDITION_THISC(); | |
| 129 | |
| 130 CdlTransaction result = transact; | |
| 131 CYG_POSTCONDITION_CLASSC(result); | |
| 132 | |
| 133 CYG_REPORT_RETVAL(result); | |
| 134 return result; | |
| 135 } | |
| 136 | |
| 137 CdlToplevel | |
| 138 CdlTransactionCallback::get_toplevel() const | |
| 139 { | |
| 140 CYG_REPORT_FUNCNAMETYPE("CdlTransactionCallback::get_toplevel", "result %p"); | |
| 141 CYG_PRECONDITION_THISC(); | |
| 142 | |
| 143 CdlToplevel result = transact->get_toplevel(); | |
| 144 CYG_POSTCONDITION_CLASSC(result); | |
| 145 | |
| 117 CYG_REPORT_RETVAL(result); | 146 CYG_REPORT_RETVAL(result); |
| 118 return result; | 147 return result; |
| 119 } | 148 } |
| 120 | 149 |
| 121 bool | 150 bool |
| 1951 // Also, these value changes may invalidate existing solutions. | 1980 // Also, these value changes may invalidate existing solutions. |
| 1952 for (map_i = changes.begin(); map_i != changes.end(); map_i++) { | 1981 for (map_i = changes.begin(); map_i != changes.end(); map_i++) { |
| 1953 CYG_LOOP_INVARIANT_CLASSC(map_i->first); | 1982 CYG_LOOP_INVARIANT_CLASSC(map_i->first); |
| 1954 CYG_LOOP_INVARIANT_CLASSOC(map_i->second); | 1983 CYG_LOOP_INVARIANT_CLASSOC(map_i->second); |
| 1955 parent->changes[map_i->first] = map_i->second; | 1984 parent->changes[map_i->first] = map_i->second; |
| 1956 | |
| 1957 for (conf_i = parent->new_conflicts.begin(); conf_i != parent->new_conflicts.end(); conf_i++) { | 1985 for (conf_i = parent->new_conflicts.begin(); conf_i != parent->new_conflicts.end(); conf_i++) { |
| 1958 CYG_LOOP_INVARIANT_CLASSC(*conf_i); | 1986 CYG_LOOP_INVARIANT_CLASSC(*conf_i); |
| 1959 (*conf_i)->update_solution_validity(map_i->first); | 1987 (*conf_i)->update_solution_validity(map_i->first); |
| 1960 } | 1988 } |
| 1961 for (conf_i = parent->global_conflicts_with_solutions.begin(); | 1989 for (conf_i = parent->global_conflicts_with_solutions.begin(); |
| 2033 // If there is a registered callback function, it is necessary to fill | 2061 // If there is a registered callback function, it is necessary to fill |
| 2034 // in the remaining fields of the all_changes callback structure. This | 2062 // in the remaining fields of the all_changes callback structure. This |
| 2035 // should happen before any conflicts get deleted. The actual callback | 2063 // should happen before any conflicts get deleted. The actual callback |
| 2036 // is invoked at the end, once all the changes have been moved to | 2064 // is invoked at the end, once all the changes have been moved to |
| 2037 // the toplevel. | 2065 // the toplevel. |
| 2038 CdlTransactionCallback all_changes; | 2066 CdlTransactionCallback all_changes(this); |
| 2039 if (0 != callback_fn) { | 2067 if (0 != callback_fn) { |
| 2040 | 2068 |
| 2041 for (map_i = changes.begin(); map_i != changes.end(); map_i++) { | 2069 for (map_i = changes.begin(); map_i != changes.end(); map_i++) { |
| 2042 | |
| 2043 if (0 == map_i->first->get_toplevel()) { | 2070 if (0 == map_i->first->get_toplevel()) { |
| 2044 continue; | 2071 continue; |
| 2045 } | 2072 } |
| 2046 CdlValueFlavor flavor = map_i->second.get_flavor(); | 2073 CdlValueFlavor flavor = map_i->second.get_flavor(); |
| 2047 const CdlValue& old_value = map_i->first->get_whole_value(); | 2074 const CdlValue& old_value = map_i->first->get_whole_value(); |
