/home/msneddon/eclipse/galileoSR1_cpp/workspace/NFsim/src/NFreactions/transformations/transformation.hh

Go to the documentation of this file.
00001 #ifndef TRANSFORMATION_HH_
00002 #define TRANSFORMATION_HH_
00003 
00004 
00005 #include "../NFreactions.hh"
00006 
00007 namespace NFcore
00008 {
00009 
00010         class SpeciesCreator;
00011         class Mapping;
00012         class Transformation;
00013 
00014 
00019         class TransformationFactory {
00020                 public:
00026                         static Transformation * genStateChangeTransform(unsigned int cIndex, int newValue);
00027 
00033                         static Transformation * genBindingTransform1(unsigned int bSiteIndex, unsigned int otherReactantIndex, unsigned int otherMappingIndex);
00034                         static Transformation * genBindingSeparateComplexTransform1(unsigned int bSiteIndex, unsigned int otherReactantIndex, unsigned int otherMappingIndex);
00035 
00041                         static Transformation * genBindingTransform2(unsigned int bSiteIndex);
00042 
00049                         static Transformation * genUnbindingTransform(unsigned int bSiteIndex);
00050 
00055                         static Transformation * genAddMoleculeTransform(SpeciesCreator *sc);
00056 
00063                         static Transformation * genRemoveMoleculeTransform(int removalType);
00070                         static Transformation * genEmptyTransform();
00071 
00076                         static Transformation * genIncrementStateTransform(unsigned int cIndex);
00077 
00082                         static Transformation * genDecrementStateTransform(unsigned int cIndex);
00083 
00084 
00085 
00087                         static const int COMPLETE_SPECIES_REMOVAL = 0;
00088 
00090                         static const int DELETE_MOLECULES = 1;
00091 
00093                         static const int DELETE_MOLECULES_NO_KEYWORD = 2;
00094 
00095 
00096 
00097 
00098 
00099 
00101                         static const unsigned int STATE_CHANGE = 0;
00102 
00104                         static const unsigned int BINDING = 1;
00105 
00107                         static const unsigned int UNBINDING = 2;
00108 
00110                         static const unsigned int REMOVE = 3;
00111 
00113                         static const unsigned int ADD = 4;
00114 
00117                         static const unsigned int EMPTY = 5;
00118 
00120                         static const unsigned int INCREMENT_STATE = 6;
00121 
00122 
00124                         static const unsigned int DECREMENT_STATE = 7;
00125 
00126 
00127 
00129 
00130                         static Transformation * genLocalFunctionReference(string PointerName, int type, TemplateMolecule *tm);
00131                         static const unsigned int LOCAL_FUNCTION_REFERENCE = 8;
00133 
00134         };
00135 
00136 
00137 
00142         class Transformation {
00143                 public:
00144                         Transformation(int type) {this->type=type;};
00145                         virtual ~Transformation() {};
00146                         int getType() const { return type; }
00147                         virtual void apply(Mapping *m, MappingSet **ms) = 0;
00148                         virtual int getComponentIndex() const = 0;
00149                         virtual int getRemovalType() { return -1; };
00150                 protected:
00151                         int type;
00152         };
00153 
00154 
00155         class LocalFunctionReference : public Transformation {
00156                 public:
00157                         LocalFunctionReference(string PointerName, int scope, TemplateMolecule *tm);
00158                         virtual ~LocalFunctionReference() {};
00159                         virtual void apply(Mapping *m, MappingSet **ms) {};
00160                         virtual int getComponentIndex() const { return -1; };
00161 
00162                         TemplateMolecule *getTemplateObject() const {return tm;};
00163                         string getPointerName() const { return PointerName; };
00164                         int getFunctionScope() const {return scope; };
00165 
00166                         static const unsigned int SPECIES_FUNCTION=0;
00167                         static const unsigned int SINGLE_MOLECULE_FUNCTION=1;
00168                 protected:
00169                         string PointerName;
00170                         int scope;
00171                         TemplateMolecule *tm;
00172         };
00173 
00174 
00175 
00176         class EmptyTransform : public Transformation {
00177                 public:
00178                         EmptyTransform() : Transformation(TransformationFactory::EMPTY){ this->cIndex=-1; };
00179                         EmptyTransform(int cIndex) : Transformation(TransformationFactory::EMPTY){ this->cIndex=cIndex; };
00180                         virtual ~EmptyTransform() {};
00181                         virtual void apply(Mapping *m, MappingSet **ms) {};
00182                         virtual int getComponentIndex() const { return cIndex; };
00183                 protected:
00184                         int cIndex;
00185         };
00186 
00187 
00188         class StateChangeTransform : public Transformation {
00189                 public:
00190                         StateChangeTransform(int cIndex, int newValue);
00191                         virtual ~StateChangeTransform() {};
00192                         virtual void apply(Mapping *m, MappingSet **ms);
00193                         virtual int getComponentIndex() const {return cIndex;};
00194                 protected:
00195                         int cIndex;
00196                         int newValue;
00197         };
00198 
00199         class BindingTransform : public Transformation {
00200                 public:
00201                         BindingTransform(int cIndex, int otherReactantIndex, int otherMappingIndex);
00202                         virtual ~BindingTransform() {};
00203                         virtual void apply(Mapping *m, MappingSet **ms);
00204                         virtual int getComponentIndex() const {return cIndex;};
00205                 protected:
00206                         int cIndex;
00207                         int otherReactantIndex;
00208                         int otherMappingIndex;
00209         };
00210 
00211         class BindingSeparateComplexTransform : public BindingTransform {
00212                         public:
00213                                 BindingSeparateComplexTransform(int cIndex, int otherReactantIndex, int otherMappingIndex) :
00214                                         BindingTransform(cIndex, otherReactantIndex, otherMappingIndex) {};
00215                                 virtual ~BindingSeparateComplexTransform() {};
00216                                 virtual void apply(Mapping *m, MappingSet **ms);
00217                                 virtual int getComponentIndex() const {return cIndex;};
00218         };
00219 
00220         class UnbindingTransform : public Transformation {
00221                 public:
00222                         UnbindingTransform(int cIndex);
00223                         virtual ~UnbindingTransform() {};
00224                         virtual void apply(Mapping *m, MappingSet **ms);
00225                         virtual int getComponentIndex() const {return cIndex;};
00226                 protected:
00227                         int cIndex;
00228         };
00229 
00230         class AddMoleculeTransform : public Transformation {
00231                 public:
00232                         AddMoleculeTransform(SpeciesCreator *sc);
00233                         virtual ~AddMoleculeTransform();
00234                         virtual void apply(Mapping *m, MappingSet **ms);
00235                         virtual int getComponentIndex() const {cerr<<"You should not get a component index from an AddMoleculeTransform!!"<<endl; return -1;};
00236                 protected:
00237                         SpeciesCreator *sc;
00238         };
00239 
00240         class RemoveMoleculeTransform : public Transformation {
00241                 public:
00242                         RemoveMoleculeTransform(int removalType);
00243                         virtual ~RemoveMoleculeTransform() {};
00244                         virtual void apply(Mapping *m, MappingSet **ms);
00245                         virtual int getComponentIndex() const {cout<<"You should not get a component index from a RemoveMoleculeTransform!!"<<endl; exit(1); return -1;};
00246                         virtual int getRemovalType() { return removalType; };
00247 
00248                 protected:
00249                         int removalType;
00250 
00251         };
00252 
00253 
00254 
00255 
00256         class IncrementStateTransform : public Transformation {
00257                 public:
00258                         IncrementStateTransform(unsigned int stateIndex);
00259                         virtual ~IncrementStateTransform() {};
00260                         virtual void apply(Mapping *m, MappingSet **ms);
00261                         virtual int getComponentIndex() const {return cIndex;};
00262                 protected:
00263                         int cIndex;
00264         };
00265 
00266         class DecrementStateTransform : public Transformation {
00267                 public:
00268                         DecrementStateTransform(unsigned int stateIndex);
00269                         virtual ~DecrementStateTransform() {};
00270                         virtual void apply(Mapping *m, MappingSet **ms);
00271                         virtual int getComponentIndex() const {return cIndex;};
00272                 protected:
00273                         int cIndex;
00274         };
00275 
00276 
00277 
00278 }
00279 
00280 
00281 
00282 
00283 
00284 
00285 
00286 #endif /*TRANSFORMATION_HH_*/

Generated on Thu Dec 9 11:02:48 2010 for NFsim by  doxygen 1.5.4