-
- Downloads
Added inheritance between ZmqSocket , ZmqSocketST and ZmqSocketMT
In a previous commit I removed the inheritance relationship between ZmqSocket and ZmqSocketMT. I used templated functions in order to be able to handle instances of ZmqSocket and ZmqSocketMT with thei same code. I now believe that decision was wrong in the long run. Future code maintainers will not know that a ZmqSocketMT object is a type of ZmqSocket. Eclipse and doxygen are very good at providing class hierarchies. One should benefit from this when one can as it is a form of free documentation. My previous commit not only removed inheritance, it also allowed the multi-threaded version of ZMQSocket to contain the single threaded version as opposed to inherit from it. Using composition over inheritance prevented future mistakes where somebody adds a new thread-unsafe method to the super class and forgets or doesn’t know that they should implement a thread-safe overriding version in the sub-class. This commit preserves composition over inheritance. There are now three “ZmqSocket” classes: ZmqSocket, ZmqSocketST and ZmqSocketMT. ZmqSocket itself is now abstract and simply defines the methods such a socket should implement. ZmqSocketST is ai concrete class for single-threaded use (hence ST) and ZmqSocketMT is for multithreaded use (hence MT). ZmqSocketST inherits from ZmqSocket and ZmqSocketMT also inherits from ZmqSocket. ZmqSocketMT does not inherit from ZmqSocketST. ZmqSocketMT contains an instance of ZmqSocketST therefore preserving the composition over inheritance solution of the previous commit.
Showing
- castor/messages/CMakeLists.txt 1 addition, 0 deletionscastor/messages/CMakeLists.txt
- castor/messages/ZmqSocket.cpp 2 additions, 114 deletionscastor/messages/ZmqSocket.cpp
- castor/messages/ZmqSocket.hpp 13 additions, 21 deletionscastor/messages/ZmqSocket.hpp
- castor/messages/ZmqSocketMT.cpp 1 addition, 0 deletionscastor/messages/ZmqSocketMT.cpp
- castor/messages/ZmqSocketMT.hpp 9 additions, 5 deletionscastor/messages/ZmqSocketMT.hpp
- castor/messages/ZmqSocketST.cpp 149 additions, 0 deletionscastor/messages/ZmqSocketST.cpp
- castor/messages/ZmqSocketST.hpp 133 additions, 0 deletionscastor/messages/ZmqSocketST.hpp
- castor/messages/messages.cpp 83 additions, 0 deletionscastor/messages/messages.cpp
- castor/messages/messages.hpp 3 additions, 70 deletionscastor/messages/messages.hpp
- castor/tape/tapeserver/daemon/TapeMessageHandler.hpp 2 additions, 2 deletionscastor/tape/tapeserver/daemon/TapeMessageHandler.hpp
Loading
Please register or sign in to comment