00001 // 00002 // UCSD p-System cross compiler 00003 // Copyright (C) 2006 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or (at 00008 // you option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00018 // USA 00019 // 00020 00021 #ifndef LIB_STATEMENT_H 00022 #define LIB_STATEMENT_H 00023 00024 #include <lib/location.h> 00025 #include <lib/statement/smart_pointer.h> 00026 00032 class statement 00033 { 00034 public: 00039 typedef statement_smart_pointer pointer; 00040 00041 protected: 00048 virtual ~statement(); 00049 00050 public: 00055 virtual void traversal() = 0; 00056 00061 virtual bool empty() const; 00062 00067 const location &get_location() const { return locn; } 00068 00079 virtual bool execution_flows_out() const = 0; 00080 00085 void reference_count_up(); 00086 00091 void reference_count_down(); 00092 00093 protected: 00098 statement(); 00099 00103 statement(const statement &); 00104 00108 statement &operator=(const statement &); 00109 00115 void set_location(const location &arg); 00116 00117 private: 00122 long reference_count; 00123 00128 bool reference_count_valid() const { return (reference_count >= 1); } 00129 00140 location locn; 00141 }; 00142 00143 #endif // LIB_STATEMENT_H
1.5.1