Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-04-05 11:02:25 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-05 11:02:25 +0300
commite9bb018a4aea1b4aeb692cdadce158496a270e32 (patch)
tree9f8c122feb8a68cc34f5ab6c99407a20d72fa50d /source/blender/alembic/intern/abc_util.h
parent4dadb6d4453d84d537e25e753f7904ce5c8539fb (diff)
parent8647d5af9015097698984e9864802848914e803c (diff)
Merge branch 'master' into blender2.8
Conflicts: source/blender/alembic/intern/abc_exporter.h
Diffstat (limited to 'source/blender/alembic/intern/abc_util.h')
-rw-r--r--source/blender/alembic/intern/abc_util.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index a878029928c..ab2cce59afa 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -165,4 +165,48 @@ public:
# define SCOPE_TIMER(message)
#endif
+/* *************************** */
+
+/**
+ * Utility class whose purpose is to more easily log related informations. An
+ * instance of the SimpleLogger can be created in any context, and will hold a
+ * copy of all the strings passed to its output stream.
+ *
+ * Different instances of the class may be accessed from different threads,
+ * although accessing the same instance from different threads will lead to race
+ * conditions.
+ */
+class SimpleLogger {
+ std::ostringstream m_stream;
+
+public:
+ /**
+ * Check whether or not the SimpleLogger's stream is empty.
+ */
+ bool empty();
+
+ /**
+ * Return a copy of the string contained in the SimpleLogger's stream.
+ */
+ std::string str() const;
+
+ /**
+ * Remove the bits set on the SimpleLogger's stream and clear its string.
+ */
+ void clear();
+
+ /**
+ * Return a reference to the SimpleLogger's stream, in order to e.g. push
+ * content into it.
+ */
+ std::ostringstream &stream();
+};
+
+#define ABC_LOG(logger) logger.stream()
+
+/**
+ * Pass the content of the logger's stream to the specified std::ostream.
+ */
+std::ostream &operator<<(std::ostream &os, const SimpleLogger &logger);
+
#endif /* __ABC_UTIL_H__ */