[PATCH] Back to using Cheetah::CHEETAH for serialization
Richard Guenther
rguenth at tat.physik.uni-tuebingen.de
Tue Dec 30 19:52:15 UTC 2003
Hi!
This patch is a partial reversion of a previous patch that made us use
Cheetah::DELEGATE serialization for RemoteProxy. It also brings us a
Cheetah::CHEETAH serialization for std::string, which was previously
missing. One step more for the MPI merge.
Tested together with all other MPI changes with serial, Cheetah and MPI.
Ok?
Richard.
2003Dec30 Richard Guenther <richard.guenther at uni-tuebingen.de>
* src/Tulip/RemoteProxy.h: use Cheetah::CHEETAH for serialization,
add std::string serializer.
Index: RemoteProxy.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Tulip/RemoteProxy.h,v
retrieving revision 1.19
diff -u -u -r1.19 RemoteProxy.h
--- RemoteProxy.h 21 Oct 2003 18:47:59 -0000 1.19
+++ RemoteProxy.h 30 Dec 2003 19:45:26 -0000
@@ -70,63 +70,35 @@
#if POOMA_CHEETAH
namespace Cheetah {
- template<int Dim>
- class DelegateType<Grid<Dim> > {
- public:
- enum { delegate = false };
- };
-
- template<int Dim>
- class DelegateType<Interval<Dim> > {
- public:
- enum { delegate = false };
- };
-
- template<int Dim>
- class DelegateType<Loc<Dim> > {
- public:
- enum { delegate = false };
- };
-
- template<int Dim, class T, class Tag>
- class DelegateType<Vector<Dim, T, Tag> > {
- public:
- enum { delegate = false };
- };
-
/**
- * DELEGATE specializations for STL vectors.
+ * CHEETAH specializations for STL strings
*/
- template<class T>
- class Serialize< ::Cheetah::DELEGATE, std::vector<T> >
- {
+ template<>
+ class Serialize< ::Cheetah::CHEETAH, std::string>
+ {
public:
-
- static inline int size(const std::vector<T>& v)
+ static inline int size(const std::string& str)
{
- return Serialize<ARRAY, T>::size(0, v.size());
+ return Serialize<ARRAY, char>::size(0, str.length());
}
-
- static int pack(const std::vector<T> &v, char* buffer)
+
+ static int pack(const std::string &str, char* buffer)
{
- CTAssert(!DelegateType<T>::delegate);
- return Serialize<ARRAY, T>::pack(&v[0], buffer, v.size());
+ return Serialize<ARRAY, char>::pack(str.data(), buffer, str.length());
}
- static int unpack(std::vector<T>* &v, char* buffer)
+ static int unpack(std::string* &str, char* buffer)
{
- T* ptr;
+ char* ptr;
int size;
- int n = Serialize<ARRAY, T>::unpack(ptr, buffer, size);
- v = new std::vector<T>(size);
- for (int i=0; i<size; ++i)
- (*v)[i] = ptr[i];
+ int n = Serialize<ARRAY, char>::unpack(ptr, buffer, size);
+ str = new std::string(ptr, size);
return n;
}
- static void cleanup(std::vector<T>* v) { delete v; }
+ static void cleanup(std::string* str) { delete str; }
};
} // namespace Cheetah
@@ -190,7 +162,7 @@
{
if (toContext != Pooma::context())
{
- Pooma::indexHandler()->sendWith(Cheetah::DELEGATE(), toContext, tag, val);
+ Pooma::indexHandler()->sendWith(Cheetah::CHEETAH(), toContext, tag, val);
}
}
#endif
@@ -203,7 +175,7 @@
RemoteProxyBase::ready_m = false;
- Pooma::indexHandler()->requestWith(Cheetah::DELEGATE(), owningContext, tag,
+ Pooma::indexHandler()->requestWith(Cheetah::CHEETAH(), owningContext, tag,
This_t::receive, this);
while (!RemoteProxyBase::ready_m)
More information about the pooma-dev
mailing list