00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_PLAYER_SOCCER_CONDITION_H
00033 #define RCSC_PLAYER_SOCCER_CONDITION_H
00034
00035 #include <boost/shared_ptr.hpp>
00036
00037 #include <vector>
00038
00039 namespace rcsc {
00040
00041 class PlayerAgent;
00042
00047 class Condition {
00048 private:
00049
00051 Condition( const Condition & );
00053 Condition & operator=( const Condition & );
00054
00055 protected:
00060 Condition()
00061 { }
00062
00063 public:
00067 virtual
00068 ~Condition()
00069 { }
00070
00075 virtual
00076 bool operator()( const PlayerAgent * agent ) const = 0;
00077 };
00078
00083 class AndCondition
00084 : public Condition {
00085 private:
00087 std::vector< boost::shared_ptr< const Condition > > M_condition_set;
00088
00089 public:
00090
00094 AndCondition( const boost::shared_ptr< const Condition > & p1,
00095 const boost::shared_ptr< const Condition > & p2 );
00096
00100 AndCondition( const boost::shared_ptr< const Condition > & p1,
00101 const boost::shared_ptr< const Condition > & p2,
00102 const boost::shared_ptr< const Condition > & p3 );
00103
00107 AndCondition( const boost::shared_ptr< const Condition > & p1,
00108 const boost::shared_ptr< const Condition > & p2,
00109 const boost::shared_ptr< const Condition > & p3,
00110 const boost::shared_ptr< const Condition > & p4 );
00111
00115 AndCondition( const boost::shared_ptr< const Condition > & p1,
00116 const boost::shared_ptr< const Condition > & p2,
00117 const boost::shared_ptr< const Condition > & p3,
00118 const boost::shared_ptr< const Condition > & p4,
00119 const boost::shared_ptr< const Condition > & p5 );
00120
00124 AndCondition( const boost::shared_ptr< const Condition > & p1,
00125 const boost::shared_ptr< const Condition > & p2,
00126 const boost::shared_ptr< const Condition > & p3,
00127 const boost::shared_ptr< const Condition > & p4,
00128 const boost::shared_ptr< const Condition > & p5,
00129 const boost::shared_ptr< const Condition > & p6 );
00130
00134 AndCondition( const boost::shared_ptr< const Condition > & p1,
00135 const boost::shared_ptr< const Condition > & p2,
00136 const boost::shared_ptr< const Condition > & p3,
00137 const boost::shared_ptr< const Condition > & p4,
00138 const boost::shared_ptr< const Condition > & p5,
00139 const boost::shared_ptr< const Condition > & p6,
00140 const boost::shared_ptr< const Condition > & p7 );
00141
00145 AndCondition( const boost::shared_ptr< const Condition > & p1,
00146 const boost::shared_ptr< const Condition > & p2,
00147 const boost::shared_ptr< const Condition > & p3,
00148 const boost::shared_ptr< const Condition > & p4,
00149 const boost::shared_ptr< const Condition > & p5,
00150 const boost::shared_ptr< const Condition > & p6,
00151 const boost::shared_ptr< const Condition > & p7,
00152 const boost::shared_ptr< const Condition > & p8 );
00153
00157 void append( const boost::shared_ptr< const Condition > & p )
00158 {
00159 M_condition_set.push_back( p );
00160 }
00161
00166 bool operator()( const PlayerAgent * agent ) const;
00167
00168 };
00169
00170
00175 class OrCondition
00176 : public Condition {
00177 private:
00179 std::vector< boost::shared_ptr< const Condition > > M_condition_set;
00180
00181 public:
00182
00186 OrCondition( const boost::shared_ptr< const Condition > & p1,
00187 const boost::shared_ptr< const Condition > & p2 );
00188
00192 OrCondition( const boost::shared_ptr< const Condition > & p1,
00193 const boost::shared_ptr< const Condition > & p2,
00194 const boost::shared_ptr< const Condition > & p3 );
00195
00199 OrCondition( const boost::shared_ptr< const Condition > & p1,
00200 const boost::shared_ptr< const Condition > & p2,
00201 const boost::shared_ptr< const Condition > & p3,
00202 const boost::shared_ptr< const Condition > & p4 );
00203
00207 OrCondition( const boost::shared_ptr< const Condition > & p1,
00208 const boost::shared_ptr< const Condition > & p2,
00209 const boost::shared_ptr< const Condition > & p3,
00210 const boost::shared_ptr< const Condition > & p4,
00211 const boost::shared_ptr< const Condition > & p5 );
00212
00216 OrCondition( const boost::shared_ptr< const Condition > & p1,
00217 const boost::shared_ptr< const Condition > & p2,
00218 const boost::shared_ptr< const Condition > & p3,
00219 const boost::shared_ptr< const Condition > & p4,
00220 const boost::shared_ptr< const Condition > & p5,
00221 const boost::shared_ptr< const Condition > & p6 );
00222
00226 OrCondition( const boost::shared_ptr< const Condition > & p1,
00227 const boost::shared_ptr< const Condition > & p2,
00228 const boost::shared_ptr< const Condition > & p3,
00229 const boost::shared_ptr< const Condition > & p4,
00230 const boost::shared_ptr< const Condition > & p5,
00231 const boost::shared_ptr< const Condition > & p6,
00232 const boost::shared_ptr< const Condition > & p7 );
00233
00237 OrCondition( const boost::shared_ptr< const Condition > & p1,
00238 const boost::shared_ptr< const Condition > & p2,
00239 const boost::shared_ptr< const Condition > & p3,
00240 const boost::shared_ptr< const Condition > & p4,
00241 const boost::shared_ptr< const Condition > & p5,
00242 const boost::shared_ptr< const Condition > & p6,
00243 const boost::shared_ptr< const Condition > & p7,
00244 const boost::shared_ptr< const Condition > & p8 );
00245
00249 void append( const boost::shared_ptr< const Condition > & p )
00250 {
00251 M_condition_set.push_back( p );
00252 }
00253
00258 bool operator()( const PlayerAgent * agent ) const;
00259
00260 };
00261
00262
00267 class NotCondition {
00268 private:
00269
00271 boost::shared_ptr< const Condition > M_condition;
00272
00273 public:
00274
00278 NotCondition( const boost::shared_ptr< const Condition > & p )
00279 : M_condition( p )
00280 { }
00281
00286 bool operator()( const PlayerAgent * agent ) const
00287 {
00288 return ( M_condition
00289 && ! (*M_condition)( agent ) );
00290 }
00291
00292 };
00293
00294 }
00295
00296 #endif