Go to the documentation of this file.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
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _parttypes_h_
00036 #define _parttypes_h_
00037
00038
00039 #include <vector>
00040 #include <string>
00041 #include <iostream>
00042
00043
00044 #include "parttype.h"
00045
00046
00047 #include "partunif.h"
00048 #include "partsegm.h"
00049 #include "partcrit.h"
00050 #include "partderiv.h"
00051
00052
00053
00054
00055
00056 namespace unifexp {
00057
00058
00059
00060
00061
00062
00063
00064 template <class numType>
00065 class partTypes
00066 {
00067 public:
00068
00069 partTypes ();
00070
00071
00072 ~partTypes ();
00073
00074
00075
00076 partType<numType> *get (const std::string &name) const;
00077
00078
00079
00080 void getNames (std::vector<std::string> &names) const;
00081
00082 private:
00083
00084 partTypes (const partTypes<numType> &);
00085
00086
00087 partTypes<numType> &operator = (const partTypes<numType> &);
00088
00089
00090
00091
00092 std::vector<partType<numType> *> objects;
00093
00094 };
00095
00096
00097
00098 template <class numType>
00099 inline partTypes<numType>::partTypes ()
00100 {
00101
00102 objects. push_back (new partUniform<numType> ());
00103 objects. push_back (new partSegmented<numType> ());
00104 objects. push_back (new partCritical<numType> ());
00105 objects. push_back (new partDerivative<numType> ());
00106
00107
00108
00109
00110 return;
00111 }
00112
00113 template <class numType>
00114 inline partTypes<numType>::~partTypes ()
00115 {
00116 for (typename std::vector<partType<numType> *>::iterator iter =
00117 objects. begin (); iter != objects. end (); ++ iter)
00118 {
00119 delete *iter;
00120 }
00121 return;
00122 }
00123
00124 template <class numType>
00125 inline partTypes<numType>::partTypes (const partTypes<numType> &)
00126 {
00127 throw "Copy constructor not implemented for the partitions class.";
00128 return;
00129 }
00130
00131 template <class numType>
00132 inline partTypes<numType> &partTypes<numType>::operator =
00133 (const partTypes<numType> &)
00134 {
00135 throw "Assignment operator not implemented "
00136 "for the partitions class.";
00137 return *this;
00138 }
00139
00140 template <class numType>
00141 inline partType<numType> *partTypes<numType>::get (const std::string &name)
00142 const
00143 {
00144 for (typename std::vector<partType<numType> *>::const_iterator
00145 iter = objects. begin (); iter != objects. end (); ++ iter)
00146 {
00147 if ((*iter) -> name () == name)
00148 return *iter;
00149 }
00150 return 0;
00151 }
00152
00153 template <class numType>
00154 inline void partTypes<numType>::getNames (std::vector<std::string> &names)
00155 const
00156 {
00157 for (typename std::vector<partType<numType> *>::const_iterator
00158 iter = objects. begin (); iter != objects. end (); ++ iter)
00159 {
00160 names. push_back ((*iter) -> name ());
00161 }
00162 return;
00163 }
00164
00165
00166 }
00167
00168 #endif // _parttypes_h_
00169
00170
00171