00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_InterfaceBase_H
00010 #define ThePEG_InterfaceBase_H
00011
00012
00013 #include "ThePEG/Config/ThePEG.h"
00014 #include "InterfaceBase.fh"
00015 #include "InterfaceBase.xh"
00016 #include "ThePEG/Utilities/Named.h"
00017 #include "ThePEG/Utilities/ClassTraits.h"
00018 #include "Interface.h"
00019
00020 namespace ThePEG {
00021
00059 class InterfaceBase: public Named {
00060
00061 public:
00062
00083 InterfaceBase(string newName, string newDescription,
00084 string newClassName,
00085 const type_info & newTypeInfo, bool depSafe,
00086 bool readonly);
00087
00091 virtual ~InterfaceBase() {}
00092
00098 virtual string
00099 exec(InterfacedBase & ib, string action, string arguments) const
00100 = 0;
00101
00105 virtual string type() const = 0;
00106
00111 virtual void rebind(InterfacedBase &,
00112 const TranslationMap &,
00113 const IVector & = IVector()) const {}
00114
00119 virtual IVector getReferences(const InterfacedBase &) const {
00120 return IVector();
00121 }
00122
00126 string description() const { return theDescription; }
00127
00131 virtual string fullDescription(const InterfacedBase & ib) const;
00132
00137 virtual void doxygenDescription(ostream & stream) const;
00138
00143 virtual string doxygenType() const = 0;
00144
00149 string className() const { return theClassName; }
00150
00155 bool dependencySafe() const { return isDependencySafe; }
00156
00161 void setDependencySafe() { isDependencySafe = true; }
00162
00167 void setDependencySensitive() { isDependencySafe = false; }
00168
00173 bool readOnly() const { return isReadOnly && (!NoReadOnly); }
00174
00179 void setReadOnly() { isReadOnly = true; }
00180
00185 void setReadWrite() { isReadOnly = false; }
00186
00191 bool anonymous() const { return description().empty(); }
00192
00197 double rank() const { return theRank; }
00198
00203 void rank(double r) { theRank = r; }
00204
00208 static bool NoReadOnly;
00209
00210 private:
00211
00215 string theDescription;
00216
00220 string theClassName;
00221
00226 double theRank;
00227
00228 protected:
00229
00234 mutable bool isDependencySafe;
00235
00240 mutable bool isReadOnly;
00241
00242
00243 };
00244
00245
00251 class RefInterfaceBase: public InterfaceBase {
00252
00253 public:
00254
00291 RefInterfaceBase(string newName, string newDescription,
00292 string newClassName, const type_info & newTypeInfo,
00293 string newRefClassName,
00294 const type_info & newRefTypeInfo,
00295 bool depSafe, bool readonly,
00296 bool norebind, bool nullable, bool defnull);
00297
00302 string refClassName() const { return theRefClassName; }
00303
00308 const type_info & refTypeInfo() const { return theRefTypeInfo; }
00309
00314 bool noRebind() const { return dontRebind; }
00315
00320 void setNoRebind() { dontRebind = true; }
00321
00326 void setRebind() { dontRebind = false; }
00327
00332 bool noNull() const { return !isNullable; }
00333
00338 void setNullable() { isNullable = true; }
00339
00344 void setNotNullable() { isNullable = false; }
00345
00350 bool defaultIfNull() const { return theDefaultIfNull; }
00351
00356 void setDefaultIfNull() { theDefaultIfNull = true; }
00357
00362 void setNoDefaultIfNull() { theDefaultIfNull = false; }
00363
00364 private:
00365
00370 string theRefClassName;
00371
00375 const type_info & theRefTypeInfo;
00376
00381 bool dontRebind;
00382
00387 bool isNullable;
00388
00393 bool theDefaultIfNull;
00394
00395 };
00396
00399 inline double operator/(string,string) { return 0.0; }
00400
00403 inline string operator*(double,string) { return ""; }
00404
00405 }
00406
00407 #endif