CPN
Computational Process Networks
Exceptions.h
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
25 #ifndef CPN_EXCEPTIONS_H
26 #define CPN_EXCEPTIONS_H
27 #pragma once
28 
29 #include <cpn/common.h>
30 #include <cpn/utils/Exception.h>
31 #include <string>
32 
33 namespace CPN {
34 
39  public:
40  ShutdownException() throw() : Exception(3) {}
41  ~ShutdownException() throw();
42  const char* what() const throw() { return "The kernel has shutdown."; }
43  private:
44  };
45 
50  public:
51  TypeMismatchException() throw() : Exception(3), message("Queue types mismatch") {}
52  TypeMismatchException(const std::string &type1, const std::string &type2) throw() {
53  message = "Queue types " + type1 + " != " + type2;
54  }
55  ~TypeMismatchException() throw();
56  const char* what() const throw() { return message.c_str(); }
57  private:
58  std::string message;
59  };
60 
66  public:
67  BrokenQueueException(Key_t key) throw();
68  ~BrokenQueueException() throw();
69  const char* what() const throw() { return msg.c_str(); }
70  private:
71  std::string msg;
72  };
73 }
74 
75 #endif
TypeMismatchException(const std::string &type1, const std::string &type2)
Definition: Exceptions.h:52
uint64_t Key_t
Definition: common.h:79
An exception indicating that the node tried to write to a shutdown queue.
Definition: Exceptions.h:65
An exception indicating that there is a type mismatch in the queue.
Definition: Exceptions.h:49
An exception indicating that the Kernel has shut down.
Definition: Exceptions.h:38
#define CPN_API
Definition: common.h:36
const char * what() const
Definition: Exceptions.h:69