summaryrefslogtreecommitdiff
path: root/db/introspect.h
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2007-11-04 20:47:12 -0500
committerDwight <dmerriman@gmail.com>2007-11-04 20:47:12 -0500
commit91237743715c5aea39f2bcaefc821273e94fefe1 (patch)
treeb5249fa375197afb0974c39f90a5a6b7a35a1e09 /db/introspect.h
parent86e112ae8f8f638279b6343f1da733376e7460e7 (diff)
downloadmongo-91237743715c5aea39f2bcaefc821273e94fefe1.tar.gz
introspection
Diffstat (limited to 'db/introspect.h')
-rw-r--r--db/introspect.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/db/introspect.h b/db/introspect.h
new file mode 100644
index 00000000000..2ed07290479
--- /dev/null
+++ b/db/introspect.h
@@ -0,0 +1,36 @@
+// introspect.h
+
+#pragma once
+
+#include "../stdafx.h"
+#include "jsobj.h"
+#include "pdfile.h"
+
+auto_ptr<Cursor> getSpecialCursor(const char *ns);
+
+class SingleResultObjCursor : public Cursor {
+ int i;
+protected:
+ JSObjBuilder b;
+ void reg(const char *as); /* register as a certain namespace */
+public:
+ SingleResultObjCursor() { i = 0; }
+ virtual bool ok() { return i == 0; }
+ virtual Record* _current() { assert(false); return 0; }
+ virtual DiskLoc currLoc() { assert(false); return DiskLoc(); }
+
+ virtual void fill() = 0;
+
+ virtual JSObj current() {
+ assert(i == 0);
+ fill();
+ return b.done();
+ }
+
+ virtual bool advance() {
+ i++;
+ return false;
+ }
+
+};
+