Version: 6.3.1
Public Member Functions | Private Member Functions | Private Attributes

StudyContext Class Reference

#include <SMESH_Gen_i.hxx>

Public Member Functions

 StudyContext ()
 ~StudyContext ()
int addObject (string theIOR)
int findId (string theIOR)
string getIORbyId (const int theId)
string getIORbyOldId (const int theOldId)
void mapOldToNew (const int oldId, const int newId)
int getOldId (const int newId)

Private Member Functions

int getNextId ()

Private Attributes

map< int, string > mapIdToIOR
map< int, intmapIdToId

Detailed Description

Definition at line 60 of file SMESH_Gen_i.hxx.


Constructor & Destructor Documentation

StudyContext.StudyContext ( )

Definition at line 64 of file SMESH_Gen_i.hxx.

{}
StudyContext.~StudyContext ( )

Definition at line 66 of file SMESH_Gen_i.hxx.

  {
    mapIdToIOR.clear();
    mapIdToId.clear();
  }

Member Function Documentation

int StudyContext.addObject ( string  theIOR)

Definition at line 72 of file SMESH_Gen_i.hxx.

Referenced by SMESH_Gen_i.RegisterObject().

  {
    int nextId = getNextId();
    mapIdToIOR[ nextId ]  = theIOR;
    return nextId;
  }
int StudyContext.findId ( string  theIOR)

Definition at line 79 of file SMESH_Gen_i.hxx.

Referenced by SMESH_Gen_i.GetObjectId(), SMESH_Gen_i.IORToLocalPersistentID(), SMESH_Gen_i.Load(), and SMESH_Gen_i.Save().

  {
    map<int, string>::iterator imap;
    for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
      if ( imap->second == theIOR )
        return imap->first;
    }
    return 0;
  }
string StudyContext.getIORbyId ( const int  theId)

Definition at line 89 of file SMESH_Gen_i.hxx.

  {
    if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() )
      return mapIdToIOR[ theId ];
    return string( "" );
  }
string StudyContext.getIORbyOldId ( const int  theOldId)

Definition at line 96 of file SMESH_Gen_i.hxx.

Referenced by SMESH_Gen_i.Load(), and SMESH_Gen_i.LocalPersistentIDToIOR().

  {
    if ( mapIdToId.find( theOldId ) != mapIdToId.end() )
      return getIORbyId( mapIdToId[ theOldId ] );
    return string( "" );
  }
int StudyContext.getNextId ( ) [private]

Definition at line 118 of file SMESH_Gen_i.hxx.

  {
    int id = 1;
    while( mapIdToIOR.find( id ) != mapIdToIOR.end() )
      id++;
    return id;
  }
int StudyContext.getOldId ( const int  newId)

Definition at line 107 of file SMESH_Gen_i.hxx.

Referenced by SMESH_Gen_i.Load().

                                  {
    map<int, int>::iterator imap;
    for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
      if ( imap->second == newId )
        return imap->first;
    }
    return 0;
  }
void StudyContext.mapOldToNew ( const int  oldId,
const int  newId 
)

Definition at line 103 of file SMESH_Gen_i.hxx.

Referenced by SMESH_Gen_i.Load().

                                                       {
    mapIdToId[ oldId ] = newId;
  }

Field Documentation

map<int, int> StudyContext.mapIdToId [private]

Definition at line 127 of file SMESH_Gen_i.hxx.

map<int, string> StudyContext.mapIdToIOR [private]

Definition at line 126 of file SMESH_Gen_i.hxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS