[rhmessaging-commits] rhmessaging commits: r3044 - in store/trunk/cpp/lib: jrnl and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Jan 15 07:59:11 EST 2009


Author: kpvdr
Date: 2009-01-15 07:59:10 -0500 (Thu, 15 Jan 2009)
New Revision: 3044

Added:
   store/trunk/cpp/lib/jrnl/lp_map.cpp
   store/trunk/cpp/lib/jrnl/lp_map.hpp
Removed:
   store/trunk/cpp/lib/jrnl/lf_map.cpp
   store/trunk/cpp/lib/jrnl/lf_map.hpp
Modified:
   store/trunk/cpp/lib/Makefile.am
   store/trunk/cpp/lib/jrnl/jinf.cpp
Log:
Code tidy-up in preparation for auto-expand

Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am	2009-01-14 22:46:59 UTC (rev 3043)
+++ store/trunk/cpp/lib/Makefile.am	2009-01-15 12:59:10 UTC (rev 3044)
@@ -55,7 +55,7 @@
   jrnl/jexception.cpp           \
   jrnl/jinf.cpp                 \
   jrnl/jrec.cpp                 \
-  jrnl/lf_map.cpp               \
+  jrnl/lp_map.cpp               \
   jrnl/lfmgr.cpp                \
   jrnl/pmgr.cpp                 \
   jrnl/rmgr.cpp                 \
@@ -87,7 +87,7 @@
   jrnl/jexception.hpp           \
   jrnl/jinf.hpp                 \
   jrnl/jrec.hpp                 \
-  jrnl/lf_map.hpp               \
+  jrnl/lp_map.hpp               \
   jrnl/lfmgr.hpp                \
   jrnl/pmgr.hpp                 \
   jrnl/rcvdat.hpp               \

Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp	2009-01-14 22:46:59 UTC (rev 3043)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp	2009-01-15 12:59:10 UTC (rev 3044)
@@ -38,7 +38,7 @@
 #include "jrnl/file_hdr.hpp"
 #include "jrnl/jcntl.hpp"
 #include "jrnl/jerrno.hpp"
-#include "jrnl/lf_map.hpp"
+#include "jrnl/lp_map.hpp"
 #include <sstream>
 
 namespace mrg
@@ -161,8 +161,8 @@
 jinf::analyze()
 {
     bool done = false;
-    lf_map early_map;   // map for all owi flags same as fid 0
-    lf_map late_map;    // map for all owi flags opposite to fid 0
+    lp_map early_map;   // map for all owi flags same as fid 0
+    lp_map late_map;    // map for all owi flags opposite to fid 0
 
    if (!_valid_flag)
        validate();
@@ -208,8 +208,8 @@
     if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
 
     _fidl.clear();
-    late_map.get_fid_list(_fidl);
-    early_map.get_fid_list(_fidl);
+    late_map.get_pfid_list(_fidl);
+    early_map.get_pfid_list(_fidl);
     _analyzed_flag = true;
 }
 

Deleted: store/trunk/cpp/lib/jrnl/lf_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.cpp	2009-01-14 22:46:59 UTC (rev 3043)
+++ store/trunk/cpp/lib/jrnl/lf_map.cpp	2009-01-15 12:59:10 UTC (rev 3044)
@@ -1,80 +0,0 @@
-/**
-* \file lf_map.cpp
-*
-* Red Hat Messaging - Message Journal
-*
-* File containing code for class mrg::journal::lf_map (logical file map). See
-* comments in file lf_map.hpp for details.
-*
-* Copyright (C) 2007, 2008 Red Hat Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
-
-#include "jrnl/lf_map.hpp"
-
-#include "jrnl/jerrno.hpp"
-#include "jrnl/jexception.hpp"
-#include <sstream>
-
-namespace mrg
-{
-namespace journal
-{
-lf_map::lf_map() : _map() {}
-lf_map::~lf_map() {}
-
-void
-lf_map::insert(u_int16_t lid, u_int16_t fid)
-{
-    lfpair ip = lfpair(lid, fid);
-    lfret ret = _map.insert(ip);
-    if (ret.second == false)
-    {
-        std::ostringstream oss;
-        oss << std::hex << "lid=0x" << lid << " fid=0x" << fid;
-        throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "lf_map", "insert");
-    }
-}
-
-void
-lf_map::get_fid_list(std::vector<u_int16_t>& fid_list)
-{
-    for (lfmap_citr i = _map.begin(); i != _map.end(); i++)
-        fid_list.push_back(i->second);
-}
-
-// debug aid
-std::string
-lf_map::to_string()
-{
-    std::ostringstream oss;
-    oss << "{lid:fid ";
-    for (lfmap_citr i=_map.begin(); i!=_map.end(); i++)
-    {
-        if (i != _map.begin()) oss << ", ";
-        oss << (*i).first << ":" << (*i).second;
-    }
-    oss << "}";
-    return oss.str();
-}
-
-} // namespace journal
-} // namespace mrg

Deleted: store/trunk/cpp/lib/jrnl/lf_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.hpp	2009-01-14 22:46:59 UTC (rev 3043)
+++ store/trunk/cpp/lib/jrnl/lf_map.hpp	2009-01-15 12:59:10 UTC (rev 3044)
@@ -1,83 +0,0 @@
-/**
-* \file lf_map.hpp
-*
-* Red Hat Messaging - Message Journal
-*
-* File containing code for class mrg::journal::lf_map (logical file map).
-* See class documentation for details.
-*
-* \author Kim van der Riet
-*
-* Copyright (C) 2007 Red Hat Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
-
-#ifndef mrg_journal_lf_map_hpp
-#define mrg_journal_lf_map_hpp
-
-#include <map>
-#include <string>
-#include <sys/types.h>
-#include <vector>
-
-namespace mrg
-{
-namespace journal
-{
-    /**
-    * \class lf_map
-    * \brief Maps the logical file id (lid) to the physical file id (fid)
-    *        in the journal. NOTE: NOT THREAD SAFE - use only in
-    *        single-threaded environments.
-    */
-    class lf_map
-    {
-    public:
-        typedef std::map<u_int16_t, u_int16_t> lfmap;
-        typedef lfmap::const_iterator lfmap_citr;
-        typedef lfmap::const_reverse_iterator lfmap_critr;
-
-    private:
-        typedef std::pair<u_int16_t, u_int16_t> lfpair;
-        typedef std::pair<lfmap::iterator, bool> lfret;
-        lfmap _map;
-
-    public:
-        lf_map();
-        virtual ~lf_map();
-
-        void insert(u_int16_t lid, u_int16_t fid);
-        inline u_int16_t size() const { return u_int16_t(_map.size()); }
-        inline bool empty() const { return _map.empty(); }
-        inline lfmap_citr begin() { return _map.begin(); }
-        inline lfmap_citr end() { return _map.end(); }
-        inline lfmap_critr rbegin() { return _map.rbegin(); }
-        inline lfmap_critr rend() { return _map.rend(); }
-        void get_fid_list(std::vector<u_int16_t>& fid_list);
-
-        // debug aid
-        std::string to_string();
-    };
-
-} // namespace journal
-} // namespace mrg
-
-#endif // ifndef mrg_journal_lf_map_hpp

Copied: store/trunk/cpp/lib/jrnl/lp_map.cpp (from rev 3041, store/trunk/cpp/lib/jrnl/lf_map.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl/lp_map.cpp	                        (rev 0)
+++ store/trunk/cpp/lib/jrnl/lp_map.cpp	2009-01-15 12:59:10 UTC (rev 3044)
@@ -0,0 +1,80 @@
+/**
+* \file lp_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lp_map (logical file map). See
+* comments in file lp_map.hpp for details.
+*
+* Copyright (C) 2008, 2009 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#include "jrnl/lp_map.hpp"
+
+#include "jrnl/jerrno.hpp"
+#include "jrnl/jexception.hpp"
+#include <sstream>
+
+namespace mrg
+{
+namespace journal
+{
+lp_map::lp_map() : _map() {}
+lp_map::~lp_map() {}
+
+void
+lp_map::insert(u_int16_t lfid, u_int16_t pfid)
+{
+    lfpair ip = lfpair(lfid, pfid);
+    lfret ret = _map.insert(ip);
+    if (ret.second == false)
+    {
+        std::ostringstream oss;
+        oss << std::hex << "lfid=0x" << lfid << " pfid=0x" << pfid;
+        throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "lp_map", "insert");
+    }
+}
+
+void
+lp_map::get_pfid_list(std::vector<u_int16_t>& pfid_list)
+{
+    for (lp_map_citr_t i = _map.begin(); i != _map.end(); i++)
+        pfid_list.push_back(i->second);
+}
+
+// debug aid
+std::string
+lp_map::to_string()
+{
+    std::ostringstream oss;
+    oss << "{lfid:pfid ";
+    for (lp_map_citr_t i=_map.begin(); i!=_map.end(); i++)
+    {
+        if (i != _map.begin()) oss << ", ";
+        oss << (*i).first << ":" << (*i).second;
+    }
+    oss << "}";
+    return oss.str();
+}
+
+} // namespace journal
+} // namespace mrg


Property changes on: store/trunk/cpp/lib/jrnl/lp_map.cpp
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: store/trunk/cpp/lib/jrnl/lp_map.hpp (from rev 3041, store/trunk/cpp/lib/jrnl/lf_map.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl/lp_map.hpp	                        (rev 0)
+++ store/trunk/cpp/lib/jrnl/lp_map.hpp	2009-01-15 12:59:10 UTC (rev 3044)
@@ -0,0 +1,83 @@
+/**
+* \file lp_map.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lp_map (logical file map).
+* See class documentation for details.
+*
+* \author Kim van der Riet
+*
+* Copyright (C) 2008, 2009 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#ifndef mrg_journal_lp_map_hpp
+#define mrg_journal_lp_map_hpp
+
+#include <map>
+#include <string>
+#include <sys/types.h>
+#include <vector>
+
+namespace mrg
+{
+namespace journal
+{
+    /**
+    * \class lp_map
+    * \brief Maps the logical file id (lfid) to the physical file id (pfid) in the journal.
+    *
+    * NOTE: NOT THREAD SAFE
+    */
+    class lp_map
+    {
+    public:
+        typedef std::map<u_int16_t, u_int16_t> lp_map_t;
+        typedef lp_map_t::const_iterator lp_map_citr_t;
+        typedef lp_map_t::const_reverse_iterator lp_map_critr_t;
+
+    private:
+        typedef std::pair<u_int16_t, u_int16_t> lfpair;
+        typedef std::pair<lp_map_t::iterator, bool> lfret;
+        lp_map_t _map;
+
+    public:
+        lp_map();
+        virtual ~lp_map();
+
+        void insert(u_int16_t lfid, u_int16_t pfid);
+        inline u_int16_t size() const { return u_int16_t(_map.size()); }
+        inline bool empty() const { return _map.empty(); }
+        inline lp_map_citr_t begin() { return _map.begin(); }
+        inline lp_map_citr_t end() { return _map.end(); }
+        inline lp_map_critr_t rbegin() { return _map.rbegin(); }
+        inline lp_map_critr_t rend() { return _map.rend(); }
+        void get_pfid_list(std::vector<u_int16_t>& pfid_list);
+
+        // debug aid
+        std::string to_string();
+    };
+
+} // namespace journal
+} // namespace mrg
+
+#endif // ifndef mrg_journal_lp_map_hpp


Property changes on: store/trunk/cpp/lib/jrnl/lp_map.hpp
___________________________________________________________________
Name: svn:mergeinfo
   + 




More information about the rhmessaging-commits mailing list