mana-core-sgcomps / src / ProxyProviderSvc.h

The default branch has multiple heads

/** @file ProxyProviderSvc.h
    @brief manages the address providers and add proxies on demand to the store
  * @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration
  * $Id: ProxyProviderSvc.h,v 1.2 2007-06-22 23:54:56 calaf Exp $
  */


#ifndef STOREGATE_PROXYPROVIDERSVC_H
# define STOREGATE_PROXYPROVIDERSVC_H

#ifndef ATHENAKERNEL_IPROXYPROVIDERSVC_H
 #include "AthenaKernel/IProxyProviderSvc.h"
#endif
#ifndef GAUDIKERNEL_SERVICE_H
 #include "GaudiKernel/Service.h"
#endif
#ifndef GAUDIKERNEL_PROPERTY_H
 #include "GaudiKernel/Property.h" /*StringArrayProperty*/
#endif
#ifndef KERNEL_STATUSCODES_H
 #include "GaudiKernel/StatusCode.h"
#endif
#include <cassert>
#ifndef _CPP_SET
 #include <set>
#endif
#ifndef _CPP_STRING
 #include <string>
#endif
namespace SG {
  class DataProxy;
  class TransientAddress;
}

class IAddressProvider;
class IProxyRegistry; //this is DataStore
class IConversionSvc;
class IOpaqueAddress;
class ISvcLocator;
template <class TYPE> class SvcFactory;

///manages the address providers and add proxies on demand to the store
class ProxyProviderSvc : virtual public IProxyProviderSvc,
			 public Service 
{
public:

  typedef std::set<IAddressProvider*>::iterator  pAPiterator;
  typedef std::list<SG::TransientAddress*> TAdList;
  typedef TAdList::iterator TAdIterator;

  ///IProxyProvider interface
  //@{
  ///add proxies to the store to modify (before Begin Event)
  virtual StatusCode preLoadProxies(IProxyRegistry& storeToModify);

  ///add proxies to the store to modify (during Begin Event)
  virtual StatusCode loadProxies(IProxyRegistry& storeToModify);

  ///get the default proxy. Optionally add proxies to the store to modify
  virtual SG::DataProxy* retrieveProxy(const CLID& id, const std::string& key,
				       IProxyRegistry& storeToModify);

  /// update a transient Address
  virtual StatusCode updateAddress(SG::TransientAddress* tad);

 ///create a list of transient Addresses:
  StatusCode addAddresses(IProxyRegistry& dataStore,
			  IAddressProvider* iap,
			  TAdList& tad);

  ///create a new Proxy, overriding CLID and/or key
  SG::DataProxy* addAddress(IProxyRegistry& storeToModify, 
			    SG::TransientAddress* tad);
  //@}


  ///IAddressProvider manager functionality
  ///add a provider to the set of known ones. PROVIDER IS OWNED BY THE CLIENT
  virtual void addProvider(IAddressProvider* aProvider);

  /// Service boilerplate
  //@{
  virtual StatusCode initialize();
  virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
  //@}

protected:    
  /// the Service Factory
  friend class SvcFactory<ProxyProviderSvc>;
  /// Standard Service Constructor
  ProxyProviderSvc(const std::string& name, ISvcLocator* svcLoc);
  virtual ~ProxyProviderSvc();

private:
  /// property: the services declared as providers
  StringArrayProperty m_providerNames;
  /// the handler for m_providerNames
  void providerNamesPropertyHandler( Property& theProp );
  
  /// the providers we know about. WE DON'T OWN THEM
  std::set<IAddressProvider*> m_providers; 
  /// Persistency Service
  IConversionSvc* m_pDataLoader;   
};


inline void ProxyProviderSvc::addProvider(IAddressProvider* aProvider) {
  assert(aProvider);
  m_providers.insert(aProvider);
}

#endif // STOREGATE_PROXYPROVIDERSVC_H
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.