00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_ACCU_LOGIC_LAND_BASIC_HH
00027 # define MLN_ACCU_LOGIC_LAND_BASIC_HH
00028 
00034 
00035 # include <mln/core/concept/meta_accumulator.hh>
00036 # include <mln/accu/internal/base.hh>
00037 
00038 
00039 namespace mln
00040 {
00041 
00042   namespace accu
00043   {
00044 
00045     namespace logic
00046     {
00047       
00048       struct land_basic;
00049     }
00050 
00051     namespace meta
00052     {
00053 
00054       namespace logic
00055       {
00056 
00058         struct land_basic : public Meta_Accumulator< land_basic >
00059         {
00060           template <typename T>
00061           struct with
00062           {
00063             typedef accu::logic::land_basic ret;
00064           };
00065         };
00066 
00067       } 
00068     } 
00069 
00070 
00071     namespace logic
00072     {
00073 
00079     
00080     struct land_basic : public mln::accu::internal::base< bool, land_basic >
00081     {
00082       typedef bool argument;
00083 
00084       land_basic();
00085 
00088       void init();
00089       void take_as_init_(const argument& t);
00090 
00091       void take(const argument& t);
00092       void take(const land_basic& other);
00094 
00096       bool to_result() const;
00097 
00100       bool is_valid() const;
00101 
00105       bool can_stop() const;
00106 
00107     protected:
00108       bool res_;
00109     };
00110 
00111 # ifndef MLN_INCLUDE_ONLY
00112 
00113     inline
00114     land_basic::land_basic()
00115     {
00116       init();
00117     }
00118 
00119     inline
00120     void
00121     land_basic::init()
00122     {
00123       res_ = true;
00124     }
00125 
00126     inline
00127     void land_basic::take_as_init_(const argument& t)
00128     {
00129       res_ = t;
00130     }
00131 
00132     inline
00133     void land_basic::take(const argument& t)
00134     {
00135       if (res_ == true && t == false)
00136         res_ = false;
00137     }
00138 
00139     inline
00140     void
00141     land_basic::take(const land_basic& other)
00142     {
00143       res_ = res_ && other.res_;
00144     }
00145 
00146     inline
00147     bool
00148     land_basic::to_result() const
00149     {
00150       return res_;
00151     }
00152 
00153     inline
00154     bool
00155     land_basic::is_valid() const
00156     {
00157       return true;
00158     }
00159 
00160     inline
00161     bool
00162     land_basic::can_stop() const
00163     {
00164       return res_ == false;
00165     }
00166 
00167 # endif // ! MLN_INCLUDE_ONLY
00168 
00169     } 
00170   } 
00171 } 
00172 
00173 
00174 #endif // ! MLN_ACCU_LOGIC_LAND_BASIC_HH