PSEvt/include/DataProxy.h

Go to the documentation of this file.
00001 #ifndef PSEVT_DATAPROXY_H
00002 #define PSEVT_DATAPROXY_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: DataProxy.h 1840 2011-05-07 01:48:35Z salnikov $
00007 //
00008 // Description:
00009 //      Class DataProxy.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 #include <string>
00017 #include <boost/shared_ptr.hpp>
00018 
00019 //----------------------
00020 // Base Class Headers --
00021 //----------------------
00022 #include "PSEvt/Proxy.h"
00023 
00024 //-------------------------------
00025 // Collaborating Class Headers --
00026 //-------------------------------
00027 #include "pdsdata/xtc/Src.hh"
00028 
00029 //------------------------------------
00030 // Collaborating Class Declarations --
00031 //------------------------------------
00032 namespace PSEvt {
00033   class ProxyDictI;
00034 }
00035 
00036 //              ---------------------
00037 //              -- Class Interface --
00038 //              ---------------------
00039 
00040 namespace PSEvt {
00041 
00042 /**
00043  *  @ingroup PSEvt
00044  *  
00045  *  @brief Implementation of proxy object which keeps a pointer to real object.
00046  *
00047  *  This software was developed for the LCLS project.  If you use all or 
00048  *  part of it, please give an appropriate acknowledgment.
00049  *
00050  *  @see Proxy
00051  *
00052  *  @version \$Id: DataProxy.h 1840 2011-05-07 01:48:35Z salnikov $
00053  *
00054  *  @author Andy Salnikov
00055  */
00056 
00057 template <typename T>
00058 class DataProxy : public Proxy<T> {
00059 public:
00060 
00061   /// Constructor takes a smart pointer to the data object.
00062   DataProxy (const boost::shared_ptr<T>& data) : m_data(data) {}
00063 
00064   // Destructor
00065   virtual ~DataProxy () {}
00066 
00067 protected:
00068 
00069   /**
00070    *  @brief Get the data object from the proxy.
00071    *    
00072    *  @param[in] dict    Proxy dictionary containing this proxy.
00073    *  @param[in] source Detector address information
00074    *  @param[in] key     String key, additional key supplied by user.
00075    *  @return Shared pointer to the data object passed to the constructor.
00076    */
00077   virtual boost::shared_ptr<T> getTypedImpl(ProxyDictI* dict,
00078                                             const Pds::Src& source, 
00079                                             const std::string& key)
00080   {
00081     return m_data;
00082   }
00083 
00084 private:
00085 
00086   // Data members
00087   boost::shared_ptr<T> m_data; ///< Stored pointer to the data object.
00088 };
00089 
00090 } // namespace PSEvt
00091 
00092 #endif // PSEVT_DATAPROXY_H

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7