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_LOR_BASIC_HH
00027 # define MLN_ACCU_LOGIC_LOR_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
00043 namespace accu {
00044 namespace logic {
00045 struct lor_basic;
00046 }
00047 }
00048
00049
00050
00051
00052 namespace trait
00053 {
00054
00055 template <>
00056 struct accumulator_< accu::logic::lor_basic >
00057 {
00058 typedef accumulator::has_untake::no has_untake;
00059 typedef accumulator::has_set_value::no has_set_value;
00060 typedef accumulator::has_stop::yes has_stop;
00061 typedef accumulator::when_pix::use_v when_pix;
00062 };
00063
00064 }
00065
00066
00067 namespace accu
00068 {
00069
00070 namespace meta
00071 {
00072
00073 namespace logic
00074 {
00076 struct lor_basic : public Meta_Accumulator< lor_basic >
00077 {
00078 template <typename T>
00079 struct with
00080 {
00081 typedef accu::logic::lor_basic ret;
00082 };
00083 };
00084
00085 }
00086 }
00087
00088
00089 namespace logic
00090 {
00091
00097
00098 struct lor_basic : public mln::accu::internal::base< bool, lor_basic >
00099 {
00100 typedef bool argument;
00101
00102 lor_basic();
00103
00106 void init();
00107 void take_as_init_(const argument& t);
00108
00109 void take(const argument& t);
00110 void take(const lor_basic& other);
00112
00114 bool to_result() const;
00115
00118 bool is_valid() const;
00119
00123 bool can_stop() const;
00124
00125 protected:
00126 bool res_;
00127 };
00128
00129 # ifndef MLN_INCLUDE_ONLY
00130
00131 inline
00132 lor_basic::lor_basic()
00133 {
00134 init();
00135 }
00136
00137 inline
00138 void
00139 lor_basic::init()
00140 {
00141 res_ = false;
00142 }
00143
00144 inline
00145 void lor_basic::take_as_init_(const argument& t)
00146 {
00147 res_ = t;
00148 }
00149
00150 inline
00151 void lor_basic::take(const argument& t)
00152 {
00153 if (res_ == false && t == true)
00154 res_ = true;
00155 }
00156
00157 inline
00158 void
00159 lor_basic::take(const lor_basic& other)
00160 {
00161 res_ = res_ || other.res_;
00162 }
00163
00164 inline
00165 bool
00166 lor_basic::to_result() const
00167 {
00168 return res_;
00169 }
00170
00171 inline
00172 bool
00173 lor_basic::is_valid() const
00174 {
00175 return true;
00176 }
00177
00178 inline
00179 bool
00180 lor_basic::can_stop() const
00181 {
00182 return res_ == true;
00183 }
00184
00185 # endif // ! MLN_INCLUDE_ONLY
00186
00187 }
00188 }
00189 }
00190
00191
00192 #endif // ! MLN_ACCU_LOGIC_LOR_BASIC_HH