mana-core-navigation / Navigation / AthenaBarCodeImpl.h

///////////////////////// -*- C++ -*- /////////////////////////////

///              AthenaBarCodeImpl interface class
/// \author  Yushu Yao
/// \brief barcode for all INav4Mom classes
//                                                                           //

// STL includes

#include <inttypes.h>

#include <iosfwd>

#include <AthenaKernel/IAthenaBarCode.h> //for static const data memebers
// Universal Object Identifier for all INav4Mom Objects

class StatusCode;

class AthenaBarCodeImpl {
  friend class AthenaBarCodeCnv_p1;
  static const unsigned short TotalBits   = 64;
  static const unsigned short UUIDBits    = 32;
  static const unsigned short CounterBits = 26;
  static const unsigned short VersionBits = 4;
  static const unsigned short ReserveBits = 2;
  static const unsigned short SUUIDBits    = 0;
  static const unsigned short SCounterBits = UUIDBits;
  static const unsigned short SVersionBits = UUIDBits+CounterBits;
  static const unsigned short SReserveBits = UUIDBits+CounterBits+VersionBits;
  virtual ~AthenaBarCodeImpl() {
  //Public setter and getters
  AthenaBarCode_t getAthenaBarCode() const;
  void setAthenaBarCode(AthenaBarCode_t id);
  //Comparing & Versioning Control
  bool hasSameAthenaBarCode(const IAthenaBarCode &obj) const;
  bool hasSameAthenaBarCodeExceptVersion(const IAthenaBarCode &obj) const;
  AthenaBarCodeVersion_t getVersion() const;
  void newVersion();
  void setVersion(AthenaBarCodeVersion_t newversion);
  std::ostream& dump(std::ostream& out) const;
  //True if the athenabarcode is created in this job, meaning a newly created object. False if the object is read from a file.
  bool createdInCurrentJob() const;
  //Handle reserved bits, mainly for read back of older version of AthenaBarCode when the configuration of #bits for UUID,counter and version bits are different from the current one.
  AthenaBarCode_t getReserveBits() const;
  void setReserveBits(AthenaBarCode_t id);

  // Used to set the default hash when JobIDSvc is not being used.
  // Should not be called within Athena.
  static void setDefaultHash (const char* jobid);
  void setBits(unsigned short startbit,unsigned short nbits,AthenaBarCode_t id) const; 
  AthenaBarCode_t getBits(unsigned short startbit,unsigned short nbits) const ;
  void initABC() const ;

  //UUID related
  AthenaBarCode_t combineWithUUIDHash(const AthenaBarCode_t &) const;
  static AthenaBarCode_t hashUUID(const char *);
  void setUUIDHash(AthenaBarCode_t uuidhash) const;
  AthenaBarCode_t hasUUIDHash() const;
  AthenaBarCode_t getUUIDHash() const;
  //data fields
  static AthenaBarCode_t m_defaultHash;
  static AthenaBarCode_t m_barcodeCounter;
  mutable AthenaBarCode_t m_barcode;

inline void AthenaBarCodeImpl::setUUIDHash(AthenaBarCode_t uuidhash) const {
  m_barcode = combineWithUUIDHash(uuidhash);

inline AthenaBarCode_t AthenaBarCodeImpl::combineWithUUIDHash(
							      const AthenaBarCode_t &hash) const {
  AthenaBarCode_t tmp = 0;
  AthenaBarCode_t lowerh = ~tmp >> (TotalBits
				    - UUIDBits);
  AthenaBarCode_t higherh = ~tmp << (UUIDBits);
  AthenaBarCode_t lower = m_barcode & lowerh;
  AthenaBarCode_t higher = hash & higherh;
    std::cout << "AthenaBarCodeImpl::combineWithHash::hash=" << std::hex
    << hash << " lower=" << lower << " higher=" << higher << " lowerh="
    << lowerh << " higherh=" << higherh << " barcode=" << (lower
    | higher) << std::endl;
  return lower | higher;

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
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.