static inline NsEventWriter *createWriter(XmlDocument &xdoc, const DynamicContext *context, NsFullNid *rootNid) { XmlManager &mgr = GET_CONFIGURATION(context)->getManager(); xdoc = mgr.createDocument(); // prepare to create NsEventWriter DictionaryDatabase * dict = ((Manager&)mgr).getDictionary(); CacheDatabaseMinder &dbMinder = GET_CONFIGURATION(context)-> getDbMinder(); // get the temp DB for construction (container id 0) CacheDatabase *cdb = dbMinder.findOrAllocate((Manager&)mgr, 0); DocID did = dbMinder.allocateDocID((Manager&)mgr); // Tell the document to use this database, and that it's // content is "NsDom" // TBD GMF: Eventually it may be that Document and NsDocument objects // will not be required by DbXmlNodeImpl, so creation/init of Document // objects will not be required. ((Document&)xdoc).setContentAsNsDom(did, cdb); NsEventWriter *writer = new NsEventWriter(cdb->getDb(), dict, did); writer->writeStartDocumentInternal(0, 0, 0, rootNid); return writer; }
void ResultsEventWriter::createEventWriter(void) { DBXML_ASSERT(depth_ == 0); DBXML_ASSERT(!writer_); DBXML_ASSERT(!xmlDoc_); // prepare to create NsEventWriter XmlManager& mgr = res_->getManager(); CacheDatabaseMinder& dbMinder = res_->getDbMinder(); xmlDoc_ = mgr.createDocument(); // allocate a DocID DocID did = dbMinder.allocateDocID((Manager&)mgr); // get the temp DB for construction (container id 0) CacheDatabase *cdb = dbMinder.findOrAllocate((Manager&)mgr, 0); // Tell the document to use this database, and that it's // content is "NsDom" // TBD GMF: Eventually it may be that Document and NsDocument objects // will not be required by DbXmlNodeImpl, so creation/init of Document // objects will not be required. DictionaryDatabase *dict = ((Manager&)mgr).getDictionary(); ((Document&)xmlDoc_).setContentAsNsDom(did, cdb); writer_ = new NsEventWriter(cdb->getDb(), dict, did); writer_->writeStartDocument(version_, encoding_, standalone_); DBXML_ASSERT(writer_); DBXML_ASSERT(xmlDoc_); }
DbWrapper *ContainerBase::getDbWrapper(DynamicContext *context) { if (context) { CacheDatabaseMinder &dbMinder = GET_CONFIGURATION(context)-> getDbMinder(); if (!dbMinder.isNull()) { CacheDatabase *cdb = dbMinder.findOrAllocate( mgr_, getContainerID()); if (cdb) return cdb->getDb(); } } return 0; }