CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ora::TransactionCache Class Reference

#include <TransactionCache.h>

Public Member Functions

void addContainer (int id, const std::string &name, Handle< DatabaseContainer > &contPtr)
 
void clear ()
 
const std::map< int, Handle
< DatabaseContainer > > & 
containers ()
 
bool dbExists ()
 
bool dbExistsLoaded ()
 
std::map< std::string,
std::string > & 
dbParams ()
 
void dropDatabase ()
 
bool dropPermission ()
 
bool dropPermissionLoaded ()
 
void eraseContainer (int id, const std::string &name)
 
Handle< DatabaseContainergetContainer (int id)
 
Handle< DatabaseContainergetContainer (const std::string &name)
 
boost::shared_ptr< void > getNamedReference (const std::string &name)
 
bool isLoaded ()
 
void setDbExists (bool exists)
 
void setDropPermission (bool allowed)
 
void setLoaded ()
 
void setNamedReference (const std::string &name, boost::shared_ptr< void > &data)
 
void setUtility (Handle< DatabaseUtilitySession > &utility)
 
 TransactionCache ()
 
Handle< DatabaseUtilitySessionutility ()
 
virtual ~TransactionCache ()
 

Private Member Functions

void cleanUpNamedRefCache ()
 

Private Attributes

std::map< int, Handle
< DatabaseContainer > > 
m_containersById
 
std::map< std::string, int > m_containersByName
 
std::pair< bool, bool > m_dbExists
 
std::map< std::string,
std::string > 
m_dbParams
 
std::pair< bool, bool > m_dropPermission
 
bool m_loaded
 
std::map< std::string,
boost::weak_ptr< void > > 
m_namedRefCache
 
Handle< DatabaseUtilitySessionm_utility
 

Detailed Description

Definition at line 16 of file TransactionCache.h.

Constructor & Destructor Documentation

ora::TransactionCache::TransactionCache ( )

Definition at line 5 of file TransactionCache.cc.

5  :
6  m_dbExists(false,false),
9  m_dbParams(),
10  m_utility(),
11  m_loaded( false ),
13  m_dropPermission(false,false){
14 }
std::map< int, Handle< DatabaseContainer > > m_containersById
std::map< std::string, int > m_containersByName
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
std::map< std::string, std::string > m_dbParams
Handle< DatabaseUtilitySession > m_utility
std::pair< bool, bool > m_dbExists
std::pair< bool, bool > m_dropPermission
ora::TransactionCache::~TransactionCache ( )
virtual

Definition at line 16 of file TransactionCache.cc.

References hitfit::clear().

16  {
17  clear();
18 }

Member Function Documentation

void ora::TransactionCache::addContainer ( int  id,
const std::string &  name,
Handle< DatabaseContainer > &  contPtr 
)

Definition at line 50 of file TransactionCache.cc.

52  {
53  m_containersById.insert( std::make_pair( id, contPtr ) );
54  m_containersByName.insert( std::make_pair( name, id ) );
55 }
std::map< int, Handle< DatabaseContainer > > m_containersById
std::map< std::string, int > m_containersByName
void ora::TransactionCache::cleanUpNamedRefCache ( )
private

Definition at line 116 of file TransactionCache.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

116  {
117  std::vector<std::string> namesToDelete;
118  for( std::map<std::string,boost::weak_ptr<void> >::const_iterator iEntry = m_namedRefCache.begin();
119  iEntry != m_namedRefCache.end(); iEntry++ ){
120  if( iEntry->second.expired() ) namesToDelete.push_back( iEntry->first );
121  }
122  for( std::vector<std::string>::const_iterator iName = namesToDelete.begin();
123  iName != namesToDelete.end(); iName++ ){
124  m_namedRefCache.erase( *iName );
125  }
126 }
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
void ora::TransactionCache::clear ( void  )

Definition at line 20 of file TransactionCache.cc.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), and Vispa.Views.WidgetView.WidgetView::setDataObjects().

20  {
21  m_dbExists.first = false;
22  m_dbExists.second = false;
23  for( std::map<int, Handle<DatabaseContainer> >::iterator iCont = m_containersById.begin();
24  iCont != m_containersById.end(); iCont++ ){
25  iCont->second.clear();
26  }
27  m_utility.clear();
28  m_containersById.clear();
29  m_containersByName.clear();
30  m_dbParams.clear();
31  m_loaded = false;
32  m_namedRefCache.clear();
33  m_dropPermission.first = false;
34  m_dropPermission.second = false;
35 }
std::map< int, Handle< DatabaseContainer > > m_containersById
std::map< std::string, int > m_containersByName
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
std::map< std::string, std::string > m_dbParams
Handle< DatabaseUtilitySession > m_utility
std::pair< bool, bool > m_dbExists
std::pair< bool, bool > m_dropPermission
const std::map< int, ora::Handle< ora::DatabaseContainer > > & ora::TransactionCache::containers ( )

Definition at line 81 of file TransactionCache.cc.

81  {
82  return m_containersById;
83 }
std::map< int, Handle< DatabaseContainer > > m_containersById
bool ora::TransactionCache::dbExists ( )

Definition at line 46 of file TransactionCache.cc.

46  {
47  return m_dbExists.second;
48 }
std::pair< bool, bool > m_dbExists
bool ora::TransactionCache::dbExistsLoaded ( )

Definition at line 42 of file TransactionCache.cc.

42  {
43  return m_dbExists.first;
44 }
std::pair< bool, bool > m_dbExists
std::map< std::string, std::string > & ora::TransactionCache::dbParams ( )

Definition at line 96 of file TransactionCache.cc.

96  {
97  return m_dbParams;
98 }
std::map< std::string, std::string > m_dbParams
void ora::TransactionCache::dropDatabase ( )

Definition at line 85 of file TransactionCache.cc.

85  {
86  m_dbExists.second = true;
87  m_dbExists.second = false;
88  m_containersById.clear();
89  m_containersByName.clear();
90  m_dbParams.clear();
91  m_namedRefCache.clear();
92  m_dropPermission.first = false;
93  m_dropPermission.second = false;
94 }
std::map< int, Handle< DatabaseContainer > > m_containersById
std::map< std::string, int > m_containersByName
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
std::map< std::string, std::string > m_dbParams
std::pair< bool, bool > m_dbExists
std::pair< bool, bool > m_dropPermission
bool ora::TransactionCache::dropPermission ( )

Definition at line 152 of file TransactionCache.cc.

152  {
153  return m_dropPermission.second;
154 }
std::pair< bool, bool > m_dropPermission
bool ora::TransactionCache::dropPermissionLoaded ( )

Definition at line 148 of file TransactionCache.cc.

148  {
149  return m_dropPermission.first;
150 }
std::pair< bool, bool > m_dropPermission
void ora::TransactionCache::eraseContainer ( int  id,
const std::string &  name 
)

Definition at line 57 of file TransactionCache.cc.

58  {
59  m_containersById.erase( id );
60  m_containersByName.erase( name );
61 }
std::map< int, Handle< DatabaseContainer > > m_containersById
std::map< std::string, int > m_containersByName
ora::Handle< ora::DatabaseContainer > ora::TransactionCache::getContainer ( int  id)

Definition at line 63 of file TransactionCache.cc.

References instance.

63  {
65  std::map<int, Handle<DatabaseContainer> >::iterator iCont = m_containersById.find( id );
66  if( iCont != m_containersById.end() ){
67  instance = iCont->second;
68  }
69  return instance;
70 }
std::map< int, Handle< DatabaseContainer > > m_containersById
static PFTauRenderPlugin instance
ora::Handle< ora::DatabaseContainer > ora::TransactionCache::getContainer ( const std::string &  name)

Definition at line 72 of file TransactionCache.cc.

References instance.

72  {
74  std::map<std::string, int>::iterator iId = m_containersByName.find( name );
75  if( iId == m_containersByName.end() ){
76  return instance;
77  }
78  return getContainer( iId->second );
79 }
Handle< DatabaseContainer > getContainer(int id)
static PFTauRenderPlugin instance
std::map< std::string, int > m_containersByName
boost::shared_ptr< void > ora::TransactionCache::getNamedReference ( const std::string &  name)

Definition at line 133 of file TransactionCache.cc.

References runTheMatrix::ret.

133  {
135  boost::shared_ptr<void> ret;
136  std::map<std::string,boost::weak_ptr<void> >::const_iterator iEntry = m_namedRefCache.find( name );
137  if( iEntry != m_namedRefCache.end() ){
138  ret = iEntry->second.lock();
139  }
140  return ret;
141 }
tuple ret
prodAgent to be discontinued
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
bool ora::TransactionCache::isLoaded ( )

Definition at line 108 of file TransactionCache.cc.

108  {
109  return m_loaded;
110 }
void ora::TransactionCache::setDbExists ( bool  exists)

Definition at line 37 of file TransactionCache.cc.

37  {
38  m_dbExists.first = true;
39  m_dbExists.second = exists;
40 }
std::pair< bool, bool > m_dbExists
void ora::TransactionCache::setDropPermission ( bool  allowed)

Definition at line 143 of file TransactionCache.cc.

143  {
144  m_dropPermission.first = true;
145  m_dropPermission.second = allowed;
146 }
std::pair< bool, bool > m_dropPermission
void ora::TransactionCache::setLoaded ( )

Definition at line 112 of file TransactionCache.cc.

112  {
113  m_loaded = true;
114 }
void ora::TransactionCache::setNamedReference ( const std::string &  name,
boost::shared_ptr< void > &  data 
)

Definition at line 128 of file TransactionCache.cc.

129  {
130  m_namedRefCache.insert( std::make_pair( name, boost::weak_ptr<void>(data) ) );
131 }
std::map< std::string, boost::weak_ptr< void > > m_namedRefCache
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ora::TransactionCache::setUtility ( Handle< DatabaseUtilitySession > &  utility)

Definition at line 100 of file TransactionCache.cc.

100  {
101  m_utility = utility;
102 }
Handle< DatabaseUtilitySession > utility()
Handle< DatabaseUtilitySession > m_utility
ora::Handle< ora::DatabaseUtilitySession > ora::TransactionCache::utility ( )

Definition at line 104 of file TransactionCache.cc.

104  {
105  return m_utility;
106 }
Handle< DatabaseUtilitySession > m_utility

Member Data Documentation

std::map<int, Handle<DatabaseContainer> > ora::TransactionCache::m_containersById
private

Definition at line 66 of file TransactionCache.h.

std::map<std::string, int> ora::TransactionCache::m_containersByName
private

Definition at line 65 of file TransactionCache.h.

std::pair<bool,bool> ora::TransactionCache::m_dbExists
private

Definition at line 64 of file TransactionCache.h.

std::map<std::string,std::string> ora::TransactionCache::m_dbParams
private

Definition at line 67 of file TransactionCache.h.

std::pair<bool,bool> ora::TransactionCache::m_dropPermission
private

Definition at line 71 of file TransactionCache.h.

bool ora::TransactionCache::m_loaded
private

Definition at line 69 of file TransactionCache.h.

std::map<std::string,boost::weak_ptr<void> > ora::TransactionCache::m_namedRefCache
private

Definition at line 70 of file TransactionCache.h.

Handle<DatabaseUtilitySession> ora::TransactionCache::m_utility
private

Definition at line 68 of file TransactionCache.h.