Date: Friday, January 19, 2007 @ 15:34:58
Author: marc
Path: /cvsroot/carob/carob/include
Modified: StringCodecs.hpp (1.24 -> 1.25)
Added nomutex_encode() and nomutex_decode() in base class to give an
opportunity for optimizations in derived classes.
------------------+
StringCodecs.hpp | 15 +++++++++++++++
1 files changed, 15 insertions(+)
Index: carob/include/StringCodecs.hpp
diff -u carob/include/StringCodecs.hpp:1.24 carob/include/StringCodecs.hpp:1.25
--- carob/include/StringCodecs.hpp:1.24 Fri Jan 19 13:04:31 2007
+++ carob/include/StringCodecs.hpp Fri Jan 19 15:34:58 2007
@@ -64,9 +64,24 @@
class StringCodec
{
public:
+ /** Encodes the given string using the encoding set in the
+ * constructor. Thread safe */
virtual std::string encode(const std::wstring&) const throw
(CodecException) = 0;
+ /** Decodes the given bytes using the encoding set in the
+ * constructor. Thread safe */
virtual std::wstring decode(const std::string&) const throw
(CodecException) = 0;
virtual ~StringCodec() { }; // not much to delete...
+
+ /** Optional optimization. Maybe faster method, suitable ONLY for
+ * non-concurrent use. Unlike the safe encode() method above, this
+ * method may or may not be thread-safe, depending on the actual
+ * codec implementation */
+ virtual std::string nomutex_encode(const std::wstring& s) const throw
(CodecException)
+ { return encode(s); }
+ /* Idem above. Calling nomutex_encode() and nomutex_decode() each
+ * only once at the same time is safe */
+ virtual std::wstring nomutex_decode(const std::string& s) const throw
(CodecException)
+ { return decode(s); }
};
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits