Flexiport 2.0.0
flexiport.h
Go to the documentation of this file.
1/* Flexiport
2 *
3 * Header file for the factory functions.
4 *
5 * Copyright 2008-2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
6 * RT-Synthesis Research Group
7 * Intelligent Systems Research Institute,
8 * National Institute of Advanced Industrial Science and Technology (AIST),
9 * Japan
10 * All rights reserved.
11 *
12 * This file is part of Flexiport.
13 *
14 * Flexiport is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU Lesser General Public License as published
16 * by the Free Software Foundation; either version 2.1 of the License,
17 * or (at your option) any later version.
18 *
19 * Flexiport is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with Flexiport. If not, see
26 * <http://www.gnu.org/licenses/>.
27 */
28
29#ifndef __FLEXIPORT_H
30#define __FLEXIPORT_H
31
32#include <map>
33#include <string>
34
35#if defined (WIN32)
36 #if defined (FLEXIPORT_STATIC)
37 #define FLEXIPORT_EXPORT
38 #elif defined (flexiport_EXPORTS)
39 #define FLEXIPORT_EXPORT __declspec (dllexport)
40 #else
41 #define FLEXIPORT_EXPORT __declspec (dllimport)
42 #endif
43#else
44 #define FLEXIPORT_EXPORT
45#endif
46
51namespace flexiport
52{
53
55class FLEXIPORT_EXPORT PortException : public std::exception
56{
57 public:
58 PortException (const char *errorStr)
59 : _errorStr (errorStr) {};
60 PortException (const std::string &errorStr)
61 : _errorStr (errorStr) {};
62 ~PortException () throw () {};
63
64 virtual const char* what () const throw ()
65 {
66 return _errorStr.c_str ();
67 }
68
69 private:
70 std::string _errorStr;
71};
72
73// Forward declaration of the Port class
74class Port;
75
94FLEXIPORT_EXPORT Port* CreatePort (std::map<std::string, std::string> options);
95
106FLEXIPORT_EXPORT Port* CreatePort (std::string options);
107
108} // namespace flexiport
109
112#endif // __FLEXIPORT_H
113
Exception thrown by the Port class and its derivatives.
Definition: flexiport.h:56
virtual const char * what() const
Definition: flexiport.h:64
PortException(const char *errorStr)
Definition: flexiport.h:58
PortException(const std::string &errorStr)
Definition: flexiport.h:60
Base Port class.
Definition: port.h:82
#define FLEXIPORT_EXPORT
Definition: flexiport.h:44
FLEXIPORT_EXPORT Port * CreatePort(std::map< std::string, std::string > options)
Function to create a Port object of the necessary port type.