sdhexception.h
Go to the documentation of this file.
1 //======================================================================
28 //======================================================================
29 
30 #ifndef SDHEXCEPTION_H_
31 #define SDHEXCEPTION_H_
32 
33 //----------------------------------------------------------------------
34 // System Includes - include with <>
35 //----------------------------------------------------------------------
36 
37 #include <iostream>
38 #include <exception>
39 #include <stdarg.h>
40 #include <cstdio> // needed in gcc-4.4 (as reported by Hannes Saal)
41 
42 //----------------------------------------------------------------------
43 // Project Includes - include with ""
44 //----------------------------------------------------------------------
45 
46 #include "sdhlibrary_settings.h"
47 
48 //----------------------------------------------------------------------
49 // Defines, enums, unions, structs,
50 //----------------------------------------------------------------------
51 
53 
54 
55 //----------------------------------------------------------------------
56 // Global variables
57 //----------------------------------------------------------------------
58 
59 
60 //----------------------------------------------------------------------
61 // Function and class declaration
62 //----------------------------------------------------------------------
63 
77 class VCC_EXPORT cMsg
78 {
79 protected:
80 
82  enum {
83  eMAX_MSG = 512
84  };
85 
86  char msg[ eMAX_MSG ];
87 
88 public:
90  cMsg();
91 
92 
94  cMsg( cMsg const & other );
95 
96 
98  cMsg( char const* fmt, ... ) SDH__attribute__((format (printf, 2, 3)));
99 
100  /*
101  Remark:
102  Since non-static C++ methods have an implicit `this' argument,
103  the arguments of such methods should be counted from two, not
104  one, when giving values for STRING-INDEX and FIRST-TO-CHECK
105  parameter of the format __attribute__.)
106  */
107 
108 
110  char const *c_str() const;
111 
112 };
113 
114 VCC_EXPORT std::ostream &operator<<(std::ostream &stream, cMsg const &msg);
115 
116 
117 //======================================================================
118 
132 class VCC_EXPORT cSDHLibraryException: public std::exception
133 {
134 
135 protected:
138 
139 public:
193  cSDHLibraryException( char const * _type, cMsg const & _msg );
194 
198  virtual const char* what() const throw();
199 
200 }; // cSDHLibraryException
201 //----------------------------------------------------------------------
202 
207 {
208 public:
209  cSDHErrorCommunication( cMsg const & _msg )
210  : cSDHLibraryException( "cSDHErrorCommunication", _msg )
211  {}
212 
213  cSDHErrorCommunication( char const* _type, cMsg const & _msg )
214  : cSDHLibraryException( _type, _msg )
215  {}
216 };
217 //-----------------------------------------------------------------
218 
219 VCC_EXPORT std::ostream &operator<<(std::ostream &stream, cSDHLibraryException const &e);
220 
221 //======================================================================
222 
224 
225 #endif
226 
227 
228 //======================================================================
229 /*
230  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
231  (e.g. to explicitely set C++ mode for *.h header files)
232 
233  Local Variables:
234  mode:C++
235  mode:ELSE
236  End:
237 */
238 //======================================================================
cMsg msg
The message object.
Definition: sdhexception.h:137
VCC_EXPORT std::ostream & operator<<(std::ostream &stream, cMsg const &msg)
cSDHErrorCommunication(char const *_type, cMsg const &_msg)
Definition: sdhexception.h:213
#define NAMESPACE_SDH_START
Base class for exceptions in the SDHLibrary-CPP.
Definition: sdhexception.h:132
cSDHErrorCommunication(cMsg const &_msg)
Definition: sdhexception.h:209
#define SDH__attribute__(...)
#define NAMESPACE_SDH_END
Derived exception class for exceptions related to communication between the SDHLibrary and the SDH...
Definition: sdhexception.h:206
This file contains settings to make the SDHLibrary compile on differen systems:
Class for short, fixed maximum length text messages.
Definition: sdhexception.h:77


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Sun Aug 18 2019 03:42:20