certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi/libHLA Semaphore.hh SHMWin32.hh Semaphore...


From: certi-cvs
Subject: [certi-cvs] certi/libHLA Semaphore.hh SHMWin32.hh Semaphore...
Date: Sun, 28 Mar 2010 12:24:00 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/03/28 12:24:00

Modified files:
        libHLA         : Semaphore.hh SHMWin32.hh SemaphoreWin32.hh 
                         SHMWin32.cc SHM.hh CMakeLists.txt libhla.hh 

Log message:
        Remove reference to certi::Exception 
        move new exception in concerned libhla::ipc classes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/Semaphore.hh?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/SHMWin32.hh?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/SemaphoreWin32.hh?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/SHMWin32.cc?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/SHM.hh?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/CMakeLists.txt?cvsroot=certi&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/libhla.hh?cvsroot=certi&r1=1.3&r2=1.4

Patches:
Index: Semaphore.hh
===================================================================
RCS file: /sources/certi/certi/libHLA/Semaphore.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Semaphore.hh        28 Mar 2010 11:42:34 -0000      1.1
+++ Semaphore.hh        28 Mar 2010 12:24:00 -0000      1.2
@@ -10,9 +10,7 @@
 
 class HLA_EXPORT Semaphore {
 
-protected:
-
-    public :
+public :
     // Semaphore() ;
     virtual ~Semaphore() {};
     virtual void Create_Init(const int initval, const std::string& 
New_Semname) = 0 ;
@@ -21,6 +19,10 @@
     virtual void V() = 0 ;
     virtual void Delete() = 0 ;
 
+       LIBHLA_EXCEPTION(SemaphoreNotCreated)
+       LIBHLA_EXCEPTION(SemaphoreNotOpen)
+       LIBHLA_EXCEPTION(SemaphoreHandlingError)
+       LIBHLA_EXCEPTION(HandleNotClosed)
 
        /**
         * Build a proper Semaphore name from a user provided name.
@@ -30,7 +32,7 @@
        static std::string buildSemName(const std::string& SemName) {
                return "/"+SemName+"_sem";
        }
-
+protected:
 } ;
 } /* end namespace ipc  */
 } /* end namespace libhla */

Index: SHMWin32.hh
===================================================================
RCS file: /sources/certi/certi/libHLA/SHMWin32.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SHMWin32.hh 28 Mar 2010 11:42:34 -0000      1.1
+++ SHMWin32.hh 28 Mar 2010 12:24:00 -0000      1.2
@@ -18,10 +18,10 @@
     SHMWin32(const std::string& SHMName, const int SHMSize) ;
     ~SHMWin32() ;
 
-    void Open() throw(certi::SharedMemoryNotOpen) ;
-    void Attach() throw(certi::SharedMemoryNotAttached) ;
-    void Close() throw(certi::SharedMemoryNotClosed,
-                       certi::HandleNotClosed);
+    void Open() throw(SharedMemoryNotOpen) ;
+    void Attach() throw(SharedMemoryNotAttached) ;
+    void Close() throw(SharedMemoryNotClosed,
+                       HandleNotClosed);
 
 } ;
 } /* end namespace ipc  */

Index: SemaphoreWin32.hh
===================================================================
RCS file: /sources/certi/certi/libHLA/SemaphoreWin32.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SemaphoreWin32.hh   28 Mar 2010 11:42:34 -0000      1.1
+++ SemaphoreWin32.hh   28 Mar 2010 12:24:00 -0000      1.2
@@ -13,7 +13,6 @@
 #include <iostream>
 
 // Specifics includes
-#include "certi.hh"
 #include "Semaphore.hh"
 
 namespace libhla {
@@ -27,15 +26,15 @@
     SemaphoreWin32() ;
     virtual ~SemaphoreWin32() ;
     void Create_Init(const int initval, const std::string& New_Semname)
-                     throw(certi::SemaphoreNotCreated) ;
+                     throw(SemaphoreNotCreated) ;
     void Attach(const std::string& New_Semname )
-                throw(certi::SemaphoreNotOpen) ;
+                throw(SemaphoreNotOpen) ;
     void P()
-         throw(certi::SemaphoreHandlingError) ;
+         throw(SemaphoreHandlingError) ;
     void V()
-         throw(certi::SemaphoreHandlingError) ;
+         throw(SemaphoreHandlingError) ;
     void Delete()
-         throw(certi::HandleNotClosed) ;
+         throw(HandleNotClosed) ;
 
 } ;
 } /* end namespace ipc  */

Index: SHMWin32.cc
===================================================================
RCS file: /sources/certi/certi/libHLA/SHMWin32.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SHMWin32.cc 28 Mar 2010 11:42:34 -0000      1.1
+++ SHMWin32.cc 28 Mar 2010 12:24:00 -0000      1.2
@@ -34,7 +34,7 @@
 // ************************************************
 // Method : SHMWin32::Open()
 // ************************************************
-void SHMWin32::Open() throw(certi::SharedMemoryNotOpen) {
+void SHMWin32::Open() throw(SharedMemoryNotOpen) {
 
 int ret ;
 
@@ -47,7 +47,7 @@
                       (LPCTSTR)(_Name.c_str()));           // name of mapping 
object
 
     if (_hMapFile == NULL) {
-        throw(certi::SharedMemoryNotOpen("CreateFileMapping() failed.")) ;
+        throw(SharedMemoryNotOpen("CreateFileMapping() failed.")) ;
         }
 
 #ifdef DEBUG
@@ -59,7 +59,7 @@
 // ************************************************
 // Method : SHMWin32::Attach()
 // ************************************************
-void SHMWin32::Attach() throw(certi::SharedMemoryNotAttached) {
+void SHMWin32::Attach() throw(SharedMemoryNotAttached) {
 
 BOOL WINAPI retcode ;
 
@@ -72,7 +72,7 @@
     if (_pBuf == NULL) {
         retcode=UnmapViewOfFile((PVOID)_pBuf);
         CloseHandle(_hMapFile);
-        throw(certi::SharedMemoryNotAttached("MapViewOfFile() failed.")) ;
+        throw(SharedMemoryNotAttached("MapViewOfFile() failed.")) ;
     }
 
     _Shm = (void *) _pBuf ;
@@ -82,8 +82,8 @@
 // ************************************************
 // Method : SHMWin32::Close()
 // ************************************************
-void SHMWin32::Close() throw(certi::SharedMemoryNotClosed,
-                             certi::HandleNotClosed) {
+void SHMWin32::Close() throw(SharedMemoryNotClosed,
+                             HandleNotClosed) {
 
 BOOL WINAPI retcode ;
 
@@ -91,7 +91,7 @@
    retcode=UnmapViewOfFile((PVOID)_pBuf);
 
 if (retcode == 0) {
-    throw(certi::SharedMemoryNotClosed("UnMapViewOfFile() failed.")) ;
+    throw(SharedMemoryNotClosed("UnMapViewOfFile() failed.")) ;
     }
 
 #ifdef DEBUG
@@ -102,7 +102,7 @@
    retcode = CloseHandle(_hMapFile);
 
 if(retcode == 0){
-   throw(certi::HandleNotClosed("CloseHandle() failed.")) ;
+   throw(HandleNotClosed("CloseHandle() failed.")) ;
    } // End of if
 
 } // End of Close()

Index: SHM.hh
===================================================================
RCS file: /sources/certi/certi/libHLA/SHM.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SHM.hh      28 Mar 2010 11:42:34 -0000      1.1
+++ SHM.hh      28 Mar 2010 12:24:00 -0000      1.2
@@ -15,23 +15,20 @@
  * has a size and a creator process.
  */
 class HLA_EXPORT SHM {
-protected :
-       std::string _Name ;
-       int  _Size ;
-       bool _IsCreator ;
-       void *_Shm ;
 
 public :
        /**
         * Constructor.
-        * @param[in] SHNName, the name of the shared memory segment.
+        * @param[in] SHMName, the name of the shared memory segment.
         *            this should be unique on a specified host.
         * @param[in] SHMSize, the requested size of the SHM
+        * @param[in] creator, true if we are trying to create the SHM, false
+        *            if we want to attach to the SHM.
         */
-       SHM(const std::string& SHMName, const int SHMSize, const bool True)
+       SHM(const std::string& SHMName, const int SHMSize, const bool creator)
                {_Name=SHMName;
                 _Size=SHMSize;
-                _IsCreator=True;
+       _IsCreator=creator;
                 }
        SHM(const std::string& SHMName, const int SHMSize)
                {_Name=SHMName;
@@ -39,6 +36,12 @@
                 _IsCreator=false;
                 }
        virtual ~SHM() {};
+
+       LIBHLA_EXCEPTION(SharedMemoryNotOpen)
+       LIBHLA_EXCEPTION(SharedMemoryNotAttached)
+       LIBHLA_EXCEPTION(SharedMemoryNotClosed)
+       LIBHLA_EXCEPTION(HandleNotClosed)
+
        const std::string getName() const {return _Name ; } ;
        inline void* GetShm(){return _Shm ; } ;
        inline bool IsCreator(){return _IsCreator ; } ;
@@ -55,6 +58,11 @@
        static std::string buildShmName(const std::string& ShmName) {
          return "/"+ShmName+"_shm";
        }
+protected :
+       std::string _Name ;
+       int  _Size ;
+       bool _IsCreator ;
+       void *_Shm ;
 } ;
 } /* end namespace ipc  */
 } /* end namespace libhla */

Index: CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libHLA/CMakeLists.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- CMakeLists.txt      28 Mar 2010 11:42:34 -0000      1.7
+++ CMakeLists.txt      28 Mar 2010 12:24:00 -0000      1.8
@@ -3,8 +3,6 @@
 SET(LIBHLA_TYPES1516_SRCS
     HLAbuffer.hh HLAbuffer.cc
 )
-SOURCE_GROUP("Source Files\\Types1516" FILES ${LIBHLA_TYPES1516_SRCS})
-
 LIST(APPEND LIBHLA_EXPORTED_INCLUDES 
     HLAtypesIEEE1516.hh
     HLAbuffer.hh
@@ -14,12 +12,12 @@
     HLAvariableArray.hh
     HLAfixedRecord.hh
     HLAvariantRecord.hh)
+SOURCE_GROUP("Source Files\\Types1516" FILES ${LIBHLA_TYPES1516_SRCS})
 
 enable_language(C)
 SET(LIBHLA_HASH_SRCS sha1.c)
 LIST(APPEND LIBHLA_EXPORTED_INCLUDES sha1.h)
 set_source_files_properties(sha1.c sha1.h PROPERTIES LANGUAGE "C")
-
 SOURCE_GROUP("Source Files\\Hash" FILES ${LIBHLA_HASH_SRCS})
 
 SET(LIBHLA_CLOCK_SRCS 

Index: libhla.hh
===================================================================
RCS file: /sources/certi/certi/libHLA/libhla.hh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libhla.hh   21 Mar 2010 18:31:52 -0000      1.3
+++ libhla.hh   28 Mar 2010 12:24:00 -0000      1.4
@@ -16,7 +16,7 @@
 // License along with this program ; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 //
-// $Id: libhla.hh,v 1.3 2010/03/21 18:31:52 erk Exp $
+// $Id: libhla.hh,v 1.4 2010/03/28 12:24:00 erk Exp $
 // ----------------------------------------------------------------------------
 
 #ifndef LIBHLA_HH_INCLUDED
@@ -91,6 +91,22 @@
 typedef basic_stringize<char> stringize;
 typedef basic_stringize<wchar_t> wstringize;
 
+class HLA_EXPORT Exception
+{
+public:
+    const std::string _reason;
+    const char         *_name;
+
+    Exception(const std::string &reason)
+        : _reason(reason) { }
+    virtual ~Exception() { }
+};
+
+#define LIBHLA_EXCEPTION(A) \
+    class HLA_EXPORT A : public Exception { \
+    public: \
+        A(const std::string &reason) : Exception(reason) { _name = #A;} \
+};
 } // namespace libhla
 
 #endif // LIBHLA_HH_INCLUDED




reply via email to

[Prev in Thread] Current Thread [Next in Thread]