summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/kernel/cache.hpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/kernel/cache.hpp (renamed from sca-cpp/trunk/modules/cache/cache.hpp)16
1 files changed, 9 insertions, 7 deletions
diff --git a/sca-cpp/trunk/modules/cache/cache.hpp b/sca-cpp/trunk/kernel/cache.hpp
index ba66021f3d..28ab38c76f 100644
--- a/sca-cpp/trunk/modules/cache/cache.hpp
+++ b/sca-cpp/trunk/kernel/cache.hpp
@@ -23,7 +23,7 @@
#define tuscany_cache_hpp
/**
- * Simple cache monad implementation.
+ * Simple local cache monad implementation.
*/
#include <sys/stat.h>
@@ -33,7 +33,6 @@
#include "monad.hpp"
namespace tuscany {
-namespace cache {
/**
* Cached monad. Used to represent a value that can be cached.
@@ -53,10 +52,6 @@ public:
cached(const cached<V>& c) : lvalue(c.lvalue), ltime(c.ltime), mtime(c.mtime), v(c.v) {
}
- operator const V() const {
- return v;
- }
-
const cached<V>& operator=(const cached<V>& c) {
if(this == &c)
return *this;
@@ -84,6 +79,7 @@ private:
V v;
template<typename X> friend const cached<X> latest(const cached<X>& c);
+ template<typename X> friend const X content(const cached<X>& c);
template<typename X> friend std::ostream& operator<<(std::ostream& out, const cached<X>& c);
};
@@ -106,6 +102,13 @@ template<typename V> const cached<V> latest(const cached<V>& c) {
}
/**
+ * Returns the content of a cached monad.
+ */
+template<typename V> const V content(const cached<V>& c) {
+ return c.v;
+}
+
+/**
* Returns the latest modification time of a file.
*/
const unsigned long latestFileTime(const std::string& path) {
@@ -117,6 +120,5 @@ const unsigned long latestFileTime(const std::string& path) {
}
}
-}
#endif /* tuscany_cache_hpp */