00001 // Point Delta implementation -*- C++ -*- 00002 00003 // $Id: point_delta.h 631 2008-05-19 17:38:05Z mihaly $ 00004 // Copyright (C) 2001-2003 Hermann Schichl 00005 // 00006 // This file is part of the COCONUT API. This library 00007 // is free software; you can redistribute it and/or modify it under the 00008 // terms of the Library GNU General Public License as published by the 00009 // Free Software Foundation; either version 2, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // Library GNU General Public License for more details. 00016 00017 // As a special exception, you may use this file as part of a free software 00018 // library without restriction. Specifically, if other files instantiate 00019 // templates or use macros or inline functions from this file, or you compile 00020 // this file and link it with other files to produce an executable, this 00021 // file does not by itself cause the resulting executable to be covered by 00022 // the Library GNU General Public License. This exception does not however 00023 // invalidate any other reasons why the executable file might be covered by 00024 // the Library GNU General Public License. 00025 00028 #ifndef _POINT_DELTA_H_ 00029 #define _POINT_DELTA_H_ 00030 00031 #include <api_delta.h> 00032 #include <table_delta.h> 00033 00034 namespace coco { 00035 00037 00044 class point_delta : public table_delta 00045 { 00046 private: 00048 typedef table_delta _Base; 00049 00050 public: 00052 point_delta() : _Base(std::string("add point")) {} 00053 00072 point_delta(const dbt_row& __p) : _Base(std::string("add point"), 00073 std::string("point"), __p) 00074 {} 00075 00077 point_delta(const point_delta& __d) : _Base(__d) 00078 { 00079 #if DEBUG_DELTA 00080 std::cerr << "Called point_delta copy constructor" << std::endl; 00081 #endif 00082 } 00083 00085 point_delta* new_copy() const { return new point_delta(*this); } 00086 00088 void destroy_copy(delta_base* __d) const { delete (point_delta*) __d; } 00089 00093 void create_table(work_node& _x, vdbl::standard_table *&ptb, 00094 const std::string& __t) const; 00095 00099 bool apply(work_node& _x, undelta_base*& _u, const delta_id& _did) const; 00100 00102 bool operator==(const delta_base& _c) const 00103 { return _c.get_action() == get_action() && 00104 this->operator==(*(point_delta*)&_c); } 00105 bool operator!=(const delta_base& _c) const 00106 { return _c.get_action() != get_action() || 00107 this->operator!=(*(point_delta*)&_c); } 00108 00110 bool operator==(const point_delta& _c) const 00111 { return ((_Base*)this)->operator==(*(_Base*)&_c); } 00112 bool operator!=(const point_delta& _c) const 00113 { return ((_Base*)this)->operator!=(*(_Base*)&_c); } 00114 }; 00115 00116 } // namespace coco 00117 00118 #endif /* _POINT_DELTA_H_ */