CMS 3D CMS Logo

IgDocumentDataManager.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Studio/interface/IgDocumentDataManager.h"
00004 #include "Iguana/Studio/interface/IgDocumentData.h"
00005 #include "Iguana/Framework/interface/IgDocumentDataRoot.h"
00006 
00007 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00008 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00009 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00010 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00011 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00012 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00013 
00014 IG_DEFINE_STATE_ELEMENT (IgDocumentDataManager, "Services/Document Data Manager");
00015 
00016 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00018 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00019 
00020 IgDocumentDataManager::IgDocumentDataManager (IgState *state)
00021     : m_state (state)
00022 { ASSERT (m_state); m_state->put (s_key, this); }
00023 
00024 IgDocumentDataManager::~IgDocumentDataManager (void)
00025 { m_state->detach (s_key); }
00026 
00027 IgState *
00028 IgDocumentDataManager::state (void)
00029 { return m_state; }
00030 
00031 std::vector<std::string>
00032 IgDocumentDataManager::roots (void)
00033 {
00034     std::vector<std::string> names;
00035             
00036     for (DocDataMap::iterator i = m_docData.begin ();
00037          i != m_docData.end (); i++)
00038         names.push_back (i->first);
00039             
00040     return names;
00041 }
00042 
00043 IgState*
00044 IgDocumentDataManager::lookup (IgState* state /*=0*/, std::string root /*=""*/)
00045 {
00046     if (root.size () == 0)
00047       root = IgDocumentDataRoot::getCurrentRoot ();
00048       
00049     DocDataMap::iterator i = m_docData .find (root);
00050     
00051     if (i != m_docData.end ())
00052        return i->second;
00053     else if (state)
00054     {
00055         m_docData [root] = state;
00056         IgDocumentData::get (state)->root (root, true);
00057     }
00058     return state;
00059 }

Generated on Tue Jun 9 17:38:49 2009 for CMSSW by  doxygen 1.5.4