Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / JAWS / clients / Caching / URL_Array_Helper.cpp
blob62cf3c41be85f5c6da2703c15d7021b43c665cd2
1 // URL_Array_Helper.cpp
3 #ifndef ACE_URL_ARRAY_HELPER_C
4 #define ACE_URL_ARRAY_HELPER_C
6 #include "URL_Array_Helper.h"
8 // Some helper functions for encoding/decoding
10 template <class T>
11 size_t ace_array_size (const T &x)
13 size_t sum = sizeof (ACE_UINT32);
14 for (size_t i = 0; i < x.size (); i++)
15 sum += x[i].size ();
16 return sum;
19 template <class T>
20 size_t ace_array_encode (void *buf, const T &x)
22 size_t len = 0;
23 for (size_t i = 0; i < x.size (); i++)
24 len+= x[i].encode ((void *) ((char *) buf + len));
25 return len ;
28 template <class T>
29 size_t ace_array_decode (void *buf, T &x)
31 size_t len = 0;
32 for (size_t i = 0; i < x.size (); i++)
33 len += x[i].decode ((void *) ((char *) buf + len));
34 return len;
38 #endif /* ACE_URL_ARRAY_HELPER_C */