Go to the documentation of this file.00001
00008 #ifndef elementformulaRCP_hh
00009 #define elementformulaRCP_hh
00010
00011 #include "toolbox/sharedPointer.hh"
00012 #include "elementFormula.hh"
00013 #include "formula.hh"
00014 #include "constFormula.hh"
00015
00016 #define ElemFormRCPClone_D 0
00017 #define ElemFormRCPValue_D 0
00018 #define FormRCPClone_D 0
00019 #define FormRCPValue_D 0
00020
00021 namespace concepts {
00022
00023
00024
00025
00026 template<class F, typename G>
00027 class RCP<const ElementFormula<F,G> >
00028 : public boost::shared_ptr<const ElementFormula<F,G> >
00029 {
00030 public:
00038 explicit RCP(const F x)
00039 : boost::shared_ptr<const ElementFormula<F,G> >
00040 (new const ConstFormula<F>(x)) {}
00041
00043 RCP() : boost::shared_ptr<const ElementFormula<F,G> >() {}
00044
00045
00046 #if 0
00047
00048 template<class OldF, class OldG>
00049 RCP(RCP< const ElementFormula<OldF,OldG> > old)
00050 : boost::shared_ptr<const ElementFormula<F,G> >( old )
00051 {
00052 }
00053 #endif
00054
00067 explicit RCP(const ElementFormula<F,G>* x)
00068 : boost::shared_ptr<const ElementFormula<F,G> >(x) {}
00069
00071 RCP(boost::shared_ptr<const ElementFormula<F,G> >& x)
00072 : boost::shared_ptr<const ElementFormula<F,G> >(x) {}
00073
00076 template<class H>
00077 RCP(const boost::shared_ptr<H>& x)
00078 : boost::shared_ptr<const ElementFormula<F,G> >(x) {}
00079
00081 template<class H, class I>
00082 RCP(H x, I y) : boost::shared_ptr<const ElementFormula<F,G> >(x, y) {}
00083
00088
00090
00091
00092
00093
00094
00095
00096
00097 RCP(const ElementFormula<F,G>& x)
00098 : boost::shared_ptr<const ElementFormula<F,G> >(x.clone())
00099 {
00100 DEBUGL(ElemFormRCPClone_D, "Cloned " << **this << " = *" << *this);
00101 }
00102
00103 RCP<const ElementFormula<F,G> >&
00104 operator=(const RCP<const ElementFormula<F,G> >& x)
00105 {
00106 RCP<const ElementFormula<F,G> >(x).swap(*this);
00107 return *this;
00108 }
00109
00110 template<class H>
00111 RCP<const ElementFormula<F,G> >&
00112 operator=(const RCP<H>& x)
00113 {
00114 RCP<const ElementFormula<F,G> >(x).swap(*this);
00115 return *this;
00116 }
00117
00118 #if ElemFormRCPValue_D
00119
00120 const ElementFormula<F,G>& operator* () const
00121 {
00122 DEBUGL(1, *this);
00123 return boost::shared_ptr<const ElementFormula<F,G> >(*this).operator*();
00124 }
00125 #endif
00126 };
00127
00128
00129
00130
00131 template<class F>
00132 class RCP<const Formula<F> > : public boost::shared_ptr<const Formula<F> >
00133 {
00134 public:
00142 explicit RCP(const F x)
00143 : boost::shared_ptr<const Formula<F> >(new const ConstFormula<F>(x)) {}
00144
00146 RCP() : boost::shared_ptr<const Formula<F> >() {}
00147
00160 explicit RCP(const Formula<F>* x)
00161 : boost::shared_ptr<const Formula<F> >(x) {}
00162
00163 RCP(boost::shared_ptr<const Formula<F> >& x)
00164 : boost::shared_ptr<const Formula<F> >(x) {}
00165
00166 template<class H>
00167 RCP(const boost::shared_ptr<H>& x)
00168 : boost::shared_ptr<const Formula<F> >(x) {}
00169
00171 template<class H, class I>
00172 RCP(H x, I y) : boost::shared_ptr<const Formula<F> >(x, y) {}
00173
00178
00180
00181
00182
00183
00184
00185
00186 explicit RCP(const Formula<F>& x) : boost::shared_ptr<const Formula<F> >(x.clone())
00187 {
00188 DEBUGL(FormRCPClone_D, "Cloned " << **this << " = *" << *this);
00189 }
00190
00191 RCP<const Formula<F> >&
00192 operator=(const RCP<const Formula<F> >& x)
00193 {
00194 RCP<const Formula<F> >(x).swap(*this);
00195 return *this;
00196 }
00197
00198 template<class H>
00199 RCP<const Formula<F> >&
00200 operator=(const RCP<H>& x)
00201 {
00202 RCP<const Formula<F> >(x).swap(*this);
00203 return *this;
00204 }
00205
00206 #if FormRCPValue_D
00207
00208 const Formula<F>& operator* () const
00209 {
00210 DEBUGL(1, *this);
00211 return boost::shared_ptr<const Formula<F> >(*this).operator*();
00212 }
00213 #endif
00214
00215 };
00216
00217
00218 }
00219
00220
00221 #endif // elementformulaRCP_hh