summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-03-15 23:30:36 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-03-15 23:30:36 -0400
commit4edf34ed01611d75bdcd98aa065a2b286845ebd9 (patch)
tree6a9734beaf245c116e8553d28a2039d7fa59b9eb /indra/llcommon
parentbe669d4a1fe0e52ba8524ad851376cf653c822b6 (diff)
Promote LLProcess::ReadPipe::size() to BasePipe (hence WritePipe).
Certain use cases need to know whether the WritePipe buffer has been flushed to the pipe, or is still pending.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llprocess.cpp1
-rw-r--r--indra/llcommon/llprocess.h24
2 files changed, 15 insertions, 10 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index bd08c3ab51..d4786035ce 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -163,6 +163,7 @@ public:
}
virtual std::ostream& get_ostream() { return mStream; }
+ virtual size_type size() const { return mStreambuf.size(); }
bool tick(const LLSD&)
{
diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h
index 06ada83698..51010966f9 100644
--- a/indra/llcommon/llprocess.h
+++ b/indra/llcommon/llprocess.h
@@ -340,6 +340,20 @@ public:
typedef std::size_t size_type;
static const size_type npos;
+
+ /**
+ * Get accumulated buffer length.
+ *
+ * For WritePipe, is there still pending data to send to child?
+ *
+ * For ReadPipe, we often need to refrain from actually reading the
+ * std::istream returned by get_istream() until we've accumulated
+ * enough data to make it worthwhile. For instance, if we're expecting
+ * a number from the child, but the child happens to flush "12" before
+ * emitting "3\n", get_istream() >> myint could return 12 rather than
+ * 123!
+ */
+ virtual size_type size() const = 0;
};
/// As returned by getWritePipe() or getOptWritePipe()
@@ -388,16 +402,6 @@ public:
virtual std::string read(size_type len) = 0;
/**
- * Get accumulated buffer length.
- * Often we need to refrain from actually reading the std::istream
- * returned by get_istream() until we've accumulated enough data to
- * make it worthwhile. For instance, if we're expecting a number from
- * the child, but the child happens to flush "12" before emitting
- * "3\n", get_istream() >> myint could return 12 rather than 123!
- */
- virtual size_type size() const = 0;
-
- /**
* Peek at accumulated buffer data without consuming it. Optional
* parameters give you substr() functionality.
*