Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-15 08:55:21

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2024 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 #pragma once
0012 
0013 #include <GaudiKernel/ClassID.h>
0014 #include <GaudiKernel/StatusCode.h>
0015 #include <memory>
0016 #include <ostream>
0017 #include <string>
0018 
0019 // Forward declarations
0020 class IOpaqueAddress;
0021 class StreamBuffer;
0022 class LinkManager;
0023 class IRegistry;
0024 
0025 // Definition of the CLID for this class
0026 static const CLID CLID_DataObject = 1;
0027 
0028 /** @class DataObject DataObject.h GaudiKernel/DataObject.h
0029 
0030     A DataObject is the base class of any identifiable object
0031     on any data store.
0032     The base class supplies the implementation of data streaming.
0033 
0034     @author M.Frank
0035 */
0036 class GAUDI_API DataObject {
0037 private:
0038   /// Reference count
0039   unsigned long m_refCount = 0;
0040   /// Version number
0041   unsigned char m_version = 0;
0042   /// Pointer to the Registry Object
0043   IRegistry* m_pRegistry = nullptr;
0044   /// Store of symbolic links
0045   std::unique_ptr<LinkManager> m_pLinkMgr;
0046 
0047 public:
0048   /// Standard Constructor
0049   DataObject();
0050   /// Copy Constructor
0051   DataObject( const DataObject& rhs );
0052   /// Assignment Operator
0053   DataObject& operator=( const DataObject& rhs );
0054   /// Move Constructor
0055   DataObject( DataObject&& rhs );
0056   /// Move Assignment Operator
0057   DataObject& operator=( DataObject&& rhs );
0058   /// Standard Destructor
0059   virtual ~DataObject();
0060   /// Add reference to object
0061   virtual unsigned long addRef();
0062   /// release reference to object
0063   virtual unsigned long release();
0064   /// Retrieve reference to class definition structure
0065   virtual const CLID& clID() const;
0066   /// Retrieve reference to class definition structure (static access)
0067   static const CLID& classID();
0068   /// Retreive DataObject name. It is the name when registered in the store.
0069   const std::string& name() const;
0070 
0071   /// Provide empty placeholder for internal object reconfiguration callback
0072   virtual StatusCode update();
0073 
0074   /**@name inline code of class DataObject    */
0075   /// Set pointer to Registry
0076   void setRegistry( IRegistry* pRegistry ) { m_pRegistry = pRegistry; }
0077   /// Get pointer to Registry
0078   IRegistry* registry() const { return m_pRegistry; }
0079   /// Retrieve Link manager
0080   LinkManager*       linkMgr() { return m_pLinkMgr.get(); }
0081   const LinkManager* linkMgr() const { return m_pLinkMgr.get(); }
0082   /// Retrieve version number of this object representation
0083   unsigned char version() const { return m_version; }
0084   /// Set version number of this object representation
0085   void setVersion( unsigned char vsn ) { m_version = vsn; }
0086   /// Return the refcount
0087   unsigned long refCount() const { return m_refCount; }
0088   /// Fill the output stream (ASCII)
0089   virtual std::ostream& fillStream( std::ostream& s ) const;
0090   /// Output operator (ASCII)
0091   friend std::ostream& operator<<( std::ostream& s, const DataObject& obj ) { return obj.fillStream( s ); }
0092 };
0093 
0094 // Additional functions to support the Serialization of objects in the transient store
0095 
0096 namespace Gaudi {
0097   GAUDI_API void        pushCurrentDataObject( DataObject** pobjAddr );
0098   GAUDI_API void        popCurrentDataObject();
0099   GAUDI_API DataObject* getCurrentDataObject();
0100 } // namespace Gaudi