示例#1
0
文件: object.cpp 项目: fmorgner/odb
bool CObject::ResolveIDs(CODB& oDB)
  {
  m_poClass = oDB.Id2Ptr(m_poClass);

  // remap the atom list
  CVectorAtom aoAtoms;
  for (auto const &itAtom : m_aoAtoms)
    {
    // replace the surrogate with the real pointer
    aoAtoms.push_back( oDB.Id2Ptr(itAtom) );
    } // for (auto const &itAtom : m_aoAtoms)
  m_aoAtoms.swap(aoAtoms);

  // remap the child-reasons-map
  //
  // DO NOT TRY TO REMAP THE TRUE MAP IN ONE STEP USING THE ITERATOR !!
  // because this will be an unsure operation. The map is a "unique-map"
  // during remapping some duplicate key may appear:
  // the "surrogate-key" will be replaced by the true pointer, this
  // translates a long value to a pointer value = 32bit int -> 32bit int
  CMapChildren moChildren;
  for (CMapChildren::iterator itChild=m_moChildren.begin();
                              itChild!=moChildren.end();
                            ++itChild)
    {
    // remap the list of reasons
    CListReason* ploReasons = new CListReason;
    for (auto const &itReason : *itChild->second)
      {
      ploReasons->insert( oDB.Id2Ptr(itReason) );
      } // for (auto const &itReason : *itChild->second)

    // delete it->second because it was allocated while loading
    delete itChild->second;
    itChild->second = 0;

    // append the remapped child with his remapped (link-)reasons
    //  to the temporary map
    moChildren[oDB.Id2Ptr(itChild->first)] = ploReasons;
    } // for (CMapChildren::iterator itChild=m_moChildren.begin(); ...
  // assign the temporary child-reasons-map to the true one

  m_moChildren = moChildren;

  inherited::ResolveIDs(oDB);
  return true;
  } // bool CObject::ResolveIDs(CODB& oDB)
示例#2
0
文件: class.cpp 项目: morgner/odb
bool CClass::ResolveIDs(CODB& oDB)
  {
  m_poOMAL = oDB.Id2Ptr(m_poOMAL);
  inherited::ResolveIDs(oDB);
  return true;
  } // bool CClass::ResolveIDs(CODB& oDB)