void Reordering<Pos>::_sort (const typename Pos::template array<T>& rank) { //build unsorted array std::vector<SortNode<T> > sorted; sorted.reserve(m_used); for (typename Pos::sparse_iterator iter=Pos::sbegin(), end=Pos::send(); iter!=end; ++iter) { Pos pos = *iter; sorted.push_back(SortNode<T>(oid_t(pos), rank(pos))); } //sort array std::sort(sorted.begin(), sorted.end()); //create lookup tables for (oid_t i = 0; i <= m_total; ++i) { m_old2new[i] = 0; } m_new2old[0] = 0; for (oid_t j = 1; j <= m_used; ++j) { oid_t i = sorted[j-1].pos; m_old2new[i] = j; m_new2old[j] = i; } }
HRESULT CFastdbFeature::OnChangedName() { USES_CONVERSION; COM_TRY { // neuen Namen vom Bezugsobjekt besorgen CComBSTR bstrName; WTRiASFeature BaseFeat; THROW_FAILED_HRESULT(m_BaseUnk -> QueryInterface (BaseFeat.ppi())); THROW_FAILED_HRESULT(BaseFeat -> get_Name(CLEARED(&bstrName))) // zugehöriges DB-Objekt referenzieren LONG lCursor (GetPropertyFrom (BaseFeat, g_cbFeatureCursor, 0L)); if (0 != lCursor) { // Objekt fertig initialisiert dbCursor<CDBFeatureDesc> cursor (GetRelatedDatabase(GetUnknown()), dbCursorForUpdate); CDBFeatureDesc *pFeatDesc = cursor.at (dbReference<CDBFeatureDesc>(oid_t(lCursor))); if (NULL == pFeatDesc || cursor.isEmpty()) THROW_FAILED_HRESULT(FASTDB_E_FEATURE_BADREFERENCE); cursor -> m_pName = OLE2A(bstrName); cursor.update(); } } COM_CATCH; return S_OK; }
DtMmdbInfoRequest* newDtMmdbInfoRequestWithPrimaryOid(int bc_id, char* oid_str) { DtMmdbInfoRequest* x = (DtMmdbInfoRequest*) malloc(sizeof(DtMmdbInfoRequest)); x -> bookcase_descriptor = bc_id ; x -> primary_oid = newDtMmdbHandle(oid_t(oid_str, true, false)); return x; }
// eine neue Objekteigenschaft soll erzeugt werden STDMETHODIMP CFastdbFeatures::OnCreate (VARIANT Name, BSTR Type, FEATURETYPE rgType, ITRiASFeature **ppIFeat) { CHECKOUTPOINTER(ppIFeat); USES_CONVERSION; COM_TRY { // jetzt wirklich erzeugen CIID ClsId (Type, CIID::INITCIID_InitFromProgId); if (!ClsId) ClsId = CLSID_FastdbFeature; // default ClsId WTRiASFeatures BaseFeats; WDispatch Parent; THROW_FAILED_HRESULT(m_BaseUnk -> QueryInterface (BaseFeats.ppi())); THROW_FAILED_HRESULT(BaseFeats -> get_Parent (Parent.ppi())); // Parent muß hier Objektklasse sein WTRiASObjects Objs; THROW_FAILED_HRESULT(Parent -> QueryInterface (Objs.ppi())); // neuen Satz erzeugen und zu der Objektklasse hinzufügen LONG lCursor (GetPropertyFrom (Objs, g_cbObjectsCursor, 0L)); _ASSERTE(0 != lCursor); dbDatabase *pdb = GetRelatedDatabase(GetUnknown()); dbCursor<CDBClass> cursor (pdb); CDBClass *pClass = cursor.at (dbReference<CDBClass>(oid_t(lCursor))); if (NULL == pClass || cursor.isEmpty()) THROW_FAILED_HRESULT(FASTDB_E_OBJECTS_BADREFERENCE); CComVariant vVal; CDBFeatureDesc FDesc; THROW_FAILED_HRESULT(vVal.ChangeType (VT_BSTR, &Name)); FDesc.m_pName = OLE2A(V_BSTR(&vVal)); FDesc.m_rgType = rgType; FDesc.objclass = cursor.currentId(); dbCursor<CDBFeatureDesc> featuredesc (GetRelatedDatabase(GetUnknown())); featuredesc.at (pdb -> insert (FDesc)); THROW_FAILED_HRESULT(SetupFeature (ClsId, BaseFeats, featuredesc, Parent, ppIFeat)); } COM_CATCH; return S_OK; }
void MarkBase_mmdb::get_marks (UAS_Pointer<UAS_Common> &doc_ptr, xList<UAS_Pointer<Mark> > &list) { #ifdef FUJITSU_OLIAS UAS_String theId = doc_ptr->bid(); theId = theId + "/" + doc_ptr->id(); #else UAS_String theId = doc_ptr->id(); #endif oid_list_handler *l = f_mark_base->get_mark_list ((char *) theId); if (l != NULL) { for (int i = 1; i <= (*l)->count(); i++) { // Pull the entry from the list and replace it with NULL so // that it doesn't get deleted when the list is deleted. oid_t id = (*l)-> operator()(i); // Assure that the oid_t has not been deleted. qfc 7-6-93 if (id.eq (oid_t (c_code_t(0), 0)) == false) { try { Mark_mmdb *m = find_mark (id, doc_ptr); list.append (m); } catch_any() { // ignore failure for now! DJB } end_try; } } delete l; } }
io_status short_list::asciiIn(istream& in) { if ( in.get() != LIST_MARK_CHAR ) { throw(formatException("short_list::asciiIn(): LIST_MARK_CHAR")); } if ( in.get() != '\n' ) { throw(formatException("short_list::asciiIn(): \n")); } handler* hd_ptr = 0; #ifndef C_API oid_t oid_buffer[OID_BUFFER_SIZE]; int oid_buffer_level = 0; #endif char c; int ct = 0; while ( (c = in.get()) != LIST_MARK_CHAR ) { in.putback(c); c_code_t ccode; in >> ccode; in.get(); hd_ptr = new handler (oid_t(ccode, 0), storage_ptr); (*hd_ptr) -> asciiIn(in); #ifndef C_API if ( oid_buffer_level == OID_BUFFER_SIZE ) { ct = oid_list::count(); oid_list::expand_space(OID_BUFFER_SIZE); for ( int i=0; i<OID_BUFFER_SIZE; i++ ) { oid_list::update_component(ct+i+1, oid_buffer[i]); } oid_buffer_level = 0; } oid_buffer[oid_buffer_level] = hd_ptr -> its_oid(); oid_buffer_level++; #else oid_list::insert_component(hd_ptr -> its_oid()); #endif delete hd_ptr; } if ( in.get() != '\n' ) { throw(formatException("short_list::asciiIn(): \n")); } #ifndef C_API if ( oid_buffer_level > 0 ) { ct = oid_list::count(); oid_list::expand_space(oid_buffer_level); for ( int i=0; i<oid_buffer_level; i++ ) { oid_list::update_component(ct+i+1, oid_buffer[i]); } } #endif return done; }