00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027 #ifndef _ANNOTATION_DELTA_H_
00028 #define _ANNOTATION_DELTA_H_
00029
00030 #include <api_delta.h>
00031
00032 class annotation_undelta : public undelta_base
00033 {
00034 public:
00035 std::vector<annotation> added_ann;
00036
00037 std::vector<annotation> removed_ann;
00038
00039 public:
00040 annotation_undelta(const std::vector<annotation>& __a,
00041 const std::vector<annotation>& __r) : undelta_base(),
00042 added_ann(__a),
00043 removed_ann(__r) {}
00044
00045 annotation_undelta(const std::vector<annotation>& __a) : undelta_base(),
00046 added_ann(__a),
00047 removed_ann() {}
00048
00049 annotation_undelta(const annotation& __a) : undelta_base(),
00050 added_ann(1,__a),
00051 removed_ann() {}
00052
00053 annotation_undelta(const annotation_undelta& __d) : undelta_base(__d),
00054 added_ann(__d.added_ann),
00055 removed_ann(__d.removed_ann)
00056 {
00057 #if DEBUG_DELTA
00058 std::cerr << "Called annotation_undelta copy constructor" << std::endl;
00059 #endif
00060 }
00061
00062 annotation_undelta* new_copy() const { return new annotation_undelta(*this); }
00063 void destroy_copy(annotation_undelta* __d) { delete __d; }
00064
00065 bool unapply(work_node& _x) const;
00066
00067 friend class annotation_delta;
00068 };
00069
00070 class annotation_delta : public delta_base
00071 {
00072 public:
00073 std::vector<annotation> add;
00074 std::vector<annotation> rm;
00075
00076 public:
00077 annotation_delta(const std::string& _act) : delta_base(_act), add(), rm() {}
00078
00079 annotation_delta(const std::string& _act,
00080 const std::vector<annotation>& __a,
00081 const std::vector<annotation>& __r)
00082 : delta_base(_act), add(__a), rm(__r) {}
00083
00084 annotation_delta(const std::string& _act, const annotation& _ad)
00085 : delta_base(_act), add(1,_ad), rm() {}
00086
00087 annotation_delta(const std::string& _act, bool _dummy, const annotation& _rm)
00088 : delta_base(_act), add(), rm(1,_rm) {}
00089
00090 annotation_delta(const annotation_delta& __d)
00091 : delta_base(__d), add(__d.add), rm(__d.rm)
00092 {
00093 #if DEBUG_DELTA
00094 std::cerr << "Called annotation_delta copy constructor" << std::endl;
00095 #endif
00096 }
00097
00098 annotation_delta(const char* _act,
00099 const std::vector<annotation>& __a,
00100 const std::vector<annotation>& __r)
00101 : delta_base(_act), add(__a), rm(__r) {}
00102
00103 annotation_delta(const char* _act, const annotation& _ad)
00104 : delta_base(_act), add(1,_ad), rm() {}
00105
00106 annotation_delta(const char* _act, bool _dummy, const annotation& _rm)
00107 : delta_base(_act), add(), rm(1,_rm) {}
00108
00109 virtual annotation_delta* new_copy() const
00110 { return new annotation_delta(*this); }
00111 virtual void destroy_copy(annotation_delta* __d) { delete __d; }
00112
00113 virtual bool apply(work_node& _x, undelta_base*& _u) const;
00114 };
00115
00116 #endif