CMS 3D CMS Logo

VisConfiguration Class Reference

#include <VisFramework/VisFrameworkBase/interface/VisConfiguration.h>

Inheritance diagram for VisConfiguration:

IgStateElement

List of all members.

Public Types

typedef std::pair
< VisConfigMapItr,
VisConfigMapItr
SRANGE
typedef std::multimap
< std::string, VisConfigurable *,
std::less< std::string > > 
VisConfigMap
typedef
VisConfigMap::const_iterator 
VisConfigMapConItr
typedef VisConfigMap::iterator VisConfigMapItr
typedef std::map< std::string,
std::string, std::less
< std::string > > 
VisState

Public Member Functions

void dumpConfig (VisState &state) const
void erase (const VisConfigurable *ihim)
void insert (const std::string &iname, VisConfigurable *ihim)
void modify (const std::string &iname, const std::string &ivalue)
void set (const std::string &iname, const std::string &ivalue)
 VisConfiguration (IgState *state)
virtual ~VisConfiguration (void)

Static Public Attributes

static const int MENU_ID_CONFIG = 8900
static const int MENU_ID_CONFIG_CMSSW = 8901
static const int MENU_ID_CONFIG_SAVE = 8903
static const int MENU_ID_CONFIG_SEP = 8902

Protected Member Functions

void clear (void)
VisConfigMap::iterator find (const VisConfigurable *ihim, VisConfigMapItr p)

Private Member Functions

 IG_DECLARE_STATE_ELEMENT (VisConfiguration)

Private Attributes

VisConfigEditorm_editor
VisConfigMap m_registry
IgStatem_state


Detailed Description

Definition at line 21 of file VisConfiguration.h.


Member Typedef Documentation

typedef std::pair<VisConfigMapItr,VisConfigMapItr> VisConfiguration::SRANGE

Definition at line 34 of file VisConfiguration.h.

typedef std::multimap<std::string, VisConfigurable*, std::less<std::string> > VisConfiguration::VisConfigMap

Definition at line 31 of file VisConfiguration.h.

typedef VisConfigMap::const_iterator VisConfiguration::VisConfigMapConItr

Definition at line 32 of file VisConfiguration.h.

typedef VisConfigMap::iterator VisConfiguration::VisConfigMapItr

Definition at line 33 of file VisConfiguration.h.

typedef std::map<std::string, std::string, std::less<std::string> > VisConfiguration::VisState

Definition at line 30 of file VisConfiguration.h.


Constructor & Destructor Documentation

VisConfiguration::VisConfiguration ( IgState state  ) 

Definition at line 30 of file VisConfiguration.cc.

References ASSERT, edmplugin::standard::config(), DBSPlugin::get(), IgQtAppMenuService::index(), m_editor, m_state, MENU_ID_CONFIG, MENU_ID_CONFIG_CMSSW, MENU_ID_CONFIG_SAVE, and IgState::put().

00031     : m_state (state),
00032       m_editor (new VisConfigEditor (state))
00033 {    
00034     ASSERT (state);
00035     state->put (s_key, this);
00036 
00037     ASSERT (IgQtAppMenuService::get (m_state));
00038     QMenuBar    *menu = IgQtAppMenuService::get (m_state)->menuBar ();
00039     QPopupMenu  *config = new QPopupMenu (menu);
00040 
00041     config->setCaption ("Configure");
00042     config->insertTearOffHandle ();
00043     config->insertItem
00044         ("&Edit...", m_editor, SLOT (show ()), 0,
00045          MENU_ID_CONFIG_CMSSW, IgQtAppMenuService::index
00046          (config, MENU_ID_CONFIG_CMSSW));
00047     config->insertSeparator ();
00048     config->insertItem ("Save Configuration", m_editor, SLOT (saveConfig ()), 0, 
00049                         MENU_ID_CONFIG_SAVE, IgQtAppMenuService::index 
00050                         (config, MENU_ID_CONFIG_SAVE));
00051    
00052     menu->insertItem ("&Configure", config, MENU_ID_CONFIG,
00053                       IgQtAppMenuService::index (menu, MENU_ID_CONFIG));
00054 
00055     menu->setItemChecked (MENU_ID_CONFIG_SAVE, true);
00056 }

VisConfiguration::~VisConfiguration ( void   )  [virtual]

Definition at line 58 of file VisConfiguration.cc.

References ASSERT, clear(), IgState::detach(), and m_state.

00059 {    
00060     ASSERT (m_state);
00061     m_state->detach (s_key);
00062     clear ();
00063 }


Member Function Documentation

void VisConfiguration::clear ( void   )  [protected]

Definition at line 124 of file VisConfiguration.cc.

References m_registry.

Referenced by ~VisConfiguration().

00125 {
00126     IgQtLock ();
00127 //     VisConfigMapItr e = m_registry.end ();
00128 //     VisConfigMapItr p = m_registry.begin ();
00129 //     for (; p != e; ++p)
00130 //     {
00131 //      (*(*p).second).detach ();
00132 //     }
00133     m_registry.clear ();
00134 }

void VisConfiguration::dumpConfig ( VisState state  )  const

Definition at line 66 of file VisConfiguration.cc.

References ASSERT, GenMuonPlsPt100GeV_cfg::cout, e, lat::endl(), exception, lat::Error::explainSelf(), cms::Exception::explainSelf(), LFfwvis, LOG, m_registry, p, and GsfMatrixTools::trace().

Referenced by VisConfigEditor::refreshBtn_clicked().

00067 {
00068     IgQtLock ();
00069 
00070     try
00071     {
00072         VisConfigMapConItr e = m_registry.end ();
00073         VisConfigMapConItr p = m_registry.begin ();
00074         for (; p != e; ++p) 
00075         {
00076             ASSERT ((*p).second);
00077             LOG (0, trace, LFfwvis, "VisConfiguration[" << (*p).first
00078                  << ", " << (*p).second->get () << "]::dump()\n");
00079             state [(*p).first] = (*p).second->get (); 
00080         }
00081     }
00082     catch (cms::Exception& e)
00083     {
00084         std::cout << "**** VisConfiguration::dump ****\n cms::Exception " << e.explainSelf () << std::endl;
00085     }
00086     catch (lat::Error &e) 
00087     {
00088         std::cout << "**** VisConfiguration::dump ****\n lat::Error " << e.explainSelf () << std::endl;
00089     }
00090     catch (std::exception &e) 
00091     {
00092         std::cout << "**** VisConfiguration::dump ****\n Standard library exception caught: " << e.what () << std::endl;        
00093     }
00094     catch (...) 
00095     {
00096         std::cout << "**** VisConfiguration::dump ****\n Unknown Exception" << std::endl;
00097     }
00098 }

void VisConfiguration::erase ( const VisConfigurable ihim  ) 

Definition at line 108 of file VisConfiguration.cc.

References e, find(), m_registry, and p.

00109 {
00110     IgQtLock ();
00111     VisConfigMapItr e = m_registry.end ();
00112     VisConfigMapItr p = find (ihim, m_registry.begin ());
00113     while (p != e) 
00114     { 
00115         VisConfigMapItr q = p; 
00116         ++q; 
00117         m_registry.erase (p); 
00118         p = q;  // ospace does not return next...
00119         p = find (ihim, p);
00120     }
00121 }

VisConfiguration::VisConfigMap::iterator VisConfiguration::find ( const VisConfigurable ihim,
VisConfigMapItr  p 
) [protected]

Definition at line 137 of file VisConfiguration.cc.

References e, and m_registry.

Referenced by erase().

00138 { 
00139     IgQtLock ();
00140     VisConfigMapItr e = m_registry.end ();
00141     while (p != e) 
00142     {
00143         if ((*p).second == ihim) break; ++p;
00144     }
00145     return p;
00146 }

VisConfiguration::IG_DECLARE_STATE_ELEMENT ( VisConfiguration   )  [private]

void VisConfiguration::insert ( const std::string &  iname,
VisConfigurable ihim 
)

Definition at line 101 of file VisConfiguration.cc.

References m_registry.

00102 {
00103     IgQtLock ();
00104     m_registry.insert (std::make_pair (iname, ihim));
00105 }

void VisConfiguration::modify ( const std::string &  iname,
const std::string &  ivalue 
)

Definition at line 149 of file VisConfiguration.cc.

00150 {   
00151     IgQtLock ();
00152     std::string val (ivalue);
00153     set (iname, val);
00154 }

void VisConfiguration::set ( const std::string &  iname,
const std::string &  ivalue 
)

Definition at line 157 of file VisConfiguration.cc.

References m_registry, p, and range.

00158 {
00159     IgQtLock ();
00160     SRANGE range = m_registry.equal_range (iname);
00161     bool notEmpty = range.first != range.second;
00162     if (notEmpty)
00163     {
00164         // set method may erase itself making the iterator invalid...
00165         VisConfigMapItr p = range.first; 
00166         while (p != range.second) 
00167         {
00168             VisConfigMapItr q = p; 
00169             ++p; 
00170             VisConfigurable *bs = (*q).second;
00171             (*bs).set (ivalue);
00172         }
00173     }
00174 }


Member Data Documentation

VisConfigEditor* VisConfiguration::m_editor [private]

Definition at line 54 of file VisConfiguration.h.

Referenced by VisConfiguration().

VisConfigMap VisConfiguration::m_registry [private]

Definition at line 55 of file VisConfiguration.h.

Referenced by clear(), dumpConfig(), erase(), find(), insert(), and set().

IgState* VisConfiguration::m_state [private]

Definition at line 53 of file VisConfiguration.h.

Referenced by VisConfiguration(), and ~VisConfiguration().

const int VisConfiguration::MENU_ID_CONFIG = 8900 [static]

Definition at line 25 of file VisConfiguration.h.

Referenced by VisConfiguration().

const int VisConfiguration::MENU_ID_CONFIG_CMSSW = 8901 [static]

Definition at line 26 of file VisConfiguration.h.

Referenced by VisConfiguration().

const int VisConfiguration::MENU_ID_CONFIG_SAVE = 8903 [static]

Definition at line 28 of file VisConfiguration.h.

Referenced by VisConfiguration().

const int VisConfiguration::MENU_ID_CONFIG_SEP = 8902 [static]

Definition at line 27 of file VisConfiguration.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:10 2009 for CMSSW by  doxygen 1.5.4