[rhmessaging-commits] rhmessaging commits: r4453 - store/trunk/cpp/lib/jrnl2.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Apr 28 09:20:17 EDT 2011


Author: kpvdr
Date: 2011-04-28 09:20:17 -0400 (Thu, 28 Apr 2011)
New Revision: 4453

Modified:
   store/trunk/cpp/lib/jrnl2/JournalErrors.hpp
   store/trunk/cpp/lib/jrnl2/RecordHeader.hpp
   store/trunk/cpp/lib/jrnl2/ScopedLock.hpp
Log:
Whitespace/format changes in jrnl2 dir

Modified: store/trunk/cpp/lib/jrnl2/JournalErrors.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalErrors.hpp	2011-04-25 12:48:04 UTC (rev 4452)
+++ store/trunk/cpp/lib/jrnl2/JournalErrors.hpp	2011-04-28 13:20:17 UTC (rev 4453)
@@ -42,7 +42,7 @@
 
     class JournalErrors
     {
-        static std::map<uint32_t, const char*> _s_errorMap; ///< Map of error messages
+        static std::map<uint32_t, const char*> _s_errorMap;     ///< Map of error messages
         static std::map<uint32_t, const char*>::iterator _s_errorMapIterator; ///< Iterator
         static bool _s_initializedFlag;                         ///< Dummy flag, used to initialize map.
         static bool _s_initialize();                            ///< Static fn for initializing static data

Modified: store/trunk/cpp/lib/jrnl2/RecordHeader.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/RecordHeader.hpp	2011-04-25 12:48:04 UTC (rev 4452)
+++ store/trunk/cpp/lib/jrnl2/RecordHeader.hpp	2011-04-28 13:20:17 UTC (rev 4453)
@@ -156,14 +156,12 @@
         /**
          * \brief Destructor.
          */
-        virtual inline ~RecordHeader()
-        {}
+        virtual inline ~RecordHeader() {}
 
         /**
          * \brief Convenience copy method.
          */
-        virtual inline void copy(const RecordHeader& rh)
-        {
+        virtual inline void copy(const RecordHeader& rh) {
             _magic = rh._magic;
             _version = rh._version;
             _bigEndianFlag = rh._bigEndianFlag;
@@ -174,8 +172,7 @@
         /**
          * \brief Resets all fields to default values (mostly 0).
          */
-        virtual inline void reset()
-        {
+        virtual inline void reset() {
             _magic = 0;
             _version = 0;
             _bigEndianFlag = 0;
@@ -188,9 +185,7 @@
          *
          * \return true if the Overwrite Indicator flag is set, false otherwise.
          */
-        inline bool getOverwriteIndicator() const {
-            return _flags & HDR_OVERWRITE_INDICATOR_MASK;
-        }
+        inline bool getOverwriteIndicator() const { return _flags & HDR_OVERWRITE_INDICATOR_MASK; }
 
         /**
          * \brief Set the value of the Overwrite Indicator for this record
@@ -207,9 +202,7 @@
          *
          * \return Size of record header in bytes.
          */
-        static inline std::size_t getHeaderSize() {
-            return sizeof(RecordHeader);
-        }
+        static inline std::size_t getHeaderSize() { return sizeof(RecordHeader); }
 
         /**
          * \brief Return the body (data) size of this record in bytes. Must be implemented
@@ -337,8 +330,7 @@
         /**
          * \brief Destructor.
          */
-        virtual inline ~RecordTail()
-        {}
+        virtual inline ~RecordTail() {}
 
         /**
          * \brief Convenience copy method.
@@ -363,9 +355,7 @@
         /**
         * \brief Returns the size of the header in bytes.
         */
-        inline static std::size_t getSize() {
-            return sizeof(RecordTail);
-        }
+        inline static std::size_t getSize() { return sizeof(RecordTail); }
     }; // struct RecordTail
 
 
@@ -529,8 +519,7 @@
         /**
          * \brief Destructor.
          */
-        virtual ~FileHeader()
-        {}
+        virtual ~FileHeader() {}
 
         /**
          * \brief Convenience copy method.
@@ -573,36 +562,28 @@
          *
          * \return Size of record header in bytes.
          */
-        static inline std::size_t getHeaderSize() {
-            return sizeof(FileHeader);
-        }
+        static inline std::size_t getHeaderSize() { return sizeof(FileHeader); }
 
         /**
          * \brief Return the body (data) size of this record in bytes.
          *
          * \return Size of record body in bytes. By definition, a FileHeader has no body.
          */
-        inline std::size_t getBodySize() const {
-            return 0;
-        }
+        inline std::size_t getBodySize() const { return 0; }
 
         /**
          * \brief Return total size of this record in bytes, being in the case of the
          * FileHeader the size of the header itself only.
          */
-        inline std::size_t getRecordSize() const {
-            return getHeaderSize();
-        }
+        inline std::size_t getRecordSize() const { return getHeaderSize(); }
 
         /**
          * \brief Gets the current time from the system clock and sets the timestamp in the struct.
          */
-        inline void setTimestamp()
-        {
+        inline void setTimestamp() {
             // TODO: Standardize on method for getting time that does not require a context switch.
             timespec ts;
-            if (::clock_gettime(CLOCK_REALTIME, &ts))
-            {
+            if (::clock_gettime(CLOCK_REALTIME, &ts)) {
                 std::ostringstream oss;
                 oss << FORMAT_SYSERR(errno);
                 throw JournalException(JournalErrors::JERR_RTCLOCK, oss.str(), "FileHeader", "setTimestamp");
@@ -615,8 +596,7 @@
          *
          * \param ts Timestamp from which the file header time stamp is to be copied
          */
-        inline void setTimestamp(const timespec& ts)
-        {
+        inline void setTimestamp(const timespec& ts) {
             _timestampSeconds = ts.tv_sec;
             _timestampNanoSeconds = ts.tv_nsec;
         }
@@ -795,18 +775,14 @@
          *
          * \return Size of record header in bytes.
          */
-        static inline std::size_t getHeaderSize() {
-            return sizeof(EventHeader);
-        }
+        static inline std::size_t getHeaderSize() { return sizeof(EventHeader); }
 
         /**
          * \brief Return the body (data) size of this record in bytes.
          *
          * \return Size of record body in bytes.
          */
-        virtual inline std::size_t getBodySize() const {
-            return _xidSize + _dataSize;
-        }
+        virtual inline std::size_t getBodySize() const { return _xidSize + _dataSize; }
 
         /**
          * \brief Return total size of this record in bytes, being in the case of the
@@ -917,9 +893,7 @@
          *
          * \return true if the Transient flag for this record is set, false otherwise.
          */
-        inline bool getTransientFlag() const {
-            return _flags & ENQ_HDR_TRANSIENT_MASK;
-        }
+        inline bool getTransientFlag() const { return _flags & ENQ_HDR_TRANSIENT_MASK; }
 
         /**
          * \brief Set the value of the Transient flag for this record.
@@ -938,9 +912,7 @@
          *
          * \return true if the Transient flag for this record is set, false otherwise.
          */
-        inline bool getExternalFlag() const {
-            return _flags & ENQ_HDR_EXTERNAL_MASK;
-        }
+        inline bool getExternalFlag() const { return _flags & ENQ_HDR_EXTERNAL_MASK; }
 
         /**
          * \brief Set the value of the External flag for this record.
@@ -958,9 +930,7 @@
          *
          * \return Size of record header in bytes.
          */
-        static inline std::size_t getHeaderSize() {
-            return sizeof(EnqueueHeader);
-        }
+        static inline std::size_t getHeaderSize() { return sizeof(EnqueueHeader); }
     }; // struct EnqueueHeader
 
 
@@ -1120,9 +1090,7 @@
          * \return true if the tplCommitOnTxnComplFlag flag for this record is set, false
          * otherwise.
          */
-        inline bool getTplCommitOnTxnComplFlag() const {
-            return _flags & DEQ_HDR_TPL_COMMIT_ON_TXN_COMPL_MASK;
-        }
+        inline bool getTplCommitOnTxnComplFlag() const { return _flags & DEQ_HDR_TPL_COMMIT_ON_TXN_COMPL_MASK; }
 
         /**
          * \brief Set the value of the tplCommitOnTxnComplFlag for this record. This is
@@ -1142,18 +1110,14 @@
          *
          * \return Size of record header in bytes.
          */
-        static std::size_t getHeaderSize() {
-            return sizeof(DequeueHeader);
-        }
+        static std::size_t getHeaderSize() { return sizeof(DequeueHeader); }
 
         /**
          * \brief Return the body (xid and data) size of this record in bytes.
          *
          * \return Size of record body in bytes.
          */
-        std::size_t getBodySize() const {
-            return _xidSize;
-        }
+        std::size_t getBodySize() const { return _xidSize; }
 
         /**
          * \brief Return total size of this record in bytes, being in the case of the
@@ -1274,8 +1238,7 @@
         /**
          * \brief Destructor.
          */
-        virtual ~TransactionHeader()
-        {}
+        virtual ~TransactionHeader() {}
 
         /**
          * \brief Convenience copy method.

Modified: store/trunk/cpp/lib/jrnl2/ScopedLock.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/ScopedLock.hpp	2011-04-25 12:48:04 UTC (rev 4452)
+++ store/trunk/cpp/lib/jrnl2/ScopedLock.hpp	2011-04-28 13:20:17 UTC (rev 4453)
@@ -7,7 +7,7 @@
  *
  * \author Kim van der Riet
  *
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010, 2011 Red Hat, Inc.
  *
  * This file is part of the Qpid async store library msgstore.so.
  *
@@ -46,7 +46,7 @@
     class ScopedMutex
     {
     protected:
-        mutable pthread_mutex_t _m;
+        mutable ::pthread_mutex_t _m;
     public:
         inline ScopedMutex() {
             PTHREAD_CHK(::pthread_mutex_init(&_m, 0), "::pthread_mutex_init", "ScopedMutex", "ScopedMutex");
@@ -54,7 +54,7 @@
         inline ~ScopedMutex() {
             PTHREAD_CHK(::pthread_mutex_destroy(&_m), "::pthread_mutex_destroy", "ScopedMutex", "~ScopedMutex");
         }
-        inline pthread_mutex_t* get() const { return &_m; }
+        inline ::pthread_mutex_t* get() const { return &_m; }
     };
 
     // Scoped-mutex (sm) container, superclass for scoped lock classes
@@ -65,7 +65,7 @@
     public:
         ScopedMutexContainer(const ScopedMutex& sm) : _sm(sm) {}
         virtual ~ScopedMutexContainer() {}
-        inline pthread_mutex_t* get() const { return _sm.get(); }
+        inline ::pthread_mutex_t* get() const { return _sm.get(); }
     };
 
     // Ultra-simple scoped lock class, auto-releases mutex when it goes out-of-scope
@@ -89,11 +89,13 @@
         inline ScopedTryLock(const ScopedMutex& sm) : ScopedMutexContainer(sm), _lockedFlag(false) {
             int ret = ::pthread_mutex_trylock(_sm.get());
             _lockedFlag = (ret == 0); // check if lock obtained
-            if (!_lockedFlag && ret != EBUSY) PTHREAD_CHK(ret, "::pthread_mutex_trylock", "ScopedTryLock", "ScopedTryLock");
+            if (!_lockedFlag && ret != EBUSY)
+                PTHREAD_CHK(ret, "::pthread_mutex_trylock", "ScopedTryLock", "ScopedTryLock");
         }
         virtual inline ~ScopedTryLock() {
             if (_lockedFlag)
-                PTHREAD_CHK(::pthread_mutex_unlock(_sm.get()), "::pthread_mutex_unlock", "ScopedTryLock", "~ScopedTryLock");
+                PTHREAD_CHK(::pthread_mutex_unlock(_sm.get()), "::pthread_mutex_unlock", "ScopedTryLock",
+                                "~ScopedTryLock");
         }
         inline bool isLocked() const { return _lockedFlag; }
     };
@@ -102,13 +104,15 @@
     class ScopedConditionVariable
     {
     protected:
-        mutable pthread_cond_t _cv;
+        mutable ::pthread_cond_t _cv;
     public:
         inline ScopedConditionVariable() {
-            PTHREAD_CHK(::pthread_cond_init(&_cv, 0), "pthread_cond_init", "ScopedConditionVariable", "ScopedConditionVariable");
+            PTHREAD_CHK(::pthread_cond_init(&_cv, 0), "pthread_cond_init", "ScopedConditionVariable",
+                            "ScopedConditionVariable");
         }
         inline ~ScopedConditionVariable() {
-            PTHREAD_CHK(::pthread_cond_destroy(&_cv), "pthread_cond_destroy", "ScopedConditionVariable", "~ScopedConditionVariable");
+            PTHREAD_CHK(::pthread_cond_destroy(&_cv), "pthread_cond_destroy", "ScopedConditionVariable",
+                            "~ScopedConditionVariable");
         }
         inline void wait(ScopedLock& sl) {
             PTHREAD_CHK(::pthread_cond_wait(&_cv, sl.get()), "pthread_cond_wait", "ScopedConditionVariable", "wait");
@@ -117,7 +121,8 @@
             PTHREAD_CHK(::pthread_cond_signal(&_cv), "pthread_cond_signal", "ScopedConditionVariable", "notify_one");
         }
         inline void notify_all() {
-            PTHREAD_CHK(::pthread_cond_broadcast(&_cv), "pthread_cond_broadcast", "ScopedConditionVariable", "notify_all");
+            PTHREAD_CHK(::pthread_cond_broadcast(&_cv), "pthread_cond_broadcast", "ScopedConditionVariable",
+                            "notify_all");
         }
     };
 



More information about the rhmessaging-commits mailing list