Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:07:11

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_DATAOBJECT_H
0012 #define GAUDIKERNEL_DATAOBJECT_H
0013 
0014 // Framework include files
0015 #include "GaudiKernel/ClassID.h"
0016 #include "GaudiKernel/StatusCode.h"
0017 
0018 // STL includes
0019 #include <memory>
0020 #include <ostream>
0021 #include <string>
0022 
0023 // Forward declarations
0024 class IOpaqueAddress;
0025 class StreamBuffer;
0026 class LinkManager;
0027 class IRegistry;
0028 
0029 // Definition of the CLID for this class
0030 static const CLID CLID_DataObject = 1;
0031 
0032 /** @class DataObject DataObject.h GaudiKernel/DataObject.h
0033 
0034     A DataObject is the base class of any identifiable object
0035     on any data store.
0036     The base class supplies the implementation of data streaming.
0037 
0038     @author M.Frank
0039 */
0040 class GAUDI_API DataObject {
0041 private:
0042   /// Reference count
0043   unsigned long m_refCount = 0;
0044   /// Version number
0045   unsigned char m_version = 0;
0046   /// Pointer to the Registry Object
0047   IRegistry* m_pRegistry = nullptr;
0048   /// Store of symbolic links
0049   std::unique_ptr<LinkManager> m_pLinkMgr;
0050 
0051 public:
0052   /// Standard Constructor
0053   DataObject();
0054   /// Copy Constructor
0055   DataObject( const DataObject& rhs );
0056   /// Assignment Operator
0057   DataObject& operator=( const DataObject& rhs );
0058   /// Move Constructor
0059   DataObject( DataObject&& rhs );
0060   /// Move Assignment Operator
0061   DataObject& operator=( DataObject&& rhs );
0062   /// Standard Destructor
0063   virtual ~DataObject();
0064   /// Add reference to object
0065   virtual unsigned long addRef();
0066   /// release reference to object
0067   virtual unsigned long release();
0068   /// Retrieve reference to class definition structure
0069   virtual const CLID& clID() const;
0070   /// Retrieve reference to class definition structure (static access)
0071   static const CLID& classID();
0072   /// Retreive DataObject name. It is the name when registered in the store.
0073   const std::string& name() const;
0074 
0075   /// Provide empty placeholder for internal object reconfiguration callback
0076   virtual StatusCode update();
0077 
0078   /**@name inline code of class DataObject    */
0079   /// Set pointer to Registry
0080   void setRegistry( IRegistry* pRegistry ) { m_pRegistry = pRegistry; }
0081   /// Get pointer to Registry
0082   IRegistry* registry() const { return m_pRegistry; }
0083   /// Retrieve Link manager
0084   LinkManager*       linkMgr() { return m_pLinkMgr.get(); }
0085   const LinkManager* linkMgr() const { return m_pLinkMgr.get(); }
0086   /// Retrieve version number of this object representation
0087   unsigned char version() const { return m_version; }
0088   /// Set version number of this object representation
0089   void setVersion( unsigned char vsn ) { m_version = vsn; }
0090   /// Return the refcount
0091   unsigned long refCount() const { return m_refCount; }
0092   /// Fill the output stream (ASCII)
0093   virtual std::ostream& fillStream( std::ostream& s ) const {
0094     s << "DataObject at " << std::hex << this << std::dec;
0095     return s;
0096   }
0097   /// Output operator (ASCII)
0098   friend std::ostream& operator<<( std::ostream& s, const DataObject& obj ) { return obj.fillStream( s ); }
0099 };
0100 
0101 // Additional functions to support the Serialization of objects in the transient store
0102 
0103 namespace Gaudi {
0104   GAUDI_API void        pushCurrentDataObject( DataObject** pobjAddr );
0105   GAUDI_API void        popCurrentDataObject();
0106   GAUDI_API DataObject* getCurrentDataObject();
0107 } // namespace Gaudi
0108 
0109 #endif // GAUDIKERNEL_DATAOBJECT_H