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 #ifndef _EOOPSELMASON_H
00026 #define _EOOPSELMASON_H
00027
00028
00029 #include <eoProportionalOpSel.h>
00030 #include <eoOpFactory.h>
00031
00032 #include <map>
00033
00034
00035
00038 template<class eoClass>
00039 class eoOpSelMason: public eoFactory<eoOpSelector<eoClass> > {
00040
00041 public:
00042 typedef std::vector<eoOp<eoClass>* > vOpP;
00043 typedef map<eoOpSelector<eoClass>*, vOpP > MEV;
00044
00046
00048 eoOpSelMason( eoOpFactory<eoClass>& _opFact): operatorFactory( _opFact ) {};
00049
00051 virtual ~eoOpSelMason() {};
00053
00065 virtual eoOpSelector<eoClass>* make(std::istream& _is) {
00066
00067 std::string opSelName;
00068 _is >> opSelName;
00069 eoOpSelector<eoClass>* opSelectorP;
00070
00071 if ( opSelName == "eoProportionalOpSel" ) {
00072 opSelectorP = new eoProportionalOpSel<eoClass>();
00073 }
00074
00075
00076 vOpP tmpPVec;
00077
00078 while ( _is ) {
00079 float rate;
00080 _is >> rate;
00081 if ( _is ) {
00082 eoOp<eoClass>* op = operatorFactory.make( _is );
00083
00084 opSelectorP->addOp( *op, rate );
00085
00086 tmpPVec.push_back( op );
00087 }
00088 }
00089
00090
00091 allocMap.insert( MEV::value_type( opSelectorP, tmpPVec ) );
00092
00093 return opSelectorP;
00094 };
00095
00097
00098
00099 virtual std::string className() const { return "eoOpSelMason"; }
00100
00102
00103 private:
00104 map<eoOpSelector<eoClass>*,std::vector<eoOp<eoClass>* > > allocMap;
00105 eoOpFactory<eoClass>& operatorFactory;
00106 };
00107
00108
00109 #endif