Overview Tutorial API reference Examples Build Download ZmqMessage 0.1 - 21 Oct 2011

include/zmqmessage/Config.hpp

Go to the documentation of this file.
00001 
00010 #include "zmq.hpp"
00011 
00012 #ifndef ZMQMESSAGE_CONFIG_HPP_
00013 #define ZMQMESSAGE_CONFIG_HPP_
00014 
00015 //You can (and encouraged to) define the following constants
00016 //to adapt ZmqMessage library to your application.
00017 
00041 #ifndef ZMQMESSAGE_STRING_CLASS
00042 #include <string>
00043 #define ZMQMESSAGE_STRING_CLASS std::string
00044 #endif
00045 
00046 
00054 #define ZMQMESSAGE_LOG_STREAM_NONE if(1); else std::cerr
00055 
00072 #ifndef ZMQMESSAGE_LOG_STREAM
00073 #include <iostream>
00074 # ifdef NDEBUG
00075 #  define ZMQMESSAGE_LOG_STREAM ZMQMESSAGE_LOG_STREAM_NONE
00076 # else
00077 #  define ZMQMESSAGE_LOG_STREAM std::cerr
00078 # endif
00079 #endif
00080 
00093 #ifndef ZMQMESSAGE_LOG_TERM
00094 #define ZMQMESSAGE_LOG_TERM std::endl
00095 #endif
00096 
00108 #ifndef ZMQMESSAGE_EXCEPTION_MACRO
00109 #include <stdexcept>
00110 namespace ZmqMessage
00111 {
00112   template <class Tag>
00113   class DefaultExceptionTemplate : public std::logic_error
00114   {
00115   public:
00116     explicit DefaultExceptionTemplate (const std::string& arg) :
00117       std::logic_error(arg) {}
00118   };
00119 }
00120 #define ZMQMESSAGE_EXCEPTION_MACRO(name) \
00121   class name##_tag {}; \
00122   typedef ::ZmqMessage::DefaultExceptionTemplate<name##_tag> name
00123 #else
00124 namespace ZmqMessage
00125 {
00126   //make this type unusable
00127   template <class Tag>
00128   class DefaultExceptionTemplate
00129   {
00130   private:
00131     DefaultExceptionTemplate() {}
00132   };
00133 }
00134 #endif
00135 
00145 namespace ZmqMessage
00146 {
00147 #ifndef ZMQMESSAGE_WRAP_ZMQ_ERROR
00148 
00149 //just to generate correct docs
00150 # define ZMQMESSAGE_WRAP_ZMQ_ERROR 1
00151 # undef ZMQMESSAGE_WRAP_ZMQ_ERROR
00152 
00153   typedef zmq::error_t ZmqErrorType;
00154   inline void
00155   throw_zmq_error(const char* err)
00156   {
00157     throw zmq::error_t();
00158   }
00159 #else
00160   ZMQMESSAGE_EXCEPTION_MACRO(ZmqException)
00161   ;
00162   typedef ZmqException ZmqErrorType;
00163   inline void
00164   throw_zmq_error(const char* err)
00165   {
00166     throw ZmqException(err);
00167   }
00168 #endif
00169 
00170 }
00171 
00172 #endif /* ZMQMESSAGE_CONFIG_HPP_ */

ZmqMessage 0.1 — open source software, support@zmqmessage.org