Permalink
Browse files

doc cleaning

  • Loading branch information...
erh committed Jan 16, 2009
1 parent 528bceb commit e87560d553ff1963244ba46dcebb62ca49e2e778
Showing with 81 additions and 39 deletions.
  1. +44 −20 client/dbclient.h
  2. +28 −15 db/jsobj.h
  3. +9 −4 doxygenConfig
View
@@ -73,7 +73,10 @@ namespace mongo {
}
};
#pragma pack(pop)
-
+
+ /**
+ interface that handles communication with the db
+ */
class DBConnector {
public:
virtual bool call( Message &toSend, Message &response, bool assertOk=true ) = 0;
@@ -148,20 +151,27 @@ namespace mongo {
void requestMore();
};
+
+ /**
+ the interface that any db connection should implement
+ */
class DBClientInterface : boost::noncopyable {
public:
- virtual
- auto_ptr<DBClientCursor> query(const char *ns, BSONObj query, int nToReturn = 0, int nToSkip = 0,
- BSONObj *fieldsToReturn = 0, int queryOptions = 0) = 0;
+ virtual auto_ptr<DBClientCursor> query(const char *ns, BSONObj query, int nToReturn = 0, int nToSkip = 0,
+ BSONObj *fieldsToReturn = 0, int queryOptions = 0) = 0;
- virtual
- BSONObj findOne(const char *ns, BSONObj query, BSONObj *fieldsToReturn = 0, int queryOptions = 0) = 0;
+ virtual BSONObj findOne(const char *ns, BSONObj query, BSONObj *fieldsToReturn = 0, int queryOptions = 0) = 0;
virtual void insert( const char * ns , BSONObj obj ) = 0;
+
+ virtual void remove( const char * ns , BSONObj obj , bool justOne = 0 );
+
+ virtual void update( const char * ns , BSONObj query , BSONObj obj , bool upsert = 0 );
};
- /* db "commands"
- basically just invocations of connection.$cmd.findOne({...});
+ /**
+ db "commands"
+ basically just invocations of connection.$cmd.findOne({...});
*/
class DBClientWithCommands : public DBClientInterface {
bool isOk(const BSONObj&);
@@ -300,10 +310,13 @@ namespace mongo {
virtual string toString() = 0;
};
-
+
+ /**
+ abstract class that implements the core db operations
+ */
class DBClientBase : public DBClientWithCommands, public DBConnector {
public:
- /* send a query to the database.
+ /** send a query to the database.
ns: namespace to query, format is <dbname>.<collectname>[.<collectname>]*
query: query to perform on the collection. this is a BSONObj (binary JSON)
You may format as
@@ -315,22 +328,33 @@ namespace mongo {
optional template of which fields to select. if unspecified, returns all fields
queryOptions: see options enum at top of this file
- returns: cursor.
- 0 if error (connection failure)
- */
- /*throws AssertionException*/
- virtual
- auto_ptr<DBClientCursor> query(const char *ns, BSONObj query, int nToReturn = 0, int nToSkip = 0,
- BSONObj *fieldsToReturn = 0, int queryOptions = 0);
+ @return cursor. 0 if error (connection failure)
+ @throws AssertionException
+ */
+ virtual auto_ptr<DBClientCursor> query(const char *ns, BSONObj query, int nToReturn = 0, int nToSkip = 0,
+ BSONObj *fieldsToReturn = 0, int queryOptions = 0);
- /*throws AssertionException*/
- virtual
- BSONObj findOne(const char *ns, BSONObj query, BSONObj *fieldsToReturn = 0, int queryOptions = 0);
+ /**
+ @return a single object that matches the query. if none do, then the object is empty
+ @throws AssertionException
+ */
+ virtual BSONObj findOne(const char *ns, BSONObj query, BSONObj *fieldsToReturn = 0, int queryOptions = 0);
+ /**
+ insert an object into the database
+ */
virtual void insert( const char * ns , BSONObj obj );
+
+ /**
+ remove matching objects from the database
+ @param justOne if this true, then once a single match is found will stop
+ */
virtual void remove( const char * ns , BSONObj obj , bool justOne = 0 );
+ /**
+ updates objects matching query
+ */
virtual void update( const char * ns , BSONObj query , BSONObj obj , bool upsert = 0 );
/**
View
@@ -117,9 +117,9 @@ namespace mongo {
#pragma pack(pop)
- /* BSONElement represents an "element" in a BSONObj. So for the object { a : 3, b : "abc" },
+ /** BSONElement represents an "element" in a BSONObj. So for the object { a : 3, b : "abc" },
'a : 3' is the first element (key+value).
-
+
The BSONElement object points into the BSONObj's data. Thus the BSONObj must stay in scope
for the life of the BSONElement.
@@ -280,6 +280,9 @@ namespace mongo {
int compareElementValues(const BSONElement& l, const BSONElement& r);
int getGtLtOp(BSONElement& e);
+ /**
+ an actual bson object
+ */
class BSONObj {
friend class BSONObjIterator;
class Details {
@@ -332,18 +335,18 @@ namespace mongo {
// Properly formatted JSON string.
string jsonString( JsonStringFormat format = Strict ) const;
- /* note: addFields always adds _id even if not specified */
+ /** note: addFields always adds _id even if not specified */
int addFields(BSONObj& from, set<string>& fields); /* returns n added */
- /* returns # of top level fields in the object
+ /** returns # of top level fields in the object
note: iterates to count the fields
*/
int nFields();
- /* adds the field names to the fields set. does NOT clear it (appends). */
+ /** adds the field names to the fields set. does NOT clear it (appends). */
int getFieldNames(set<string>& fields);
- /* return has eoo() true if no match
+ /** return has eoo() true if no match
supports "." notation to reach into embedded objects
*/
BSONElement getFieldDotted(const char *name) const;
@@ -370,19 +373,26 @@ namespace mongo {
bool getBoolField(const char *name);
- /* makes a new BSONObj with the fields specified in pattern.
+ /** makes a new BSONObj with the fields specified in pattern.
fields returned in the order they appear in pattern.
if any field missing, you get back an empty object overall.
- */
- // sets element field names to empty string
- // If an array is encountered while scanning the dotted names in pattern,
- // that array is added to the returned obj, rather than any subobjects
- // referenced within the array. The variable nameWithinArray is set to the
- // name of the requested field within the returned array.
+
+ sets element field names to empty string
+ If an array is encountered while scanning the dotted names in pattern,
+ that array is added to the returned obj, rather than any subobjects
+ referenced within the array. The variable nameWithinArray is set to the
+ name of the requested field within the returned array.
+ */
BSONObj extractFieldsDotted(BSONObj pattern, BSONObjBuilder& b, const char *&nameWithinArray) const; // this version, builder owns the returned obj buffer
- // sets element field names to empty string
+
+ /**
+ sets element field names to empty string
+ */
BSONObj extractFieldsUnDotted(BSONObj pattern);
- // returns elements with original field names
+
+ /**
+ returns elements with original field names
+ */
BSONObj extractFields(BSONObj &pattern);
const char *objdata() const {
@@ -524,6 +534,9 @@ namespace mongo {
BSONObjBuilder * _builder;
};
+ /**
+ utility for creating BSONObj
+ */
class BSONObjBuilder {
public:
BSONObjBuilder(int initsize=512) : b(initsize) {
View
@@ -51,11 +51,16 @@ SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
+
+# ***
+# ERH - this controls whether all classes in files are documented or just the ones with tags
+# ***
+EXTRACT_ALL = NO
+
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = YES
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
@@ -97,7 +102,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = client
+INPUT = client db/jsobj.h
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \

0 comments on commit e87560d

Please sign in to comment.