| Newsgroups |
gmane.comp.video.gephex.devel |
| Message-ID |
<[email protected]> |
Archive: [email protected]
New revision: gephex--main--0.5--patch-12
--
Revision: gephex--main--0.5--patch-12
Archive: [email protected]
Creator: The Gephex Source Archive <[email protected]>
Date: Mon Feb 7 21:07:32 CET 2005
Standard-date: 2005-02-07 20:07:32 GMT
New-files: gphxsdk/.arch-ids/=id
gphxsdk/.arch-ids/Makefile.am.id gphxsdk/Makefile.am
gphxsdk/include/.arch-ids/=id
gphxsdk/include/.arch-ids/Makefile.am.id
gphxsdk/include/.arch-ids/link.h.id
gphxsdk/include/.arch-ids/logger.h.id
gphxsdk/include/.arch-ids/unit.h.id
gphxsdk/include/Makefile.am gphxsdk/include/link.h
gphxsdk/include/logger.h gphxsdk/include/unit.h
gphxsdk/src/.arch-ids/=id
gphxsdk/src/.arch-ids/Makefile.am.id
gphxsdk/src/.arch-ids/link.cpp.id
gphxsdk/src/.arch-ids/logger.cpp.id
gphxsdk/src/.arch-ids/unit.cpp.id
gphxsdk/src/Makefile.am gphxsdk/src/link.cpp
gphxsdk/src/logger.cpp gphxsdk/src/unit.cpp
plugins/src/core/.arch-ids/=id
plugins/src/core/.arch-ids/Makefile.am.id
plugins/src/core/.arch-ids/core.cpp.id
plugins/src/core/.arch-ids/kalkulon.cpp.id
plugins/src/core/.arch-ids/kalkulon.h.id
plugins/src/core/.arch-ids/number.cpp.id
plugins/src/core/.arch-ids/number.h.id
plugins/src/core/Makefile.am plugins/src/core/core.cpp
plugins/src/core/kalkulon.cpp
plugins/src/core/kalkulon.h plugins/src/core/number.cpp
plugins/src/core/number.h
New-directories: gphxsdk gphxsdk/.arch-ids gphxsdk/include
gphxsdk/include/.arch-ids gphxsdk/src
gphxsdk/src/.arch-ids plugins/src/core
Removed-files: gidlc/.arch-ids/=id
gidlc/.arch-ids/Makefile.am.id gidlc/Makefile.am
gidlc/src/.arch-ids/=id
gidlc/src/.arch-ids/Makefile.am.id
gidlc/src/.arch-ids/cppautovisitors.cpp.id
gidlc/src/.arch-ids/cppautovisitors.h.id
gidlc/src/.arch-ids/cvisitors.cpp.id
gidlc/src/.arch-ids/cvisitors.h.id
gidlc/src/.arch-ids/declarationnode.cpp.id
gidlc/src/.arch-ids/declarationnode.h.id
gidlc/src/.arch-ids/declarationtypes.h.id
gidlc/src/.arch-ids/gidl_parser.h.id
gidlc/src/.arch-ids/gidl_parser.tab.cpp.id
gidlc/src/.arch-ids/gidl_parser.tab.hpp.id
gidlc/src/.arch-ids/gidl_parser.ypp.id
gidlc/src/.arch-ids/gidl_scanner.cpp.id
gidlc/src/.arch-ids/gidl_scanner.flex.id
gidlc/src/.arch-ids/main.cpp.id
gidlc/src/.arch-ids/treevisitor.cpp.id
gidlc/src/.arch-ids/treevisitor.h.id
gidlc/src/.arch-ids/visitor_helpers.h.id
gidlc/src/Makefile.am gidlc/src/cppautovisitors.cpp
gidlc/src/cppautovisitors.h gidlc/src/cvisitors.cpp
gidlc/src/cvisitors.h gidlc/src/declarationnode.cpp
gidlc/src/declarationnode.h
gidlc/src/declarationtypes.h gidlc/src/gidl_parser.h
gidlc/src/gidl_parser.tab.cpp
gidlc/src/gidl_parser.tab.hpp gidlc/src/gidl_parser.ypp
gidlc/src/gidl_scanner.cpp gidlc/src/gidl_scanner.flex
gidlc/src/main.cpp gidlc/src/treevisitor.cpp
gidlc/src/treevisitor.h gidlc/src/visitor_helpers.h
gphxcore/interfaces/.arch-ids/=id
gphxcore/interfaces/.arch-ids/link.if.id
gphxcore/interfaces/.arch-ids/linkfactory.if.id
gphxcore/interfaces/.arch-ids/logger.if.id
gphxcore/interfaces/.arch-ids/unit.if.id
gphxcore/interfaces/.arch-ids/unitfactory.if.id
gphxcore/interfaces/link.if
gphxcore/interfaces/linkfactory.if
gphxcore/interfaces/logger.if
gphxcore/interfaces/unit.if
gphxcore/interfaces/unitfactory.if
plugins/ifaces/.arch-ids/=id
plugins/src/core/.arch-ids/=id
plugins/src/core/.arch-ids/Makefile.am.id
plugins/src/core/.arch-ids/bgraimage.lsp.id
plugins/src/core/.arch-ids/bgraimage_1.c.id
plugins/src/core/.arch-ids/bgraimage_1.h.id
plugins/src/core/.arch-ids/color.lsp.id
plugins/src/core/.arch-ids/color_1.c.id
plugins/src/core/.arch-ids/color_1.h.id
plugins/src/core/.arch-ids/core.psp.id
plugins/src/core/.arch-ids/kalkulon.usp.id
plugins/src/core/.arch-ids/kalkulon_1.cpp.id
plugins/src/core/.arch-ids/kalkulon_1.h.id
plugins/src/core/.arch-ids/number.lsp.id
plugins/src/core/.arch-ids/number_1.cpp.id
plugins/src/core/.arch-ids/number_1.h.id
plugins/src/core/.arch-ids/random.usp.id
plugins/src/core/.arch-ids/random_1.c.id
plugins/src/core/.arch-ids/random_1.h.id
plugins/src/core/.arch-ids/string.lsp.id
plugins/src/core/.arch-ids/string_1.c.id
plugins/src/core/.arch-ids/string_1.h.id
plugins/src/core/Makefile.am
plugins/src/core/bgraimage.lsp
plugins/src/core/bgraimage_1.c
plugins/src/core/bgraimage_1.h
plugins/src/core/color.lsp plugins/src/core/color_1.c
plugins/src/core/color_1.h plugins/src/core/core.psp
plugins/src/core/kalkulon.usp
plugins/src/core/kalkulon_1.cpp
plugins/src/core/kalkulon_1.h
plugins/src/core/number.lsp
plugins/src/core/number_1.cpp
plugins/src/core/number_1.h plugins/src/core/random.usp
plugins/src/core/random_1.c plugins/src/core/random_1.h
plugins/src/core/string.lsp plugins/src/core/string_1.c
plugins/src/core/string_1.h
Removed-directories: gidlc gidlc/.arch-ids gidlc/src
gidlc/src/.arch-ids gphxcore/interfaces
gphxcore/interfaces/.arch-ids plugins/ifaces
plugins/ifaces/.arch-ids plugins/src/core
Renamed-files: gphxcore/include/.arch-ids/coreexceptions.h.id gphxcore/src/.arch-ids/coreexceptions.h.id
gphxcore/include/coreexceptions.h gphxcore/src/coreexceptions.h
gphxcore/src/.arch-ids/logger.cpp.id gphxcore/src/.arch-ids/streamlogger.cpp.id
gphxcore/src/.arch-ids/logger.h.id gphxcore/src/.arch-ids/streamlogger.h.id
gphxcore/src/logger.cpp gphxcore/src/streamlogger.cpp
gphxcore/src/logger.h gphxcore/src/streamlogger.h
Renamed-directories: plugins/src/core/.arch-ids plugins/src/core/.arch-ids
Modified-files: Makefile.am configure.ac
gphxcore/include/Makefile.am
gphxcore/include/connectionhandle.h
gphxcore/include/core.h
gphxcore/include/linkfactoryhandle.h
gphxcore/include/linkhandle.h
gphxcore/include/pluginhandle.h
gphxcore/include/portio.h
gphxcore/include/unitfactoryhandle.h
gphxcore/include/unithandle.h gphxcore/src/Makefile.am
gphxcore/src/connectionhandleimpl.cpp
gphxcore/src/connectionhandleimpl.h
gphxcore/src/core.cpp
gphxcore/src/linkfactoryhandleimpl.cpp
gphxcore/src/linkfactoryhandleimpl.h
gphxcore/src/linkhandleimpl.cpp
gphxcore/src/linkhandleimpl.h gphxcore/src/plugin.cpp
gphxcore/src/plugin.h gphxcore/src/pluginhandleimpl.cpp
gphxcore/src/pluginhandleimpl.h
gphxcore/src/renderer.cpp gphxcore/src/renderer.h
gphxcore/src/streamlogger.cpp
gphxcore/src/streamlogger.h
gphxcore/src/unitfactoryhandleimpl.cpp
gphxcore/src/unitfactoryhandleimpl.h
gphxcore/src/unithandleimpl.cpp
gphxcore/src/unithandleimpl.h
konsolenphex/scripts/plus.phex
konsolenphex/src/Makefile.am konsolenphex/src/main.cpp
pluc/src/main.cpp pluc/src/pluc_parser.tab.cpp
pluc/src/pluc_parser.ypp pluc/src/spec.cpp
pluc/src/spec.h plugins/src/Makefile.am
New-patches: [email protected]/gephex--georg--0.5--patch-28
[email protected]/gephex--georg-refactor-stateless--0.5--base-0
[email protected]/gephex--georg-refactor-stateless--0.5--patch-1
[email protected]/gephex--georg-refactor-stateless--0.5--patch-2
[email protected]/gephex--georg-refactor-stateless--0.5--patch-3
[email protected]/gephex--georg-refactor-stateless--0.5--patch-4
[email protected]/gephex--georg-refactor-stateless--0.5--patch-5
[email protected]/gephex--georg-refactor-stateless--0.5--patch-6
[email protected]/gephex--georg-refactor-stateless--0.5--patch-7
[email protected]/gephex--georg-refactor-stateless--0.5--patch-8
[email protected]/gephex--georg-refactor-stateless--0.5--patch-9
[email protected]/gephex--georg-refactor-stateless--0.5--patch-10
[email protected]/gephex--main--0.5--patch-12
Summary: [MERGE-REQUEST] first step towards stateless units
Keywords:
Patches applied:
* [email protected]/gephex--georg--0.5--patch-28
Merged in the refactor-stateless branch
* [email protected]/gephex--georg-refactor-stateless--0.5--base-0
tag of [email protected]/gephex--georg--0.5--patch-27
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-1
First step in refactoring towards stateless units
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-2
Fixed some serialization bugs
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-3
Implemented new update
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-4
Added core Makefile.am
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-5
Added more missing files
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-6
Removed gidlc and old core plugin
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-7
First step in transforming core to a c-like interface
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-8
adapted konsolenphex to c-like core iface, removed gidlc from configure.ac
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-9
Started to adapt pluc to new stateless c++ plugin api
* [email protected]/gephex--georg-refactor-stateless--0.5--patch-10
Pluc compiles
* removed directories
gidlc
gidlc/.arch-ids
gidlc/src
gidlc/src/.arch-ids
gphxcore/interfaces
gphxcore/interfaces/.arch-ids
plugins/ifaces
plugins/ifaces/.arch-ids
plugins/src/core
* added directories
gphxsdk
gphxsdk/.arch-ids
gphxsdk/include
gphxsdk/include/.arch-ids
gphxsdk/src
gphxsdk/src/.arch-ids
plugins/src/core
{arch}/gephex/gephex--georg-refactor-stateless
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log
* removed files
gidlc/.arch-ids/=id
gidlc/.arch-ids/Makefile.am.id
gidlc/Makefile.am
gidlc/src/.arch-ids/=id
gidlc/src/.arch-ids/Makefile.am.id
gidlc/src/.arch-ids/cppautovisitors.cpp.id
gidlc/src/.arch-ids/cppautovisitors.h.id
gidlc/src/.arch-ids/cvisitors.cpp.id
gidlc/src/.arch-ids/cvisitors.h.id
gidlc/src/.arch-ids/declarationnode.cpp.id
gidlc/src/.arch-ids/declarationnode.h.id
gidlc/src/.arch-ids/declarationtypes.h.id
gidlc/src/.arch-ids/gidl_parser.h.id
gidlc/src/.arch-ids/gidl_parser.tab.cpp.id
gidlc/src/.arch-ids/gidl_parser.tab.hpp.id
gidlc/src/.arch-ids/gidl_parser.ypp.id
gidlc/src/.arch-ids/gidl_scanner.cpp.id
gidlc/src/.arch-ids/gidl_scanner.flex.id
gidlc/src/.arch-ids/main.cpp.id
gidlc/src/.arch-ids/treevisitor.cpp.id
gidlc/src/.arch-ids/treevisitor.h.id
gidlc/src/.arch-ids/visitor_helpers.h.id
gidlc/src/Makefile.am
gidlc/src/cppautovisitors.cpp
gidlc/src/cppautovisitors.h
gidlc/src/cvisitors.cpp
gidlc/src/cvisitors.h
gidlc/src/declarationnode.cpp
gidlc/src/declarationnode.h
gidlc/src/declarationtypes.h
gidlc/src/gidl_parser.h
gidlc/src/gidl_parser.tab.cpp
gidlc/src/gidl_parser.tab.hpp
gidlc/src/gidl_parser.ypp
gidlc/src/gidl_scanner.cpp
gidlc/src/gidl_scanner.flex
gidlc/src/main.cpp
gidlc/src/treevisitor.cpp
gidlc/src/treevisitor.h
gidlc/src/visitor_helpers.h
gphxcore/interfaces/.arch-ids/=id
gphxcore/interfaces/.arch-ids/link.if.id
gphxcore/interfaces/.arch-ids/linkfactory.if.id
gphxcore/interfaces/.arch-ids/logger.if.id
gphxcore/interfaces/.arch-ids/unit.if.id
gphxcore/interfaces/.arch-ids/unitfactory.if.id
gphxcore/interfaces/link.if
gphxcore/interfaces/linkfactory.if
gphxcore/interfaces/logger.if
gphxcore/interfaces/unit.if
gphxcore/interfaces/unitfactory.if
plugins/ifaces/.arch-ids/=id
plugins/src/core/.arch-ids/=id
plugins/src/core/.arch-ids/Makefile.am.id
plugins/src/core/.arch-ids/bgraimage.lsp.id
plugins/src/core/.arch-ids/bgraimage_1.c.id
plugins/src/core/.arch-ids/bgraimage_1.h.id
plugins/src/core/.arch-ids/color.lsp.id
plugins/src/core/.arch-ids/color_1.c.id
plugins/src/core/.arch-ids/color_1.h.id
plugins/src/core/.arch-ids/core.psp.id
plugins/src/core/.arch-ids/kalkulon.usp.id
plugins/src/core/.arch-ids/kalkulon_1.cpp.id
plugins/src/core/.arch-ids/kalkulon_1.h.id
plugins/src/core/.arch-ids/number.lsp.id
plugins/src/core/.arch-ids/number_1.cpp.id
plugins/src/core/.arch-ids/number_1.h.id
plugins/src/core/.arch-ids/random.usp.id
plugins/src/core/.arch-ids/random_1.c.id
plugins/src/core/.arch-ids/random_1.h.id
plugins/src/core/.arch-ids/string.lsp.id
plugins/src/core/.arch-ids/string_1.c.id
plugins/src/core/.arch-ids/string_1.h.id
plugins/src/core/Makefile.am
plugins/src/core/bgraimage.lsp
plugins/src/core/bgraimage_1.c
plugins/src/core/bgraimage_1.h
plugins/src/core/color.lsp
plugins/src/core/color_1.c
plugins/src/core/color_1.h
plugins/src/core/core.psp
plugins/src/core/kalkulon.usp
plugins/src/core/kalkulon_1.cpp
plugins/src/core/kalkulon_1.h
plugins/src/core/number.lsp
plugins/src/core/number_1.cpp
plugins/src/core/number_1.h
plugins/src/core/random.usp
plugins/src/core/random_1.c
plugins/src/core/random_1.h
plugins/src/core/string.lsp
plugins/src/core/string_1.c
plugins/src/core/string_1.h
* added files
gphxsdk/.arch-ids/=id
gphxsdk/.arch-ids/Makefile.am.id
gphxsdk/Makefile.am
gphxsdk/include/.arch-ids/=id
gphxsdk/include/.arch-ids/Makefile.am.id
gphxsdk/include/.arch-ids/link.h.id
gphxsdk/include/.arch-ids/logger.h.id
gphxsdk/include/.arch-ids/unit.h.id
gphxsdk/include/Makefile.am
gphxsdk/include/link.h
gphxsdk/include/logger.h
gphxsdk/include/unit.h
gphxsdk/src/.arch-ids/=id
gphxsdk/src/.arch-ids/Makefile.am.id
gphxsdk/src/.arch-ids/link.cpp.id
gphxsdk/src/.arch-ids/logger.cpp.id
gphxsdk/src/.arch-ids/unit.cpp.id
gphxsdk/src/Makefile.am
gphxsdk/src/link.cpp
gphxsdk/src/logger.cpp
gphxsdk/src/unit.cpp
plugins/src/core/.arch-ids/=id
plugins/src/core/.arch-ids/Makefile.am.id
plugins/src/core/.arch-ids/core.cpp.id
plugins/src/core/.arch-ids/kalkulon.cpp.id
plugins/src/core/.arch-ids/kalkulon.h.id
plugins/src/core/.arch-ids/number.cpp.id
plugins/src/core/.arch-ids/number.h.id
plugins/src/core/Makefile.am
plugins/src/core/core.cpp
plugins/src/core/kalkulon.cpp
plugins/src/core/kalkulon.h
plugins/src/core/number.cpp
plugins/src/core/number.h
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/base-0
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-1
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-10
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-2
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-3
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-4
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-5
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-6
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-7
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-8
{arch}/gephex/gephex--georg-refactor-stateless/gephex--georg-refactor-stateless--0.5/[email protected]/patch-log/patch-9
{arch}/gephex/gephex--georg/gephex--georg--0.5/[email protected]/patch-log/patch-28
{arch}/gephex/gephex--main/gephex--main--0.5/[email protected]/patch-log/patch-12
* renamed files and symlinks
gphxcore/include/.arch-ids/coreexceptions.h.id
=> gphxcore/src/.arch-ids/coreexceptions.h.id
gphxcore/include/coreexceptions.h
=> gphxcore/src/coreexceptions.h
gphxcore/src/.arch-ids/logger.cpp.id
=> gphxcore/src/.arch-ids/streamlogger.cpp.id
gphxcore/src/.arch-ids/logger.h.id
=> gphxcore/src/.arch-ids/streamlogger.h.id
gphxcore/src/logger.cpp
=> gphxcore/src/streamlogger.cpp
gphxcore/src/logger.h
=> gphxcore/src/streamlogger.h
* renamed directories
plugins/src/core/.arch-ids
=> plugins/src/core/.arch-ids
* modified files
--- orig/Makefile.am
+++ mod/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = tester gidlc pluc gphxutils gphxcore konsolenphex misc plugins
+SUBDIRS = gphxutils gphxsdk gphxcore konsolenphex misc plugins
EXTRA_DIST = NEWS README COPYING
--- orig/configure.ac
+++ mod/configure.ac
@@ -112,14 +112,15 @@
AC_CONFIG_FILES([Makefile
tester/Makefile
tester/src/Makefile
-gidlc/Makefile
-gidlc/src/Makefile
pluc/Makefile
pluc/src/Makefile
gphxutils/Makefile
gphxutils/include/Makefile
gphxutils/src/Makefile
gphxutils/src/tests/Makefile
+gphxsdk/Makefile
+gphxsdk/include/Makefile
+gphxsdk/src/Makefile
gphxcore/Makefile
gphxcore/include/Makefile
gphxcore/src/Makefile
--- orig/gphxcore/include/Makefile.am
+++ mod/gphxcore/include/Makefile.am
@@ -1,7 +1,6 @@
noinst_HEADERS= \
connectionhandle.h \
core.h \
- coreexceptions.h \
linkhandle.h \
linkfactoryhandle.h \
pluginhandle.h \
--- orig/gphxcore/include/connectionhandle.h
+++ mod/gphxcore/include/connectionhandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -27,17 +27,6 @@
namespace core
{
- class ConnectionHandle
- {
- public:
- virtual ~ConnectionHandle();
-
- protected:
- ConnectionHandle();
-
- private:
- ConnectionHandle(const ConnectionHandle&);
- virtual ConnectionHandle& operator=(const ConnectionHandle&);
- };
+ struct ConnectionHandle;
}
#endif
--- orig/gphxcore/include/core.h
+++ mod/gphxcore/include/core.h
@@ -1,34 +1,31 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+Copyright (C) 2001-2003
- Georg Seidel <[email protected]>
- Martin Bayer <[email protected]>
- Phillip Promesberger <[email protected]>
+Georg Seidel <[email protected]>
+Martin Bayer <[email protected]>
+Phillip Promesberger <[email protected]>
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
#ifndef INCLUDED_CORE_H
#define INCLUDED_CORE_H
#include <string>
-#include <memory>
#include <list>
-#include "coreexceptions.h"
-
namespace utils
{
class ILibrary;
@@ -40,258 +37,256 @@
namespace core
{
- class PluginHandle;
- class UnitFactoryID;
- class LinkFactoryID;
- class UnitFactoryHandle;
- class LinkFactoryHandle;
- class UnitHandle;
- class PortHandle;
- class LinkHandle;
- class LinkHandleImpl;
- class ConnectionHandle;
-
- class Renderer;
-
- /**
- * Hui pfui
- *
- * Note on error handling:
- * All functions return errors with exceptions.
- * All exceptions are derived from std::exception.
- * All exceptions that can be thrown by a function
- * are documented.
- *
- * Warnings can be retrieved with the getWarnings function.
- */
- class Core
- {
-
- public:
- /**
- * List of warning strings
- */
- typedef std::list<std::string> WarningList;
+ struct PluginHandle;
+ struct UnitFactoryID;
+ struct LinkFactoryID;
+ struct UnitFactoryHandle;
+ struct LinkFactoryHandle;
+ struct UnitHandle;
+ struct PortHandle;
+ struct LinkHandle;
+ struct LinkHandleImpl;
+ struct ConnectionHandle;
+
+ //---------------------------------------------------------------------------
+
+ enum CoreError {IN_USE_ERROR,
+ TYPE_ERROR,
+ GENERAL_ERROR,
+ INVALID_ARG,
+ TIME_ERROR};
+ struct Core;
- /**
- * Creates a new core object. Note that it is not safe to
- * create more than one core.
- *
- */
- Core() throw();
- ~Core();
-
- /**
- * Get pending warnings. Each warning is added to the list only once
- * Only the warnings of the last function called are garuanteed to be
- * added.
- *
- * \param warnlist List where the of recent warnings are added
- */
- void get_warnings(WarningList& warnlist) throw();
-
- /**
- * Loads a plugin. The returned handle can be queried for exported
- * types of the plugin.
- * The handle is valid until unload_plugin is called.
- *
- * \param lib a library that exports the needed plugin functions
- *
eturn A PluginHandle that encapsulates the plugin
- *
- * hrows std::invalid_argument if lib is not a valid plugin
- * hrows std::runtime_error if loading the plugin fails
- */
- PluginHandle& load_plugin(std::auto_ptr<utils::ILibrary>& lib)
- throw(std::invalid_argument, std::runtime_error);
-
- /**
- * Unloads a plugin.
- * After the call, the plugin handle is invalid.
- *
- * \param plugin the handle of the plugin that is to be unloaded
- * hrows std::runtime_error if unloading of the plugin fails
- * hrows core::in_use_error if entities (UnitFactoryIDs, LinkFactoryIDs)
- * of the plugin are still in use
- */
- void unload_plugin(PluginHandle& plugin)
- throw (std::runtime_error, core::in_use_error);
-
- /**
- * Loads a link factory.
- * The returned handle is valid until unimport_lf is called.
- *
- * \param id the identifier of the link factory (as returned from
- * the PluginHandle object)
- *
eturns the handle of the imported link factory
- *
- * hrows std::invalid_argument if the linkfactory has already been
- * loaded
- * hrows std::runtime_error if loading the link factory fails
- */
- LinkFactoryHandle& import_lf(LinkFactoryID& id)
- throw(std::runtime_error, std::invalid_argument);
-
- /**
- * Loads a unit factory.
- *
- * \param id the identifier of the unit factory (as returned from
- * the PluginHandle object)
- *
eturns the handle of the imported unit factory
- *
- * hrows std::invalid_argument if the unit factory has already been
- * loaded
- * hrows std::runtime_error if loading the unit factory fails
- */
- UnitFactoryHandle& import_uf(UnitFactoryID& id)
- throw(std::runtime_error, std::invalid_argument);
-
- /**
- * Unloads a link factory. After this call the handle is invalid.
- *
- * \param lt the handle of the link factory
- * hrows core::in_use_error if links of that factory are still in use
- */
- void unimport_lf(LinkFactoryHandle& lt)
- throw(core::in_use_error);
-
- /**
- * Unloads a unit factory. After this call the handle is invalid.
- *
- * hrows core::in_use_error if units of that factory are still in use
- */
- void unimport_uf(UnitFactoryHandle& lt)
- throw(core::in_use_error);
-
- /**
- * Creates a unit.
- *
- * \param factory the handle of the unit factory from which the unit
- * is instantiated.
- *
eturns a handle to the new unit
- *
- * hrows std::runtime_error if instantiation of the unit fails
- */
- UnitHandle& create_unit(UnitFactoryHandle& factory)
- throw(std::runtime_error);
-
- /**
- * Creates a link.
- *
- * \param factory the handle of the link factory from which the link
- * is instantiated.
- *
eturns a handle to the new link
- *
- * hrows std::runtime_error if instantiation of the link fails
- */
- LinkHandle& create_link(LinkFactoryHandle& factory)
- throw(std::runtime_error);
-
- /**
- * Destroys a unit.
- *
- * \param handle the unit handle
- *
- * hrows core::in_use_error if the unit is connected to one or more links
- * or if the core is running and id is a sink
- * hrows std::runtime_error if deinstantiate fails
- */
- void destroy_unit(UnitHandle& handle)
- throw(core::in_use_error, std::runtime_error);
-
- /**
- * Destroys a link.
- * Also removes all subscriptions on this link (see subscribe_link_value)
- *
- * \param handle the unit handle
- *
- * hrows core::in_use_error if the link is connected to one or more units
- * hrows std::runtime_error if deinstantiate fails
- */
- void destroy_link(LinkHandle& id)
- throw(core::in_use_error, std::runtime_error);
-
- /**
- * Updates the specified units.
- *
- * \param sinks The handles of the units that will be updated.
- * \param time The time at which all units are updated.
- * Note that this should be the system time in ms as
- * some units might use it to determine what to do.
- *
- * hrows std::invalid_argument if one of the sinks does not exist,
- * or if time is less then the time of the
- * last call
- * hrows std::runtime_error if something bad happens
- */
- void update(const std::list<UnitHandle*>& sinks, double time)
- throw (std::runtime_error, std::invalid_argument);
-
- /**
- * Tells a unit from which link a port reads or writes it's data.
- * Note: all ports have to be attached to a link before update
- * can be called.
- *
- * At most one link may be attached to an output port.
- * A link may be connected to any number of input ports.
- *
- * \param lid the handle the link
- * \param pid the handle of the port as returned by
- * UnitHandle::port_handle()
- *
eturns a handle for the connection between the link and the unit
- *
- * hrows std::in_use_error if this port already is connected
- * hrows std::invalid_argument if this link already is connected
- * to an output
- * hrow std::domain_error if the link factory of pid is not the same
- * as the factory of lid
- */
- ConnectionHandle& attach(LinkHandle& lid,
- PortHandle& pid)
- throw (std::domain_error, std::invalid_argument, core::in_use_error);
-
- /**
- * Removes the connection between a link and a port.
- * After the call, the connection handle is invalid.
- *
- * \param connection the handle of the connection
- */
- void detach(ConnectionHandle& connection) throw ();
-
-
- /**
- * Creates a subscription on a link.
- * This means that the value of this link will be returned by
- * the fetch_subscription() method.
- *
- * \param lid the link whose value is of interest
- * hrows std::invalid_argument if here is already a
- * subscription on lid
- */
- void subscribe_link_value(LinkHandle& lid) throw(std::invalid_argument);
-
- /**
- * Removes a subscription from a link.
- *
- * \param lid the link whose value is no longer of interest
- * hrows std::invalid_argument if there is no subscription on lid
- */
- void unsubscribe_link_value(LinkHandle& lid) throw(std::invalid_argument);
-
- /**
- * Pushes the values of subscribed links onto the stream.
- * Pushes only those values that have changed since time.
- *
- * \param time the time starting from which all changes are sent
- */
- void fetch_subscription(double time /*TODO: some kind of stream*/)
- const throw();
-
- private:
- std::auto_ptr<Renderer> m_renderer;
- typedef std::list<LinkHandleImpl*> SubscriptionList;
- SubscriptionList m_subscriptions;
- };
+ /**
+ * Creates a new core object. Note that it is not safe to
+ * create more than one core.
+ */
+
+ Core* core_create();
+ void core_destroy(Core* c);
+
+
+ /**
+ * List of warning strings
+ */
+ typedef std::list<std::string> WarningList;
+
+
+ /**
+ * Get pending warnings. Each warning is added to the list only once
+ * Only the warnings of the last function called are garuanteed to be
+ * added.
+ *
+ * \param warnlist List where the of recent warnings are added
+ */
+ void core_get_warnings(Core&, WarningList& warnlist);
+
+ /**
+ * Loads a plugin. The returned handle can be queried for exported
+ * types of the plugin.
+ * The handle is valid until unload_plugin is called.
+ *
+ * \param lib a library that exports the needed plugin functions
+ *
eturn A PluginHandle that encapsulates the plugin or 0
+ * on failure
+ *
+ * error is INVALID_ARG if lib is not a valid plugin, or
+ * GENERAL_ERROR if loading the plugin fails
+ */
+ PluginHandle* core_load_plugin(Core& c, utils::ILibrary* lib,
+ CoreError& error);
+
+ /**
+ * Unloads a plugin.
+ * After the call, the plugin handle is invalid.
+ *
+ * \param plugin the handle of the plugin that is to be unloaded
+ *
eturn true on success, false on error
+ *
+ * error is GENERAL_ERROR if unloading fails, or
+ * IN_USE_ERROR if entities (UnitFactorys, LinkFactorys)
+ * of the plugin are still in use
+ */
+ bool core_unload_plugin(Core& c, PluginHandle* plugin,
+ CoreError& error);
+
+ /**
+ * Loads a link factory.
+ * The returned handle is valid until unimport_lf is called.
+ *
+ * \param id the identifier of the link factory (as returned from
+ * the PluginHandle object)
+ *
eturns the handle of the imported link factory, or 0 on failure
+ *
+ * error is IN_USE_ERROR if the link factory has already been loaded, or
+ * GENERAL_ERROR if loading the link factory fails
+ */
+ LinkFactoryHandle* core_import_lf(Core& c, LinkFactoryID* id,
+ CoreError& error);
+
+ /**
+ * Loads a unit factory.
+ *
+ * \param id the identifier of the unit factory (as returned from
+ * the PluginHandle object)
+ *
eturns the handle of the imported unit factory, or 0 on failure
+ *
+ * error is IN_USE_ERROR if the unit factory has already been loaded, or
+ * GENERAL_ERROR if loading the unit factory fails
+ */
+ UnitFactoryHandle* core_import_uf(Core& c, UnitFactoryID* id,
+ CoreError& error);
+
+ /**
+ * Unloads a link factory. After this call the handle is invalid.
+ *
+ * \param lt the handle of the link factory
+ *
eturns whether unimport was successful
+ *
+ * error is IN_USE_ERROR iff links of that factory are still in use
+ */
+ bool core_unimport_lf(Core& c, LinkFactoryHandle* lt, CoreError& error);
+
+ /**
+ * Unloads a unit factory. After this call the handle is invalid.
+ *
+ * \param ut the handle of the unit factory
+ *
+ *
eturns whether unimport was successful
+ *
+ * error is IN_USE_ERROR iff units of that factory are still in use
+ */
+ bool core_unimport_uf(Core& c, UnitFactoryHandle* lt, CoreError& error);
+
+ /**
+ * Creates a unit.
+ *
+ * \param factory the handle of the unit factory from which the unit
+ * is instantiated.
+ *
eturns a handle to the new unit or 0 if instantiation of
+ * the unit fails
+ */
+ UnitHandle* core_create_unit(Core& c, UnitFactoryHandle* factory);
+
+ /**
+ * Creates a link.
+ *
+ * \param factory the handle of the link factory from which the link
+ * is instantiated.
+ *
eturns a handle to the new link or 0 if instantiation of the
+ * link fails
+ */
+ LinkHandle* core_create_link(Core& c, LinkFactoryHandle* factory);
+
+ /**
+ * Destroys a unit.
+ *
+ * \param handle the unit handle
+ *
+ *
eturn whether destruction was successful
+ *
+ * error is IN_USE_ERROR if the unit is connected to one or more links, or
+ * if the core is running and id is a sink, or
+ * GENERAL_ERROR if deinstantiate fails
+ */
+ bool core_destroy_unit(Core& c, UnitHandle* handle, CoreError& error);
+
+ /**
+ * Destroys a link.
+ * Also removes all subscriptions on this link (see subscribe_link_value)
+ *
+ * \param handle the unit handle
+ *
+ *
eturn whether destruction was successful
+ *
+ * error is IN_USE_ERROR if the link is connected to one or more units, or
+ * GENERAL_ERROR if deinstantiate fails
+ */
+ bool core_destroy_link(Core& c, LinkHandle* id, CoreError& error);
+
+ /**
+ * Updates the specified units.
+ *
+ * \param sinks The handles of the units that will be updated.
+ * \param time The time at which all units are updated.
+ * Note that this should be the system time in ms as
+ * some units might use it to determine what to do.
+ *
+ *
eturns whether update was successful
+ *
+ * error is INVALID_ARG if one of the sinks does not exist, or
+ * TIME_ERROR if time is less then the time of the last call, or
+ * GENERAL_ERROR if something bad happens
+ */
+ bool core_update(Core& c,
+ const std::list<UnitHandle*>& sinks,
+ double time, CoreError& error);
+
+ /**
+ * Tells a unit from which link a port reads or writes it's data.
+ * Note: all ports have to be attached to a link before update
+ * can be called.
+ *
+ * At most one link may be attached to an output port.
+ * A link may be connected to any number of input ports.
+ *
+ * \param lid the handle the link
+ * \param pid the handle of the port as returned by
+ * UnitHandle::port_handle()
+ *
eturns a handle for the connection between the link and the unit,
+ * or 0 on failure
+ *
+ * error is IN_USE_ERROR if this port already is connected
+ * INVALID_ARG if this link already is connected to an output
+ * TYPE_ERROR if the link factory of pid is not the same
+ * as the factory of lid
+ */
+ ConnectionHandle* core_attach(Core& c, LinkHandle* lid,
+ PortHandle* pid, CoreError& error);
+
+ /**
+ * Removes the connection between a link and a port.
+ * After the call, the connection handle is invalid.
+ *
+ * \param connection the handle of the connection
+ */
+ void core_detach(Core& c, ConnectionHandle* connection);
+
+
+#if 0
+ /**
+ * Creates a subscription on a link.
+ * This means that the value of this link will be returned by
+ * the fetch_subscription() method.
+ *
+ * \param lid the link whose value is of interest
+ * hrows std::invalid_argument if here is already a
+ * subscription on lid
+ */
+ void subscribe_link_value(LinkHandle& lid) throw(std::invalid_argument);
+
+ /**
+ * Removes a subscription from a link.
+ *
+ * \param lid the link whose value is no longer of interest
+ * hrows std::invalid_argument if there is no subscription on lid
+ */
+ void unsubscribe_link_value(LinkHandle& lid) throw(std::invalid_argument);
+
+ /**
+ * Pushes the values of subscribed links onto the stream.
+ * Pushes only those values that have changed since time.
+ *
+ * \param time the time starting from which all changes are sent
+ */
+ void fetch_subscription(double time /*TODO: some kind of stream*/)
+ const throw();
+#endif
+
+ //---------------------------------------------------------------------------
+
}
+
#endif
--- orig/gphxcore/include/linkfactoryhandle.h
+++ mod/gphxcore/include/linkfactoryhandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -23,24 +23,8 @@
#ifndef INCLUDED_LINK_FACTORY_HANDLE_H
#define INCLUDED_LINK_FACTORY_HANDLE_H
-#include <memory>
-#include <string>
-#include <map>
-
namespace core
{
-
- class LinkFactoryHandle
- {
- public:
- virtual ~LinkFactoryHandle();
-
- protected:
- LinkFactoryHandle();
-
- private:
- LinkFactoryHandle(const LinkFactoryHandle&);
- virtual LinkFactoryHandle& operator=(const LinkFactoryHandle&);
- };
+ struct LinkFactoryHandle;
}
#endif
--- orig/gphxcore/include/linkhandle.h
+++ mod/gphxcore/include/linkhandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -27,10 +27,9 @@
namespace core
{
- class LinkHandle
- {
- public:
- virtual ~LinkHandle();
+
+ struct LinkHandle;
+
/**
* Set the value of a link.
*
@@ -40,8 +39,9 @@
* valid for the LinkFactory,
* hrow std::runtime_error if something bad happens
*/
- virtual void set_value(const std::string& value,
- double time) = 0;
+ void linkhandle_set_value(LinkHandle* l,
+ const std::string& value,
+ double time);
/**
* Query and return the serialised value of a link.
@@ -51,10 +51,7 @@
*
eturn the serialised value
* hrows std::runtime_error if something bad happens
*/
- virtual std::string get_value() const = 0;
+ std::string linkhandle_get_value(const LinkHandle* l);
- private:
- LinkHandle& operator=(const LinkHandle&);
- };
}
#endif
--- orig/gphxcore/include/pluginhandle.h
+++ mod/gphxcore/include/pluginhandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -23,42 +23,29 @@
#ifndef INCLUDED_PLUGIN_HANDLE_H
#define INCLUDED_PLUGIN_HANDLE_H
-#include <memory>
#include <list>
#include <string>
namespace core
{
-class LinkFactoryID
-{
- public:
- virtual std::string name() const = 0;
- virtual std::string version() const = 0;
-};
+ struct LinkFactoryID;
-class UnitFactoryID
-{
- public:
- virtual std::string name() const = 0;
- virtual std::string version() const = 0;
-};
+ std::string lfid_name(const LinkFactoryID& lfid);
+ std::string lfid_version(const LinkFactoryID& lfid);
-class PluginHandle
-{
- public:
- virtual ~PluginHandle();
+ struct UnitFactoryID;
+
+ std::string ufid_name(const UnitFactoryID& lfid);
+ std::string ufid_version(const UnitFactoryID& lfid);
+
+ struct PluginHandle;
typedef std::list<LinkFactoryID*> LinkFactoryIDList;
typedef std::list<UnitFactoryID*> UnitFactoryIDList;
- virtual LinkFactoryIDList list_lfs() = 0;
- virtual UnitFactoryIDList list_ufs() = 0;
-
- private:
- /* PluginHandle(const PluginHandle&);*/
- virtual PluginHandle& operator=(const PluginHandle&);
-};
+ LinkFactoryIDList plugin_list_lfs(PluginHandle&);
+ UnitFactoryIDList plugin_list_ufs(PluginHandle&);
}
#endif
--- orig/gphxcore/include/portio.h
+++ mod/gphxcore/include/portio.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
--- orig/gphxcore/include/unitfactoryhandle.h
+++ mod/gphxcore/include/unitfactoryhandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -31,32 +31,21 @@
namespace core
{
-
-class PortID
-{
- public:
typedef std::map<std::string, std::string> PropertyMap;
- virtual PropertyMap spec() const = 0;
- virtual std::string id() const = 0;
- virtual unsigned int index() const = 0;
-
- virtual port_io::IO io() const = 0;
-};
-class UnitFactoryHandle
-{
-public:
- typedef std::map<std::string, std::string> PropertyMap;
+ struct PortID;
- virtual ~UnitFactoryHandle();
+ PropertyMap portid_spec(const PortID*);
+ std::string portid_id(const PortID*);
+ unsigned int portid_index(const PortID*);
+
+ port_io::IO portid_io(const PortID*);
- virtual PropertyMap spec() const = 0;
+ struct UnitFactoryHandle;
- virtual std::vector<PortID*> ports() const = 0;
+ PropertyMap unitfactory_spec(const UnitFactoryHandle*);
- private:
- virtual UnitFactoryHandle& operator=(const UnitFactoryHandle&);
-};
+ std::vector<PortID*> unitfactory_ports(const UnitFactoryHandle*);
}
#endif
--- orig/gphxcore/include/unithandle.h
+++ mod/gphxcore/include/unithandle.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -27,26 +27,14 @@
namespace core
{
- class PortID;
- class PortHandle
- {
- public:
- virtual ~PortHandle() {};
- virtual PortID& id() const = 0;
- };
-
- class UnitFactoryHandle;
- class UnitHandle
- {
- public:
- virtual ~UnitHandle();
-
- virtual UnitFactoryHandle& factory_handle() const = 0;
-
- virtual PortHandle& port_handle(unsigned int index) const = 0;
-
- private:
- UnitHandle& operator=(const UnitHandle&);
- };
+ struct PortID;
+ struct PortHandle;
+ struct UnitHandle;
+ struct UnitFactoryHandle;
+
+ PortID* porthandle_id(const PortHandle*);
+
+ UnitFactoryHandle* unithandle_factory_handle(const UnitHandle*);
+ PortHandle* unithandle_port_handle(const UnitHandle*, unsigned int index);
}
#endif
--- orig/gphxcore/src/Makefile.am
+++ mod/gphxcore/src/Makefile.am
@@ -22,68 +22,13 @@
safe_cast.h \
unithandleimpl.h \
unitfactoryhandleimpl.h \
- logger.h \
- logger.cpp \
- ../interfaces/link.if \
- ../interfaces/unit.if \
- ../interfaces/linkfactory.if \
- ../interfaces/unitfactory.if \
- ../interfaces/logger.if $(BUILT_SOURCES)
-
-BUILT_SOURCES= \
- loggerwrapper.h \
- loggerglue.h \
- linkwrapper.h \
- linkfactorywrapper.h \
- unitwrapper.h \
- unitfactorywrapper.h \
- loggerwrapper.cpp \
- loggerglue.cpp \
- linkwrapper.cpp \
- linkfactorywrapper.cpp \
- unitwrapper.cpp \
- unitfactorywrapper.cpp
-
-loggerwrapper.h: ../interfaces/logger.if
- $(GIDLC) cpp-wrapper-header ../interfaces/logger.if > loggerwrapper.h
-
-loggerwrapper.cpp: ../interfaces/logger.if
- $(GIDLC) cpp-wrapper-code ../interfaces/logger.if > loggerwrapper.cpp
-
-loggerglue.h: ../interfaces/logger.if
- $(GIDLC) cpp-glue-header ../interfaces/logger.if > loggerglue.h
-
-loggerglue.cpp: ../interfaces/logger.if
- $(GIDLC) cpp-glue-code ../interfaces/logger.if > loggerglue.cpp
-
-linkwrapper.h: ../interfaces/link.if
- $(GIDLC) cpp-wrapper-header ../interfaces/link.if > linkwrapper.h
-
-linkwrapper.cpp: ../interfaces/link.if
- $(GIDLC) cpp-wrapper-code ../interfaces/link.if > linkwrapper.cpp
-
-linkfactorywrapper.h: ../interfaces/linkfactory.if
- $(GIDLC) cpp-wrapper-header ../interfaces/linkfactory.if > linkfactorywrapper.h
-
-linkfactorywrapper.cpp: ../interfaces/link.if
- $(GIDLC) cpp-wrapper-code ../interfaces/linkfactory.if > linkfactorywrapper.cpp
-
-
-unitwrapper.h: ../interfaces/unit.if
- $(GIDLC) cpp-wrapper-header ../interfaces/unit.if > unitwrapper.h
-
-unitwrapper.cpp: ../interfaces/unit.if
- $(GIDLC) cpp-wrapper-code ../interfaces/unit.if > unitwrapper.cpp
-
-unitfactorywrapper.h: ../interfaces/unitfactory.if
- $(GIDLC) cpp-wrapper-header ../interfaces/unitfactory.if > unitfactorywrapper.h
-
-unitfactorywrapper.cpp: ../interfaces/unit.if
- $(GIDLC) cpp-wrapper-code ../interfaces/unitfactory.if > unitfactorywrapper.cpp
+ streamlogger.h \
+ streamlogger.cpp \
+ coreexceptions.h
INCLUDES = \
-I @srcdir@/../include \
- -I @top_srcdir@/gphxutils/include
+ -I @top_srcdir@/gphxutils/include \
+ -I @top_srcdir@/gphxsdk/include
-CLEANFILES=$(BUILT_SOURCES)
--- orig/gphxcore/src/connectionhandleimpl.cpp
+++ mod/gphxcore/src/connectionhandleimpl.cpp
@@ -25,16 +25,6 @@
namespace core
{
- ConnectionHandleImpl::ConnectionHandleImpl(LinkHandleImpl& l,
- PortHandleImpl& p)
- : link(l), port(p)
- {
- }
-
- ConnectionHandleImpl::~ConnectionHandleImpl() {}
-
- ConnectionHandle::ConnectionHandle() {}
- ConnectionHandle::~ConnectionHandle() {}
- ConnectionHandle& ConnectionHandle::operator=(const ConnectionHandle&)
- { return *this; }
+ ConnectionHandle::ConnectionHandle(LinkHandle& l, PortHandle& p)
+ : link(l), port(p) {}
}
--- orig/gphxcore/src/connectionhandleimpl.h
+++ mod/gphxcore/src/connectionhandleimpl.h
@@ -27,18 +27,15 @@
namespace core
{
- class LinkHandleImpl;
- class PortHandleImpl;
+ struct LinkHandle;
+ struct PortHandle;
- class ConnectionHandleImpl : public ConnectionHandle
+ struct ConnectionHandle
{
- public:
- ConnectionHandleImpl(LinkHandleImpl& l, PortHandleImpl& p);
+ ConnectionHandle(LinkHandle& l, PortHandle& p);
- virtual ~ConnectionHandleImpl();
-
- LinkHandleImpl& link;
- PortHandleImpl& port;
+ LinkHandle& link;
+ PortHandle& port;
};
}
--- orig/gphxcore/src/core.cpp
+++ mod/gphxcore/src/core.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -27,18 +27,17 @@
#include "core.h"
-#include <cassert>
+#include <memory>
#include <iostream>
-#include <sstream>
+#include <stdexcept>
+#include <cassert>
#include "renderer.h"
#include "plugin.h"
-#include "unitfactorywrapper.h"
-#include "linkfactorywrapper.h"
-#include "unitwrapper.h"
-#include "linkwrapper.h"
+#include "unit.h"
+#include "link.h"
#include "pluginhandleimpl.h"
#include "linkfactoryhandleimpl.h"
@@ -51,25 +50,37 @@
#include "safe_cast.h"
-#include "logger.h"
-#include "loggerwrapper.h"
-#include "loggerglue.h"
+#include "streamlogger.h"
+
+#include "coreexceptions.h"
namespace core
{
+ struct Core
+ {
+ Core::Core()
+ : m_renderer(new Renderer()) {}
+
+ std::auto_ptr<Renderer> m_renderer;
+ //typedef std::list<LinkHandleImpl*> SubscriptionList;
+ //SubscriptionList m_subscriptions;
+ };
+
//-------------------------------------------------------------------------
- Core::Core() throw ()
- : m_renderer(new Renderer())
+
+ Core* core_create()
{
+ return new Core();
}
- Core::~Core()
+ void core_destroy(Core* c)
{
+ delete c;
}
- void Core::get_warnings(WarningList& warnlist) throw()
+ void core_get_warnings(WarningList& /*warnlist*/)
{
// move the queued warnings to the caller
//warnlist.splice(warnlist.end(),warnings);
@@ -77,304 +88,349 @@
//------------------------------------------------------------------------
- PluginHandle& Core::load_plugin(std::auto_ptr<utils::ILibrary>& lib)
- throw(std::invalid_argument, std::runtime_error)
+ PluginHandle* core_load_plugin(Core& c, utils::ILibrary* lib,
+ CoreError& error)
{
- Plugin* p = new Plugin(lib);
+ try
+ {
+ Plugin* p = new Plugin(lib);
+
+ return new PluginHandle(p);
+ }
+ catch (std::invalid_argument&)
+ {
+ error = INVALID_ARG;
+ }
+ catch (std::runtime_error&)
+ {
+ error = GENERAL_ERROR;
+ }
- return *(new PluginHandleImpl(p));
+ return 0;
}
- void Core::unload_plugin(PluginHandle& handle)
- throw(std::runtime_error, core::in_use_error)
+ bool core_unload_plugin(Core& c, PluginHandle* handle, CoreError& error)
{
- PluginHandleImpl* phi = safe_cast<PluginHandleImpl*>(&handle);
-
- if (phi->refcount != 0)
- throw core::in_use_error("Plugin is still in use");
+ if (handle->refcount != 0)
+ {
+ error = IN_USE_ERROR;
+ return false;
+ }
else
- delete phi;
+ {
+ delete handle;
+ return true;
+ }
}
- LinkFactoryHandle& Core::import_lf(LinkFactoryID& id)
- throw(std::runtime_error, std::invalid_argument)
+ LinkFactoryHandle* core_import_lf(Core& c, LinkFactoryID* id,
+ CoreError& error)
{
- LinkFactoryIDImpl* lfi = safe_cast<LinkFactoryIDImpl*>(&id);
-
- if (lfi->imported)
- throw std::invalid_argument("link factory already imported");
+ if (id->imported)
+ {
+ error = IN_USE_ERROR;
+ return 0;
+ }
- PluginHandleImpl* p = lfi->plugin_handle;
+ PluginHandle* p = id->plugin_handle;
try
{
- void** vtable = p->plugin->board(IfaceDescriptor("LinkFactory",
- lfi->name(),
- lfi->version()));
+ void* obj = p->plugin->board(IfaceDescriptor("LinkFactory",
+ id->m_name,
+ id->m_version));
- if (vtable == 0)
- throw std::runtime_error("Vtable was 0");
+ if (obj == 0)
+ {
+ std::cerr << "LinkFactory was 0";
+ error = GENERAL_ERROR;
+ return 0;
+ }
- Logger* log = new Logger();
- LoggerWrapper logger(logger_create_vtable(), log);
- std::string name = lfi->name() + ":" + lfi->version();
- LinkFactoryWrapper* lf = new LinkFactoryWrapper(vtable,
- name.c_str(),
- &logger);
+ gsdk::LinkFactory* lf = reinterpret_cast<gsdk::LinkFactory*>(obj);
assert(lf);
- lf->ownership(true);// makes it destroy the wrapped object when deleted
p->refcount += 1;
- lfi->imported = true;
- return *(new LinkFactoryHandleImpl(lf, *lfi));
+ id->imported = true;
+ return new LinkFactoryHandle(lf, *id, new StreamLogger());
}
catch (std::exception& e)
{
- throw std::runtime_error(std::string("LinkFactory import failed: ")
- + e.what());
+ std::cerr << "LinkFactory import failed: " << e.what() << "
";
+ error = GENERAL_ERROR;
+ return 0;
}
}
- UnitFactoryHandle& Core::import_uf(UnitFactoryID& id)
- throw(std::runtime_error, std::invalid_argument)
+ UnitFactoryHandle* core_import_uf(Core& c, UnitFactoryID* id,
+ CoreError& error)
{
- UnitFactoryIDImpl* ufi = safe_cast<UnitFactoryIDImpl*>(&id);
-
- if (ufi->imported)
- throw std::invalid_argument("unit factory already imported");
+ if (id->imported)
+ {
+ error = IN_USE_ERROR;
+ return 0;
+ }
- PluginHandleImpl* p = ufi->plugin_handle;
+ PluginHandle* p = id->plugin_handle;
try {
- void** vtable = p->plugin->board(IfaceDescriptor("UnitFactory",
- ufi->name(),
- ufi->version()));
+ void* obj = p->plugin->board(IfaceDescriptor("Unit",
+ id->m_name,
+ id->m_version));
- if (vtable == 0)
- throw std::runtime_error("Vtable was 0");
-
+ if (obj == 0)
+ {
+ std::cerr << "UnitFactory was 0
";
+ error = GENERAL_ERROR;
+ return 0;
+ }
- Logger* log = new Logger();
- LoggerWrapper logger(logger_create_vtable(), log);
+ gsdk::Unit* uf = reinterpret_cast<gsdk::Unit*>(obj);
- std::string name = ufi->name() + ":" + ufi->version();
- UnitFactoryWrapper* uf = new UnitFactoryWrapper(vtable,
- name.c_str(),
- &logger);
assert(uf);
- uf->ownership(true); // makes it destroy the wrapped object when deleted
p->refcount += 1;
- ufi->imported = true;
- return *(new UnitFactoryHandleImpl(uf, *ufi));
+ id->imported = true;
+ return new UnitFactoryHandle(uf, *id);
}
catch (std::exception& e)
{
- throw std::runtime_error(std::string("UnitFactory import failed: ")
- + e.what());
+ std::cerr << "UnitFactory import failed: " << e.what() << "
";
+ error = GENERAL_ERROR;
+ return 0;
}
}
- void Core::unimport_lf(LinkFactoryHandle& h)
- throw (core::in_use_error)
+ bool core_unimport_lf(Core& c, LinkFactoryHandle* h, CoreError& error)
{
- LinkFactoryHandleImpl* hi = safe_cast<LinkFactoryHandleImpl*>(&h);
-
- if (hi->refcount != 0)
- throw core::in_use_error("LinkFactory still used by links");
+ if (h->refcount != 0)
+ {
+ error = IN_USE_ERROR;
+ return false;
+ }
- LinkFactoryIDImpl& id = hi->id;
+ LinkFactoryID& id = h->id;
assert(id.imported);
- PluginHandleImpl* p = hi->plugin_handle;
+ PluginHandle* p = h->plugin_handle;
// commit
- p->plugin->unboard(IfaceDescriptor("LinkFactory",id.name(),id.version()),
- hi->lf->vtable());
+ p->plugin->unboard(IfaceDescriptor("LinkFactory",id.m_name,id.m_version),
+ h->lf);
id.imported = false;
p->refcount -= 1;
assert(p->refcount >= 0);
- delete hi;
+ delete h;
+
+ return true;
}
- void Core::unimport_uf(UnitFactoryHandle& h)
- throw (core::in_use_error)
+ bool core_unimport_uf(Core& c, UnitFactoryHandle* h, CoreError& error)
{
- UnitFactoryHandleImpl* hi = safe_cast<UnitFactoryHandleImpl*>(&h);
-
- if (hi->refcount != 0)
- throw core::in_use_error("UnitFactory still used by units");
+ if (h->refcount != 0)
+ {
+ error = IN_USE_ERROR;
+ return false;
+ }
- UnitFactoryIDImpl& id = hi->id;
+ UnitFactoryID& id = h->id;
assert(id.imported);
- PluginHandleImpl* p = hi->plugin_handle;
+ PluginHandle* p = h->plugin_handle;
-
// commit
- p->plugin->unboard(IfaceDescriptor("UnitFactory", id.name(), id.version()),
- hi->uf->vtable());
+ p->plugin->unboard(IfaceDescriptor("UnitFactory", id.m_name, id.m_version),
+ h->uf);
id.imported = false;
p->refcount -= 1;
assert(p->refcount >= 0);
- delete hi;
+ delete h;
}
- UnitHandle& Core::create_unit(UnitFactoryHandle& h)
- throw (std::runtime_error)
+ UnitHandle* core_create_unit(Core& c, UnitFactoryHandle* h)
{
- UnitFactoryHandleImpl* hi = safe_cast<UnitFactoryHandleImpl*>(&h);
-
- UnitFactoryWrapper* uf = hi->uf;
-
- UnitWrapper* unit = 0;
try
{
- unit = uf->create();
-
- // make unit delete the wrapped object in the dtor
- unit->ownership(true);
+ std::auto_ptr<UnitHandle> uh (new UnitHandle(*h->uf, 0, *h));
+ c.m_renderer->addUnitNode(*uh);
- std::auto_ptr<UnitHandleImpl> uh(new UnitHandleImpl(unit, 0, *hi));
- m_renderer->addUnitNode(*uh);
- hi->refcount += 1;
+ h->refcount += 1;
- return *uh.release();
+ return uh.release();
}
- catch(std::exception& e)
+ catch (std::exception& e)
{
- //undo everything and throw
- if (unit)
- delete unit;
- throw e;
+ std::cerr << e.what() << "
";
+ return 0;
}
}
- LinkHandle& Core::create_link(LinkFactoryHandle& h)
- throw (std::runtime_error)
+ LinkHandle* core_create_link(Core& c, LinkFactoryHandle* h)
{
- LinkFactoryHandleImpl* hi = safe_cast<LinkFactoryHandleImpl*>(&h);
+ gsdk::LinkFactory* lf = h->lf;
- LinkFactoryWrapper* lf = hi->lf;
-
- LinkWrapper* link = 0;
try
{
- link = lf->create((int*) malloc, (int*) free);
+ std::auto_ptr<gsdk::Link> link (lf->create(*h->log));
+
+ std::auto_ptr<LinkHandle> lh (new LinkHandle(&*link, 0, *h));
- // make link delete the wrapped object in the dtor
- link->ownership(true);
+ c.m_renderer->addLinkNode(*lh);
- std::auto_ptr<LinkHandleImpl> lh (new LinkHandleImpl(link, 0, *hi));
- m_renderer->addLinkNode(*lh);
- hi->refcount += 1;
+ h->refcount += 1;
+ link.release();
- return *lh.release();
+ return lh.release();
}
catch(std::exception& e)
{
- //undo everything and throw
- if (link)
- delete link;
- throw e;
+ std::cerr << e.what() << "
";
+ return 0;
}
}
- void Core::destroy_unit(UnitHandle& h)
- throw (core::in_use_error, std::runtime_error)
+ bool core_destroy_unit(Core& c, UnitHandle* h, CoreError& error)
{
- UnitHandleImpl* hi = safe_cast<UnitHandleImpl*>(&h);
+ try
+ {
+ // tell the renderer, could throw
+ c.m_renderer->delUnitNode(*h);
- // tell the renderer, could throw
- m_renderer->delUnitNode(*hi);
+ // decrease refcount of UnitFactory
+ h->unit_factory.refcount -= 1;
+ assert(h->unit_factory.refcount >= 0);
- // decrease refcount of UnitFactory
- hi->unit_factory.refcount -= 1;
- assert(hi->unit_factory.refcount >= 0);
+ delete h;
+ return true;
+ }
+ catch (core::in_use_error& e)
+ {
+ std::cerr << e.what() << "
";
+ error = IN_USE_ERROR;
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << e.what() << "
";
+ error = GENERAL_ERROR;
+ }
- delete hi;
+ return false;
}
- void Core::destroy_link(LinkHandle& h)
- throw (core::in_use_error, std::runtime_error)
+ bool core_destroy_link(Core& c, LinkHandle* h, CoreError& error)
{
- LinkHandleImpl* hi = safe_cast<LinkHandleImpl*>(&h);
+ try
+ {
+ // tell the renderer, could throw
+ c.m_renderer->delLinkNode(*h);
- // tell the renderer, could throw
- m_renderer->delLinkNode(*hi);
+ // decrease refcount of LinkFactory
+ h->link_factory.refcount -= 1;
+ assert(h->link_factory.refcount >= 0);
- // decrease refcount of LinkFactory
- hi->link_factory.refcount -= 1;
- assert(hi->link_factory.refcount >= 0);
+ delete h;
+ return true;
+ }
+ catch (core::in_use_error& e)
+ {
+ std::cerr << e.what() << "
";
+ error = IN_USE_ERROR;
+ }
+ catch (std::runtime_error& e)
+ {
+ std::cerr << e.what() << "
";
+ error = GENERAL_ERROR;
+ }
- delete hi;
+ return false;
}
- void Core::update(const std::list<UnitHandle*>& sinks, double time)
- throw (std::runtime_error, std::invalid_argument)
+ bool core_update(Core& c, const std::list<UnitHandle*>& sinks, double time,
+ CoreError& error)
{
- // create a list of UnitNode pointer out of sink
- std::list<UnitHandleImpl*> sink_nodes;
- for (std::list<UnitHandle*>::const_iterator it = sinks.begin();
- it != sinks.end(); ++it)
+ try
{
- UnitHandleImpl* uhi = safe_cast<UnitHandleImpl*>(*it);
- sink_nodes.push_back(uhi);
- }
+ // pass this to the renderer
+ c.m_renderer->update(sinks.begin(),
+ sinks.end(),
+ time);
- // pass this to the renderer
- m_renderer->update(sink_nodes.begin(),
- sink_nodes.end(),
- time);
+ return true;
+ }
+ catch (std::invalid_argument&)
+ {
+ error = INVALID_ARG;
+ return false;
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << e.what() << "
";
+ error = GENERAL_ERROR;
+ return false;
+ }
}
- ConnectionHandle& Core::attach(LinkHandle& lh, PortHandle& ph)
- throw (std::domain_error, std::invalid_argument, core::in_use_error)
+ ConnectionHandle* core_attach(Core& c, LinkHandle* lh, PortHandle* ph,
+ CoreError& error)
{
- LinkHandleImpl* lhi = safe_cast<LinkHandleImpl*>(&lh);
- PortHandleImpl* phi = safe_cast<PortHandleImpl*>(&ph);
-
- UnitHandleImpl& uhi = phi->unit_handle;
+ UnitHandle& uh = ph->unit_handle;
- LinkWrapper* link = lhi->link;
- UnitWrapper* unit = uhi.unit;
+ gsdk::Link* link = lh->link;
+ gsdk::Unit* unit = &uh.unit;
// check wether the LinkFactory of the link and the port are the same
- const LinkFactoryIDImpl& lfid = lhi->link_factory.id;
- std::string factory_name = lfid.name();
+ const LinkFactoryID& lfid = lh->link_factory.id;
+ std::string factory_name = lfid.m_name;
//TODO: it is a hack to just strip the "Factory" off the name
const std::string lf_id = factory_name.substr(0, factory_name.length()-7)
- + ":" + lfid.version();
- if (lf_id != phi->m_id.type())
+ + ":" + lfid.m_version;
+ if (lf_id != ph->m_id.type())
{
- std::ostringstream os;
- os << "Link and Port have different link-type: '" << lf_id
- << "' cannot connect to '" << phi->id().type() << "'";
- throw std::domain_error(os.str().c_str());
+ std::cerr << "Link and Port have different link-type: '" << lf_id
+ << "' cannot connect to '" << ph->id().type() << "'";
+
+ error = TYPE_ERROR;
+ return 0;
}
- ConnectionHandleImpl& c = m_renderer->attach(*lhi, *phi);
+ try
+ {
+ ConnectionHandle& co = c.m_renderer->attach(*lh, *ph);
+ // unit->set_port(phi->id().index(), link);
+ return &co;
+ }
+ catch (core::in_use_error&)
+ {
+ error = IN_USE_ERROR;
+ }
+ catch (std::invalid_argument&)
+ {
+ error = INVALID_ARG;
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << e.what() << "
";
+ error = GENERAL_ERROR;
+ }
- unit->set_port(phi->id().index(), link);
- return c;
+ return 0;
}
- void Core::detach(ConnectionHandle& ch) throw ()
+ void core_detach(Core& c, ConnectionHandle* ch)
{
- ConnectionHandleImpl* chi = safe_cast<ConnectionHandleImpl*>(&ch);
-
// could throw?
- m_renderer->detach(*chi);
+ c.m_renderer->detach(*ch);
}
- void Core::subscribe_link_value(LinkHandle& lid) throw(std::invalid_argument)
+#if 0
+ void core_subscribe_link_value(LinkHandle& lid) throw(std::invalid_argument)
{
- LinkHandleImpl* lhi = safe_cast<LinkHandleImpl*>(&lid);
+ LinkHandle* lhi = safe_cast<LinkHandle*>(&lid);
if (std::find(m_subscriptions.begin(),
m_subscriptions.end(),
@@ -387,7 +443,7 @@
void Core::unsubscribe_link_value(LinkHandle& lid)
throw(std::invalid_argument)
{
- LinkHandleImpl* lhi = safe_cast<LinkHandleImpl*>(&lid);
+ LinkHandle* lhi = safe_cast<LinkHandle*>(&lid);
SubscriptionList::iterator
it = std::find(m_subscriptions.begin(),
@@ -405,7 +461,7 @@
for (SubscriptionList::const_iterator it = m_subscriptions.begin();
it != m_subscriptions.end(); ++it)
{
- LinkHandleImpl* lhi = *it;
+ LinkHandle* lhi = *it;
//Link* l = lhi->link;
if (lhi->timestamp() < time)
continue;
@@ -414,6 +470,7 @@
}
}
+#endif
}
//----------------------------------------------------------------------------
--- orig/gphxcore/src/linkfactoryhandleimpl.cpp
+++ mod/gphxcore/src/linkfactoryhandleimpl.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -23,24 +23,20 @@
#include "linkfactoryhandleimpl.h"
#include "pluginhandleimpl.h"
-#include "linkfactorywrapper.h"
+
+#include "link.h"
namespace core
{
- LinkFactoryHandleImpl::LinkFactoryHandleImpl(LinkFactoryWrapper* l,
- LinkFactoryIDImpl& id_)
+ LinkFactoryHandle::LinkFactoryHandle(gsdk::LinkFactory* l,
+ LinkFactoryID& id_,
+ gsdk::Logger* log)
: refcount(0), lf(l), plugin_handle(id_.plugin_handle),
- id(id_) {}
+ id(id_), log(log) {}
- LinkFactoryHandleImpl::~LinkFactoryHandleImpl()
+ LinkFactoryHandle::~LinkFactoryHandle()
{
- delete lf;
- }
-
- LinkFactoryHandle::LinkFactoryHandle() {}
- LinkFactoryHandle::~LinkFactoryHandle() {}
- LinkFactoryHandle& LinkFactoryHandle::operator=(const LinkFactoryHandle&)
- { return *this; }
-
+ delete log;
+ }
}
--- orig/gphxcore/src/linkfactoryhandleimpl.h
+++ mod/gphxcore/src/linkfactoryhandleimpl.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -25,26 +25,30 @@
#include "linkfactoryhandle.h"
-class LinkFactoryWrapper;
+namespace gsdk
+{
+ class LinkFactory;
+ class Logger;
+}
namespace core
{
- class LinkFactoryIDImpl;
- class PluginHandleImpl;
+ struct LinkFactoryID;
+ struct PluginHandle;
- class LinkFactoryHandleImpl : public LinkFactoryHandle
+ struct LinkFactoryHandle
{
- public:
- LinkFactoryHandleImpl(LinkFactoryWrapper* l,
- LinkFactoryIDImpl& id_);
+ LinkFactoryHandle(gsdk::LinkFactory* l,
+ LinkFactoryID& id_,
+ gsdk::Logger* log);
- virtual ~LinkFactoryHandleImpl();
+ ~LinkFactoryHandle();
int refcount;
- LinkFactoryWrapper* lf;
- PluginHandleImpl* plugin_handle;
- LinkFactoryIDImpl& id;
-
+ gsdk::LinkFactory* lf;
+ PluginHandle* plugin_handle;
+ LinkFactoryID& id;
+ gsdk::Logger* log;
};
}
--- orig/gphxcore/src/linkhandleimpl.cpp
+++ mod/gphxcore/src/linkhandleimpl.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -21,7 +21,9 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
#include "linkhandleimpl.h"
-#include "linkwrapper.h"
+#include "link.h"
+
+#include <vector>
namespace core
{
@@ -34,39 +36,57 @@
//------------------------------------------------------------------------
- LinkHandleImpl::LinkHandleImpl(LinkWrapper* u,
- LinkNode* n,
- LinkFactoryHandleImpl& lfi)
+ LinkHandle::LinkHandle(gsdk::Link* u,
+ LinkNode* n,
+ LinkFactoryHandle& lfi)
: link(u), node(n), link_factory(lfi), m_timestamp(0) {}
- LinkHandleImpl::~LinkHandleImpl()
+ LinkHandle::~LinkHandle()
{
- delete link;
delete node;
}
- void LinkHandleImpl::set_value(const std::string& value, double time)
+ void LinkHandle::set_value(const std::string& value, double time)
{
- link->deserialize(value.c_str());
+ link->deserialize_utf8(value.c_str(), value.length());
this->set_timestamp(time);
}
- std::string LinkHandleImpl::get_value() const
+ std::string LinkHandle::get_value() const
{
- return link->serialize();
+ int size = link->serialize_utf8(0, 0);
+
+ std::vector<char> buf(size); //TODO: optimieren
+
+ int s = link->serialize_utf8(&buf[0], size);
+
+ if (s <= 0 || s > size)
+ return "";
+ else
+ return std::string(&buf[0], s);
}
- double LinkHandleImpl::timestamp() const
+ double LinkHandle::timestamp() const
{
return m_timestamp;
}
- void LinkHandleImpl::set_timestamp(double t)
+ void LinkHandle::set_timestamp(double t)
{
m_timestamp = t;
}
- LinkHandle::~LinkHandle() {}
- LinkHandle& LinkHandle::operator=(const LinkHandle&)
- { return *this; }
+ void linkhandle_set_value(LinkHandle* l,
+ const std::string& value,
+ double time)
+ {
+ l->set_value(value, time);
+ }
+
+
+ std::string linkhandle_get_value(const LinkHandle* l)
+ {
+ return l->get_value();
+ }
+
}
--- orig/gphxcore/src/linkhandleimpl.h
+++ mod/gphxcore/src/linkhandleimpl.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -27,12 +27,15 @@
#include "linkhandle.h"
-class LinkWrapper;
+namespace gsdk
+{
+ class Link;
+}
namespace core
{
- class LinkFactoryHandleImpl;
- class ConnectionHandleImpl;
+ class LinkFactoryHandle;
+ class ConnectionHandle;
//------------------------------------------------------------------
// needed by the renderer
@@ -41,18 +44,17 @@
{
LinkNode();
- std::list<ConnectionHandleImpl*> adj; // connection to inputs
- ConnectionHandleImpl* out; // connection to output
+ std::list<ConnectionHandle*> adj; // connection to inputs
+ ConnectionHandle* out; // connection to output
};
//------------------------------------------------------------------
- class LinkHandleImpl : public LinkHandle
+ struct LinkHandle
{
- public:
- LinkHandleImpl(LinkWrapper* u, LinkNode* n, LinkFactoryHandleImpl& lfi);
+ LinkHandle(gsdk::Link* u, LinkNode* n, LinkFactoryHandle& lfi);
- virtual ~LinkHandleImpl();
+ ~LinkHandle();
void set_value(const std::string& value, double time);
@@ -61,9 +63,9 @@
double timestamp() const;
void set_timestamp(double t);
- LinkWrapper* link;
+ gsdk::Link* link;
LinkNode* node;
- LinkFactoryHandleImpl& link_factory;
+ LinkFactoryHandle& link_factory;
private:
double m_timestamp;
--- orig/gphxcore/src/plugin.cpp
+++ mod/gphxcore/src/plugin.cpp
@@ -26,8 +26,6 @@
#include <sstream>
#include <iostream>
-#include "unitfactorywrapper.h"
-#include "linkfactorywrapper.h"
#include "ilibrary.h"
#include "stringtokenizer.h"
@@ -70,8 +68,8 @@
struct PluginFunctions
{
typedef const char* (*dock_t)(void);
- typedef void** (*board_t)(const char*);
- typedef void (*unboard_t)(const char*, void**);
+ typedef void* (*board_t)(const char*);
+ typedef void (*unboard_t)(const char*, void*);
typedef void (*undock_t)(void);
dock_t dock;
@@ -84,7 +82,7 @@
};
- Plugin::Plugin(std::auto_ptr<utils::ILibrary>& so)
+ Plugin::Plugin(utils::ILibrary* so)
: m_so(so), m_funs(new PluginFunctions())
{
m_funs->dock
@@ -139,7 +137,7 @@
return m_exported_ifaces;
}
- void** Plugin::board(const IfaceDescriptor& id)
+ void* Plugin::board(const IfaceDescriptor& id)
{
if (std::find(m_exported_ifaces.begin(),
m_exported_ifaces.end(), id) == m_exported_ifaces.end())
@@ -147,15 +145,15 @@
throw std::invalid_argument("Invalid Iface Description");
}
- void** vtable = m_funs->board((id.name() + ":" + id.version()).c_str());
- if (vtable == 0)
+ void* obj = m_funs->board((id.name() + ":" + id.version()).c_str());
+ if (obj == 0)
throw std::runtime_error("Could not board Interface");
- return vtable;
+ return obj;
}
- void Plugin::unboard(const IfaceDescriptor& id, void** vtable)
+ void Plugin::unboard(const IfaceDescriptor& id, void* obj)
{
- m_funs->unboard((id.name() + ":" + id.version()).c_str(), vtable);
+ m_funs->unboard((id.name() + ":" + id.version()).c_str(), obj);
}
}
--- orig/gphxcore/src/plugin.h
+++ mod/gphxcore/src/plugin.h
@@ -68,7 +68,7 @@
public:
typedef std::list<IfaceDescriptor> IfaceDescriptorList;
- Plugin(std::auto_ptr<utils::ILibrary>& so);
+ Plugin(utils::ILibrary* so);
virtual ~Plugin();
/**
@@ -89,13 +89,13 @@
* hrows std::invalid_argument if no such type exists
* hrows std::runtime_error if boarding fails
*/
- virtual void** board(const IfaceDescriptor& id);
+ virtual void* board(const IfaceDescriptor& id);
/**
* No error checking - you better make sure that you
* unboard every vtable exactly once.
*/
- virtual void unboard(const IfaceDescriptor& id, void** vtable);
+ virtual void unboard(const IfaceDescriptor& id, void* obj);
private:
std::auto_ptr<utils::ILibrary> m_so;
--- orig/gphxcore/src/pluginhandleimpl.cpp
+++ mod/gphxcore/src/pluginhandleimpl.cpp
@@ -1,24 +1,24 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
- Georg Seidel <[email protected]>
- Martin Bayer <[email protected]>
- Phillip Promesberger <[email protected]>
+ Georg Seidel <[email protected]>
+ Martin Bayer <[email protected]>
+ Phillip Promesberger <[email protected]>
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
#include "pluginhandleimpl.h"
@@ -28,48 +28,44 @@
{
//-------------------------------------------------------------------------
- class PluginHandleImpl;
-
- LinkFactoryIDImpl::LinkFactoryIDImpl(const std::string& name,
- const std::string& version,
- PluginHandleImpl* p)
+ LinkFactoryID::LinkFactoryID(const std::string& name,
+ const std::string& version,
+ PluginHandle* p)
: plugin_handle(p), imported(false),
m_name(name), m_version(version) {}
- LinkFactoryIDImpl::~LinkFactoryIDImpl() {}
- std::string LinkFactoryIDImpl::name() const
+ std::string lfid_name(const LinkFactoryID& lfid)
{
- return m_name;
+ return lfid.m_name;
}
- std::string LinkFactoryIDImpl::version() const
+ std::string lfid_version(const LinkFactoryID& lfid)
{
- return m_version;
+ return lfid.m_version;
}
//-------------------------------------------------------------------------
- UnitFactoryIDImpl::UnitFactoryIDImpl(const std::string& name,
- const std::string& version,
- PluginHandleImpl* p)
+ UnitFactoryID::UnitFactoryID(const std::string& name,
+ const std::string& version,
+ PluginHandle* p)
: plugin_handle(p), imported(false), m_name(name), m_version(version) {}
- UnitFactoryIDImpl::~UnitFactoryIDImpl() {};
- std::string UnitFactoryIDImpl::name() const
+ std::string ufid_name(const UnitFactoryID& ufid)
{
- return m_name;
+ return ufid.m_name;
}
- std::string UnitFactoryIDImpl::version() const
+ std::string ufid_version(const UnitFactoryID& ufid)
{
- return m_version;
+ return ufid.m_version;
}
//-------------------------------------------------------------------------
- PluginHandleImpl::PluginHandleImpl(Plugin* p)
+ PluginHandle::PluginHandle(Plugin* p)
: plugin(p), refcount(0)
{
Plugin::IfaceDescriptorList ifaces = p->list_exports();
@@ -77,17 +73,17 @@
for (Plugin::IfaceDescriptorList::const_iterator it = ifaces.begin();
it != ifaces.end(); ++it)
{
- if (it->type() == "UnitFactory")
- m_ufs.push_back(new UnitFactoryIDImpl(it->name(),
- it->version(), this));
+ if (it->type() == "Unit")
+ m_ufs.push_back(new UnitFactoryID(it->name(),
+ it->version(), this));
else if (it->type() == "LinkFactory")
- m_lfs.push_back(new LinkFactoryIDImpl(it->name(),
- it->version(), this));
+ m_lfs.push_back(new LinkFactoryID(it->name(),
+ it->version(), this));
//TODO: is it ok to simply ignore the other exported types?
}
}
- PluginHandleImpl::~PluginHandleImpl()
+ PluginHandle::~PluginHandle()
{
for (LinkFactoryIDList::const_iterator it = m_lfs.begin();
it != m_lfs.end(); ++it)
@@ -103,17 +99,14 @@
delete plugin;
}
- PluginHandleImpl::LinkFactoryIDList PluginHandleImpl::list_lfs()
+ LinkFactoryIDList plugin_list_lfs(PluginHandle& p)
{
- return m_lfs;
+ return p.m_lfs;
}
- PluginHandleImpl::UnitFactoryIDList PluginHandleImpl::list_ufs()
+ UnitFactoryIDList plugin_list_ufs(PluginHandle& p)
{
- return m_ufs;
+ return p.m_ufs;
}
- PluginHandle::~PluginHandle() {}
- PluginHandle& PluginHandle::operator=(const PluginHandle&)
- { return *this; }
}
--- orig/gphxcore/src/pluginhandleimpl.h
+++ mod/gphxcore/src/pluginhandleimpl.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -30,45 +30,30 @@
//-------------------------------------------------------------------------
- class PluginHandleImpl;
- class LinkFactoryIDImpl : public LinkFactoryID
+ struct LinkFactoryID
{
- public:
- LinkFactoryIDImpl(const std::string& name,
- const std::string& version,
- PluginHandleImpl* p);
-
- virtual ~LinkFactoryIDImpl();
-
- std::string name() const;
-
- std::string version() const;
-
- PluginHandleImpl* plugin_handle;
+ LinkFactoryID(const std::string& name,
+ const std::string& version,
+ PluginHandle* p);
+
+ PluginHandle* plugin_handle;
bool imported;
- private:
std::string m_name;
std::string m_version;
};
//-------------------------------------------------------------------------
- class UnitFactoryIDImpl : public UnitFactoryID
+ struct UnitFactoryID
{
- public:
- UnitFactoryIDImpl(const std::string& name,
- const std::string& version,
- PluginHandleImpl* p);
+ UnitFactoryID(const std::string& name,
+ const std::string& version,
+ PluginHandle* p);
- virtual ~UnitFactoryIDImpl();
-
- std::string name() const;
- std::string version() const;
-
- PluginHandleImpl* plugin_handle;
+ PluginHandle* plugin_handle;
bool imported;
- private:
+
std::string m_name;
std::string m_version;
};
@@ -76,23 +61,16 @@
//-------------------------------------------------------------------------
class Plugin;
- class PluginHandleImpl : public PluginHandle
+ struct PluginHandle
{
public:
- PluginHandleImpl(Plugin* p);
-
- virtual ~PluginHandleImpl();
-
- // from the pluginhandle iface
-
- LinkFactoryIDList list_lfs();
- UnitFactoryIDList list_ufs();
+ PluginHandle(Plugin* p);
+ virtual ~PluginHandle();
Plugin* plugin;
int refcount;
- private:
LinkFactoryIDList m_lfs;
UnitFactoryIDList m_ufs;
};
--- orig/gphxcore/src/renderer.cpp
+++ mod/gphxcore/src/renderer.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -29,9 +29,8 @@
#include <iostream>
#include "coreexceptions.h"
-#include "unitfactorywrapper.h"
-#include "unitwrapper.h"
-#include "linkwrapper.h"
+#include "unit.h"
+#include "link.h"
#include "unithandleimpl.h"
#include "linkhandleimpl.h"
@@ -39,6 +38,8 @@
#include "safe_cast.h"
+#include "streamlogger.h"
+
namespace core
{
@@ -53,7 +54,7 @@
{
}
- void Renderer::addUnitNode(UnitHandleImpl& u)
+ void Renderer::addUnitNode(UnitHandle& u)
{
assert(u.node == 0);
@@ -61,13 +62,13 @@
}
- void Renderer::delUnitNode(UnitHandleImpl& uhandle)
+ void Renderer::delUnitNode(UnitHandle& uhandle)
{
UnitNode* n = uhandle.node;
assert(n);
- std::vector<ConnectionHandleImpl*>& pv = n->adj;
- for (std::vector<ConnectionHandleImpl*>::const_iterator it = pv.begin();
+ std::vector<ConnectionHandle*>& pv = n->adj;
+ for (std::vector<ConnectionHandle*>::const_iterator it = pv.begin();
it != pv.end(); ++it)
{
if (*it != 0)
@@ -78,14 +79,14 @@
uhandle.node = 0;
}
- void Renderer::addLinkNode(LinkHandleImpl& lh)
+ void Renderer::addLinkNode(LinkHandle& lh)
{
assert(lh.node == 0);
lh.node = new LinkNode();
}
- void Renderer::delLinkNode(LinkHandleImpl& lh)
+ void Renderer::delLinkNode(LinkHandle& lh)
{
LinkNode* ln = lh.node;
if (!ln->adj.empty() || ln->out != 0)
@@ -96,10 +97,10 @@
}
- ConnectionHandleImpl& Renderer::attach(LinkHandleImpl& link,
- PortHandleImpl& port)
+ ConnectionHandle& Renderer::attach(LinkHandle& link,
+ PortHandle& port)
{
- UnitHandleImpl& unith = port.unit_handle;
+ UnitHandle& unith = port.unit_handle;
PortID& pid = port.id();
assert(unith.node);
UnitNode& n = *unith.node;
@@ -116,7 +117,7 @@
if (pid.io() == port_io::OUT && l.out != 0)
throw std::invalid_argument("Already connected to one output");
- ConnectionHandleImpl* c = new ConnectionHandleImpl(link, port);
+ ConnectionHandle* c = new ConnectionHandle(link, port);
if (pid.io() == port_io::OUT)
l.out = c;
@@ -127,7 +128,7 @@
return *c;
}
- void Renderer::detach(ConnectionHandleImpl& c)
+ void Renderer::detach(ConnectionHandle& c)
{
UnitNode& un = *c.port.unit_handle.node;
LinkNode& ln = *c.link.node;
@@ -156,26 +157,26 @@
//------------------------------------------------------------------------
- bool Renderer::update_input(PortHandleImpl& port,
+ bool Renderer::update_input(PortHandle& port,
double time)
{
bool input_changed = false;
- UnitHandleImpl& uh = port.unit_handle;
+ UnitHandle& uh = port.unit_handle;
unsigned int port_index = port.id().index();
assert(uh.node);
UnitNode& node = *uh.node;
// get all nodes that are connected to port i
- ConnectionHandleImpl* c = node.adj[port_index];
+ ConnectionHandle* c = node.adj[port_index];
assert(c);
if (c->link.node->out) // is the link connected to an output node?
{
// yes, indeed!
- UnitHandleImpl& n2 = c->link.node->out->port.unit_handle;
+ UnitHandle& n2 = c->link.node->out->port.unit_handle;
bool changed = update(n2, time);
input_changed = input_changed || changed;
@@ -191,15 +192,15 @@
return input_changed;
}
- static void set_link_timestamp(PortHandleImpl& port,
+ static void set_link_timestamp(PortHandle& port,
double time)
{
unsigned int port_index = port.id().index();
- UnitHandleImpl& uh = port.unit_handle;
+ UnitHandle& uh = port.unit_handle;
UnitNode& node = *uh.node;
assert(port_index < node.adj.size());
- ConnectionHandleImpl* c = node.adj[port_index];
+ ConnectionHandle* c = node.adj[port_index];
assert(c);
c->link.set_timestamp(time);
}
@@ -215,6 +216,39 @@
return true;
}
+ static void update_unit(double start_time, double end_time,
+ UnitHandle& uh)
+ {
+ gsdk::Unit& unit = uh.unit;
+ std::vector<const gsdk::Link*> ins;
+ std::vector<gsdk::Link*> outs;
+
+ for (unsigned int i = 0; i < uh.num_ports(); ++i)
+ {
+ PortHandle* port
+ = safe_cast<PortHandle*>(&uh.port_handle(i));
+
+ unsigned int port_index = port->id().index();
+
+ assert(uh.node);
+ UnitNode& node = *uh.node;
+
+ ConnectionHandle* c = node.adj[port_index];
+ assert(c);
+
+ gsdk::Link* l = c->link.link;
+
+ if (port->id().io() == port_io::OUT)
+ outs.push_back(l);
+ else
+ ins.push_back(l);
+ }
+
+ StreamLogger* l = new StreamLogger();
+ unit.update(&ins[0], &outs[0], *l);
+ delete l;
+ }
+
/**
*
* Simple recursive implementation to update one node.
@@ -224,12 +258,12 @@
*
*
*/
- bool Renderer::update(UnitHandleImpl& uh, double time)
+ bool Renderer::update(UnitHandle& uh, double time)
{
assert(uh.node);
UnitNode& node = *uh.node;
- UnitWrapper& unit = *uh.unit;
+ gsdk::Unit& unit = uh.unit;
//TODO: default outputs?
if (!ports_connected(node))
@@ -242,8 +276,8 @@
for (unsigned int i = 0; i < uh.num_ports(); ++i)
{
- PortHandleImpl* port
- = safe_cast<PortHandleImpl*>(&uh.port_handle(i));
+ PortHandle* port
+ = safe_cast<PortHandle*>(&uh.port_handle(i));
if (port->id().io() == port_io::OUT)
set_link_timestamp(*port, time);
}
@@ -266,46 +300,41 @@
// go through all input ports that are strong dependencies
for (unsigned int i = 0; i < uh.num_ports(); ++i)
{
- PortHandleImpl& port
- = *safe_cast<PortHandleImpl*>(&uh.port_handle(i));
- PortIDImpl& pid = port.id();
- if (pid.io() != port_io::IN || !pid.strong_dep())
+ PortHandle& port
+ = *safe_cast<PortHandle*>(&uh.port_handle(i));
+ PortID& pid = port.id();
+ if (pid.io() != port_io::IN)
continue;
bool changed = update_input(port, time);
input_changed = input_changed || changed;
}
- int *neededChildren;
- unit.strong_deps_done(&neededChildren);
-
// go through all needed children
for (unsigned int i = 0; i < uh.num_ports(); ++i)
{
- PortHandleImpl& port
- = *safe_cast<PortHandleImpl*>(&uh.port_handle(i));
- PortIDImpl& pid = port.id();
- if (neededChildren[i] == 0 || pid.io() != port_io::IN ||
- pid.strong_dep())
+ PortHandle& port
+ = *safe_cast<PortHandle*>(&uh.port_handle(i));
+ PortID& pid = port.id();
+ if (pid.io() != port_io::IN)
continue;
bool changed = update_input(port, time);
input_changed = input_changed || changed;
}
- int* patch_layout;
- if (input_changed == true || !uh.unit_factory.deterministic())
- output_changed = unit.update(time, &patch_layout);
+ if (input_changed == true)
+ update_unit(time, time+(1/25.), uh); //TODO
node.timestamp = time; // mark as done
- node.output_changed = output_changed;
+ node.output_changed = true; //TODO
// set timestamp of output links
for (unsigned int i = 0; i < uh.num_ports(); ++i)
{
- PortHandleImpl&
- port = *safe_cast<PortHandleImpl*>(&uh.port_handle(i));
- PortIDImpl& pid = port.id();
+ PortHandle&
+ port = *safe_cast<PortHandle*>(&uh.port_handle(i));
+ PortID& pid = port.id();
if (pid.io() != port_io::OUT)
continue;
--- orig/gphxcore/src/renderer.h
+++ mod/gphxcore/src/renderer.h
@@ -30,10 +30,10 @@
namespace core
{
- class ConnectionHandleImpl;
- class UnitHandleImpl;
- class LinkHandleImpl;
- class PortHandleImpl;
+ class ConnectionHandle;
+ class UnitHandle;
+ class LinkHandle;
+ class PortHandle;
/**
*
@@ -56,7 +56,7 @@
class Renderer
{
public:
- typedef std::list<UnitHandleImpl*>::const_iterator unit_iterator;
+ typedef std::list<UnitHandle*>::const_iterator unit_iterator;
Renderer();
~Renderer();
@@ -72,7 +72,7 @@
*
* \param u the Unit to be added
*/
- void addUnitNode(UnitHandleImpl& u);
+ void addUnitNode(UnitHandle& u);
/**
* Removes n from the graph
@@ -85,7 +85,7 @@
*
* hrows core::in_use_error if n is still attached to a link
*/
- void delUnitNode(UnitHandleImpl& n);
+ void delUnitNode(UnitHandle& n);
/**
@@ -102,7 +102,7 @@
* \param l the Link to be added
*
eturns a LinkNode object representing u in the graph
*/
- void addLinkNode(LinkHandleImpl& l);
+ void addLinkNode(LinkHandle& l);
/**
* Removes n from the graph
@@ -115,7 +115,7 @@
*
* hrows core::in_use_error if n is still attached to a node
*/
- void delLinkNode(LinkHandleImpl& n);
+ void delLinkNode(LinkHandle& n);
/**
* Tells the renderer to attach the Link l to a certain port
@@ -133,14 +133,14 @@
* an output
*
*/
- ConnectionHandleImpl& attach(LinkHandleImpl& l, PortHandleImpl& p);
+ ConnectionHandle& attach(LinkHandle& l, PortHandle& p);
/**
* Removes a connection again.
* No error checking here, be sure to remove each connection exactly once.
* \param c the connection that will be removed
*/
- void detach(ConnectionHandleImpl& c);
+ void detach(ConnectionHandle& c);
/**
* Updates the output ports of several units.
@@ -163,8 +163,8 @@
// maps the inputs to their dependencys
// std::map<std::pair<Module*,unsigned int>, Module* > dependencys;
- bool update_input(PortHandleImpl& port, double time);
- bool update(UnitHandleImpl&, double);
+ bool update_input(PortHandle& port, double time);
+ bool update(UnitHandle&, double);
Renderer(const Renderer&); // not implemented
Renderer& operator=(const Renderer&); // not implemented
--- orig/gphxcore/src/logger.cpp
+++ mod/gphxcore/src/streamlogger.cpp
@@ -1,8 +1,30 @@
-#include "logger.h"
+/* This source file is a part of the GePhex Project.
+
+ Copyright (C) 2001-2003
+
+ Georg Seidel <[email protected]>
+ Martin Bayer <[email protected]>
+ Phillip Promesberger <[email protected]>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
+
+#include "streamlogger.h"
#include <iostream>
-void Logger::log(int level, const char* msg)
+void StreamLogger::operator()(log_level_t level, const char* msg)
{
std::cout << "Level = " << level << " - msg = " << msg << "
";
}
--- orig/gphxcore/src/logger.h
+++ mod/gphxcore/src/streamlogger.h
@@ -1,9 +1,33 @@
-#ifndef INCLUDED_LOGGER_H
-#define INCLUDED_LOGGER_H
+/* This source file is a part of the GePhex Project.
-class Logger
+ Copyright (C) 2001-2005
+
+ Georg Seidel <[email protected]>
+ Martin Bayer <[email protected]>
+ Phillip Promesberger <[email protected]>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/
+
+#ifndef INCLUDED_STREAM_LOGGER_H
+#define INCLUDED_STREAM_LOGGER_H
+
+#include "logger.h"
+
+class StreamLogger : public gsdk::Logger
{
public:
- void log(int level, const char* msg);
+ void operator()(log_level_t level, const char* msg);
};
#endif
--- orig/gphxcore/src/unitfactoryhandleimpl.cpp
+++ mod/gphxcore/src/unitfactoryhandleimpl.cpp
@@ -26,7 +26,7 @@
#include <sstream>
#include "pluginhandleimpl.h"
-#include "unitfactorywrapper.h"
+#include "unit.h"
#include "stringtokenizer.h"
#include "structreader.h"
@@ -35,59 +35,62 @@
{
//-------------------------------------------------------------------------
- PortIDImpl::PortIDImpl(UnitFactoryHandleImpl& uhi,
+ PortID::PortID(UnitFactoryHandle& uhi,
const PropertyMap& spec,
const std::string& id,
const std::string& type,
unsigned int index,
- port_io::IO io,
- bool strong_dep)
+ port_io::IO io)
: m_unit_factory_handle(uhi), m_type(type), m_spec(spec),
m_index(index), m_id(id),
- m_io(io), m_strong_dep(strong_dep)
+ m_io(io)
{
}
- PortIDImpl::~PortIDImpl() {}
- PortIDImpl::PropertyMap PortIDImpl::spec() const
+ PropertyMap PortID::spec() const
{
return m_spec;
}
- std::string PortIDImpl::id() const
+ std::string PortID::id() const
{
return m_id;
}
- unsigned int PortIDImpl::index() const
+ unsigned int PortID::index() const
{
return m_index;
}
- port_io::IO PortIDImpl::io() const
+ port_io::IO PortID::io() const
{
return m_io;
}
- bool PortIDImpl::strong_dep() const
- {
- return m_strong_dep;
- }
-
- std::string PortIDImpl::type() const
+ std::string PortID::type() const
{
return m_type;
}
+ PropertyMap portid_spec(const PortID* pid) { return pid->spec(); }
+
+ std::string portid_id(const PortID* pid) { return pid->id(); }
+
+ unsigned int portid_index(const PortID* pid) { return pid->index(); }
+
+ port_io::IO portid_io(const PortID* pid) { return pid->io(); }
+
+ std::string portid_type(const PortID* pid) { return pid->type(); }
+
//-------------------------------------------------------------------------
- UnitFactoryHandleImpl::UnitFactoryHandleImpl(UnitFactoryWrapper* u,
- UnitFactoryIDImpl& id_)
+ UnitFactoryHandle::UnitFactoryHandle(gsdk::Unit* u,
+ UnitFactoryID& id_)
: refcount(0), uf(u), plugin_handle(id_.plugin_handle),
id(id_), m_num_ports(0)
{
- const char* specc = uf->get_spec();
+ const char* specc = uf->spec();
if (specc == 0)
throw std::invalid_argument("could not create unittype "
"(get_spec failed)");
@@ -103,12 +106,6 @@
if (!sr.hasKey("ports"))
throw std::invalid_argument("Spec error: 'ports' not specified");
- if (!sr.hasKey("deterministic"))
- throw std::invalid_argument("Spec error: 'deterministic' "
- "not specified");
-
- m_deterministic = sr.getBoolValue("deterministic");
-
try {
// get port id's and remember the index for each portID
std::string ports = sr.getStringValue("ports");
@@ -124,7 +121,7 @@
throw std::invalid_argument(msg.c_str());
}
- const char* port_spec = uf->get_port_spec(m_num_ports);
+ const char* port_spec = uf->port_spec(m_num_ports);
if (port_spec == 0)
throw std::invalid_argument("could not get port spec");
@@ -158,13 +155,9 @@
"value: ") +
sio).c_str());
- bool strong_dep = false;
- if (io == port_io::IN)
- strong_dep = psr.getBoolValue("strong_dep");
-
- PortID* ph = new PortIDImpl(*this, psr.getMap(), portID,
+ PortID* ph = new PortID(*this, psr.getMap(), portID,
link_type_id, m_num_ports,
- io, strong_dep);
+ io);
m_port_handles.push_back(ph);
@@ -178,35 +171,34 @@
}
}
- UnitFactoryHandleImpl::~UnitFactoryHandleImpl()
+ UnitFactoryHandle::~UnitFactoryHandle()
{
for (std::vector<PortID*>::const_iterator
it = m_port_handles.begin(); it != m_port_handles.end(); ++it)
{
delete *it;
}
-
- delete uf;
}
- UnitFactoryHandleImpl::PropertyMap UnitFactoryHandleImpl::spec() const
+ UnitFactoryHandle::PropertyMap UnitFactoryHandle::spec() const
{
return m_spec;
}
- std::vector<PortID*> UnitFactoryHandleImpl::ports() const
+ std::vector<PortID*> UnitFactoryHandle::ports() const
{
return m_port_handles;
}
- bool UnitFactoryHandleImpl::deterministic() const
+
+ PropertyMap unitfactory_spec(const UnitFactoryHandle* ufh)
{
- return m_deterministic;
+ return ufh->spec();
}
- // TODO: stuff popuff
- UnitFactoryHandle::~UnitFactoryHandle() {}
- UnitFactoryHandle& UnitFactoryHandle::operator=(const UnitFactoryHandle&)
- { return *this; }
+ std::vector<PortID*> unitfactory_ports(const UnitFactoryHandle* ufh)
+ {
+ return ufh->ports();
+ }
//-------------------------------------------------------------------------
}
--- orig/gphxcore/src/unitfactoryhandleimpl.h
+++ mod/gphxcore/src/unitfactoryhandleimpl.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -25,28 +25,27 @@
#include "unitfactoryhandle.h"
-class UnitFactoryWrapper;
+namespace gsdk
+{
+ class Unit;
+}
namespace core
{
//-------------------------------------------------------------------------
- class UnitFactoryHandleImpl;
- class UnitFactoryIDImpl;
- class PluginHandleImpl;
+ class UnitFactoryHandle;
+ class UnitFactoryID;
+ class PluginHandle;
- class PortIDImpl : public PortID
+ struct PortID
{
- public:
- PortIDImpl(UnitFactoryHandleImpl& uhi,
- const PropertyMap& spec,
- const std::string& id,
- const std::string& type,
- unsigned int index,
- port_io::IO io,
- bool strong_dep);
-
+ PortID(UnitFactoryHandle& uhi,
+ const PropertyMap& spec,
+ const std::string& id,
+ const std::string& type,
+ unsigned int index,
+ port_io::IO io);
- virtual ~PortIDImpl();
PropertyMap spec() const;
@@ -56,11 +55,9 @@
port_io::IO io() const;
- bool strong_dep() const;
-
std::string type() const;
- UnitFactoryHandleImpl& m_unit_factory_handle;
+ UnitFactoryHandle& m_unit_factory_handle;
private:
std::string m_type;
@@ -76,15 +73,14 @@
//-------------------------------------------------------------------------
- class UnitFactoryHandleImpl : public UnitFactoryHandle
+ struct UnitFactoryHandle
{
- public:
typedef std::map<std::string, std::string> PropertyMap;
- UnitFactoryHandleImpl(UnitFactoryWrapper* u,
- UnitFactoryIDImpl& id_);
+ UnitFactoryHandle(gsdk::Unit* u,
+ UnitFactoryID& id_);
- virtual ~UnitFactoryHandleImpl();
+ ~UnitFactoryHandle();
/**
* Returns the spec of the unit type
@@ -115,12 +111,10 @@
std::vector<PortID*> ports() const;
- bool deterministic() const;
-
int refcount;
- UnitFactoryWrapper* uf;
- PluginHandleImpl* plugin_handle;
- UnitFactoryIDImpl& id;
+ gsdk::Unit* uf;
+ PluginHandle* plugin_handle;
+ UnitFactoryID& id;
private:
PropertyMap m_spec;
@@ -129,8 +123,8 @@
bool m_deterministic;
int m_num_ports;
- UnitFactoryHandleImpl(const UnitFactoryHandleImpl&); // not impl
- UnitFactoryHandleImpl& operator=(const UnitFactoryHandleImpl&); // not impl
+ UnitFactoryHandle(const UnitFactoryHandle&); // not impl
+ UnitFactoryHandle& operator=(const UnitFactoryHandle&); // not impl
};
//-------------------------------------------------------------------------
--- orig/gphxcore/src/unithandleimpl.cpp
+++ mod/gphxcore/src/unithandleimpl.cpp
@@ -26,7 +26,7 @@
#include "unithandleimpl.h"
#include "unitfactoryhandleimpl.h"
-#include "unitwrapper.h"
+#include "unit.h"
namespace core
{
@@ -41,64 +41,73 @@
//-------------------------------------------------------------------------
- PortHandleImpl::PortHandleImpl(UnitHandleImpl& uh,
- PortIDImpl& id)
+ PortHandle::PortHandle(UnitHandle& uh, PortID& id)
: unit_handle(uh), m_id(id) {}
- PortIDImpl& PortHandleImpl::id() const
+ PortID& PortHandle::id() const
{
return m_id;
}
+ PortID* porthandle_id(const PortHandle* ph)
+ {
+ return &ph->id();
+ }
+
//-------------------------------------------------------------------------
- UnitHandleImpl::UnitHandleImpl(UnitWrapper* u, UnitNode* n,
- UnitFactoryHandleImpl& ufi)
+ UnitHandle::UnitHandle(gsdk::Unit& u, UnitNode* n,
+ UnitFactoryHandle& ufi)
: unit(u), node(n), unit_factory(ufi)
{
std::vector<PortID*> ids = ufi.ports();
for (std::vector<PortID*>::const_iterator it = ids.begin();
it != ids.end(); ++it)
{
- PortHandleImpl*
- phi = new PortHandleImpl(*this,
- *safe_cast<PortIDImpl*>(*it));
+ PortHandle* phi = new PortHandle(*this,
+ *safe_cast<PortID*>(*it));
m_port_handles.push_back(phi);
}
}
- UnitHandleImpl::~UnitHandleImpl()
+ UnitHandle::~UnitHandle()
{
- for (std::vector<PortHandleImpl*>::iterator it = m_port_handles.begin();
+ for (std::vector<PortHandle*>::iterator it = m_port_handles.begin();
it != m_port_handles.end(); ++it)
{
delete *it;
}
- delete unit;
delete node;
}
- UnitFactoryHandle& UnitHandleImpl::factory_handle() const
+ UnitFactoryHandle& UnitHandle::factory_handle() const
{
return unit_factory;
}
- PortHandle& UnitHandleImpl::port_handle(unsigned int index) const
+ PortHandle& UnitHandle::port_handle(unsigned int index) const
{
if (index >= m_port_handles.size())
throw std::invalid_argument("Index out of range at "
- "UnitHandleImpl::port_handle()");
+ "UnitHandle::port_handle()");
return *m_port_handles[index];
};
- unsigned int UnitHandleImpl::num_ports() const
+ unsigned int UnitHandle::num_ports() const
{
return m_port_handles.size();
}
- UnitHandle::~UnitHandle() {}
- UnitHandle& UnitHandle::operator=(const UnitHandle&)
- { return *this; }
+ UnitFactoryHandle* unithandle_factory_handle(const UnitHandle* uh)
+ {
+ return &uh->factory_handle();
+ }
+
+ PortHandle* unithandle_port_handle(const UnitHandle* uh,
+ unsigned int index)
+ {
+ return &uh->port_handle(index);
+ }
}
--- orig/gphxcore/src/unithandleimpl.h
+++ mod/gphxcore/src/unithandleimpl.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -30,25 +30,28 @@
#include "unitfactoryhandleimpl.h"
-class UnitWrapper;
+namespace gsdk
+{
+ class Unit;
+}
namespace core
{
- class PortIDImpl;
+ struct PortID;
- class UnitHandleImpl;
- class UnitFactoryHandleImpl;
+ struct UnitHandle;
+ struct UnitFactoryHandle;
//------------------------------------------------------------------------
// Used by the renderer
- class ConnectionHandleImpl;
+ struct ConnectionHandle;
struct UnitNode
{
UnitNode(int num_ports);
// connection for every port of the unit
- std::vector<ConnectionHandleImpl*> adj;
+ std::vector<ConnectionHandle*> adj;
double timestamp; // TODO: replace with some sort of color or state
// (if update is called with time==0 there is a
@@ -58,26 +61,24 @@
//-------------------------------------------------------------------------
- class PortHandleImpl : public PortHandle
+ struct PortHandle
{
- public:
- PortHandleImpl(UnitHandleImpl& uh,
- PortIDImpl& id);
+ PortHandle(UnitHandle& uh,
+ PortID& id);
- PortIDImpl& id() const;
+ PortID& id() const;
- UnitHandleImpl& unit_handle;
- PortIDImpl& m_id;
+ UnitHandle& unit_handle;
+ PortID& m_id;
};
//-------------------------------------------------------------------------
- class UnitHandleImpl : public UnitHandle
+ struct UnitHandle
{
- public:
- UnitHandleImpl(UnitWrapper* u, UnitNode* n, UnitFactoryHandleImpl& uti);
+ UnitHandle(gsdk::Unit& u, UnitNode* n, UnitFactoryHandle& uti);
- virtual ~UnitHandleImpl();
+ virtual ~UnitHandle();
UnitFactoryHandle& factory_handle() const;
@@ -85,12 +86,12 @@
unsigned int num_ports() const;
- UnitWrapper* unit;
+ gsdk::Unit& unit;
UnitNode* node;
- UnitFactoryHandleImpl& unit_factory;
+ UnitFactoryHandle& unit_factory;
private:
- std::vector<PortHandleImpl*> m_port_handles;
+ std::vector<PortHandle*> m_port_handles;
};
}
--- orig/konsolenphex/scripts/plus.phex
+++ mod/konsolenphex/scripts/plus.phex
@@ -1,35 +1,31 @@
ls
-load("numbers")
-uf_import(KalkulonFactory,1)
-uf_import(RandomFactory,1)
-u_create(p, KalkulonFactory:1)
+load(core)
+uf_import(Kalkulon,1)
+u_create(p, Kalkulon:1)
lf_import(NumberFactory,1)
l_create(x, NumberFactory:1)
l_create(y, NumberFactory:1)
l_create(z, NumberFactory:1)
-attach(x,p,in_x,c1)
-attach(y,p,in_y,c2)
-attach(z,p,out_z,c3)
+attach(x,p,in_lhs,c1)
+attach(y,p,in_rhs,c2)
+attach(z,p,out_dst,c3)
set(x,1)
set(y,2)
update(p)
get(z)
-u_create(gen, RandomFactory:1)
-attach(x, gen, out_rand, c4)
//-------- Simple Rekursion ---------------
ls
-load("numbers.so")
-uf_import(KalkulonFactory,1)
-uf_import(RandomFactory,1)
-u_create(p, KalkulonFactory:1)
-lf_import(Number,1)
+load(core)
+uf_import(Kalkulon,1)
+u_create(p, Kalkulon:1)
+lf_import(NumberFactory,1)
l_create(x, NumberFactory:1)
l_create(z, NumberFactory:1)
-attach(x,p,in_x, c1)
-attach(z,p,in_y, c2)
-attach(z,p,out_z,c3)
+attach(x,p,in_lhs, c1)
+attach(z,p,in_rhs, c2)
+attach(z,p,out_dst,c3)
set(x,1)
update(p)
get(z)
--- orig/konsolenphex/src/Makefile.am
+++ mod/konsolenphex/src/Makefile.am
@@ -9,12 +9,13 @@
konsolenphex_LDFLAGS =
konsolenphex_LDADD = \
- -ldl -lboost_filesystem \
- -lgphxutils -lgphxcore \
+ -lgphxcore -lgphxutils -lgphxsdk -ldl -lboost_filesystem \
-L@top_builddir@/gphxutils/src \
+ -L@top_builddir@/gphxsdk/src \
-L@top_builddir@/gphxcore/src
konsolenphex_DEPENDENCIES = \
@top_builddir@/gphxutils/src/libgphxutils.a \
+ @top_builddir@/gphxsdk/src/libgphxsdk.a \
@top_builddir@/gphxcore/src/libgphxcore.a
--- orig/konsolenphex/src/main.cpp
+++ mod/konsolenphex/src/main.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2003
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -398,7 +398,7 @@
void operator()(const std::pair<std::string, core::ConnectionHandle*>& p)
{
std::cout << "Cleaning connection '" << p.first << "'
";
- m_core.detach(*p.second);
+ core::core_detach(m_core, p.second);
}
private:
core::Core& m_core;
@@ -412,7 +412,9 @@
void operator()(const std::pair<std::string, core::LinkHandle*>& p)
{
std::cout << "Cleaning link '" << p.first << "'
";
- m_core.destroy_link(*p.second);
+ core::CoreError err;
+ if (!core::core_destroy_link(m_core, p.second, err))
+ throw std::runtime_error("Could not destroy link");
}
private:
core::Core& m_core;
@@ -426,7 +428,9 @@
void operator()(const std::pair<std::string, core::UnitHandle*>& p)
{
std::cout << "Cleaning unit '" << p.first << "'
";
- m_core.destroy_unit(*p.second);
+ core::CoreError err;
+ if (!core::core_destroy_unit(m_core, p.second, err))
+ throw std::runtime_error("Could not destroy unit");
}
private:
core::Core& m_core;
@@ -440,7 +444,9 @@
void operator()(const std::pair<std::string, core::LinkFactoryHandle*>& p)
{
std::cout << "Cleaning link factory '" << p.first << "'
";
- m_core.unimport_lf(*p.second);
+ core::CoreError err;
+ if (!core_unimport_lf(m_core, p.second, err))
+ throw std::runtime_error("Could not unimport linkfactory");
}
private:
core::Core& m_core;
@@ -455,7 +461,9 @@
void operator()(const std::pair<std::string, core::UnitFactoryHandle*>& p)
{
std::cout << "Cleaning unit factory '" << p.first << "'
";
- m_core.unimport_uf(*p.second);
+ core::CoreError err;
+ if (!core::core_unimport_uf(m_core, p.second, err))
+ throw std::runtime_error("Could not unimport unitfactory");
}
private:
core::Core& m_core;
@@ -470,7 +478,9 @@
void operator()(const std::pair<std::string, core::PluginHandle*>& p)
{
std::cout << "Cleaning plugin '" << p.first << "'
";
- m_core.unload_plugin(*p.second);
+ core::CoreError err;
+ if (!core::core_unload_plugin(m_core, p.second, err))
+ throw std::runtime_error("Could not unload plugin");
}
private:
core::Core& m_core;
@@ -493,7 +503,8 @@
std::string plugin_path = argv[1];
std::string plugin_extensions = "so";
- core::Core core;
+ core::CoreError err;
+ core::Core* core = core::core_create();
bool stop = false;
double system_time = 1;
@@ -583,36 +594,44 @@
throw std::runtime_error("No such plugin registered (try ls)");
std::string fname = it->second;
- std::auto_ptr<utils::ILibrary>
- lib(new utils::SharedLibrary(fname));
- core::PluginHandle* plg = &core.load_plugin(lib);
+ utils::ILibrary* lib(new utils::SharedLibrary(fname));
+ core::PluginHandle* plg = core::core_load_plugin(*core,
+ lib, err);
- core::PluginHandle::UnitFactoryIDList unitfactories = plg->list_ufs();
+ if (!plg)
+ {
+ delete lib;
+ throw std::runtime_error("Could not load plugin");
+ }
+
+ core::UnitFactoryIDList unitfactories = plugin_list_ufs(*plg);
std::cout << "UnitFactories: (";
- for (core::PluginHandle::UnitFactoryIDList::const_iterator
- it = unitfactories.begin(); it != unitfactories.end(); ++it)
+ for (core::UnitFactoryIDList::const_iterator
+ it = unitfactories.begin();
+ it != unitfactories.end(); ++it)
{
- std::cout << (*it)->name() << "," << (*it)->version() << ";";
- uf_ids[std::make_pair((*it)->name(),
- (*it)->version())] =
+ std::string name = ufid_name(**it);
+ std::string version = ufid_version(**it);
+ std::cout << name << "," << version << ";";
+ uf_ids[std::make_pair(name, version)] =
std::make_pair(*it, plg);
}
std::cout << ") - ";
- core::PluginHandle::LinkFactoryIDList linkfactories = plg->list_lfs();
+ core::LinkFactoryIDList linkfactories = plugin_list_lfs(*plg);
std::cout << "LinkFactories: (";
- for (core::PluginHandle::LinkFactoryIDList::const_iterator
+ for (core::LinkFactoryIDList::const_iterator
it = linkfactories.begin(); it != linkfactories.end(); ++it)
{
- std::cout << (*it)->name() << "," << (*it)->version() << ";";
- lf_ids[std::make_pair((*it)->name(),
- (*it)->version())] =
+ std::string name = lfid_name(**it);
+ std::string version = lfid_version(**it);
+ std::cout << name << "," << version << ";";
+ lf_ids[std::make_pair(name, version)] =
std::make_pair(*it, plg);
}
std::cout << ")
";
- loaded_plugins.insert(std::make_pair(cmd_list[1],
- plg));
+ loaded_plugins.insert(std::make_pair(cmd_list[1], plg));
}
catch(std::exception& e) {
std::cout << "Error: " << e.what() << "
";
@@ -633,7 +652,8 @@
FromPlugin<core::LinkFactoryID*> fpl(it->second);
FromPlugin<core::UnitFactoryID*> fpu(it->second);
- core.unload_plugin(*it->second);
+ if (!core::core_unload_plugin(*core, it->second, err))
+ throw std::runtime_error("Could not unload plugin");
//remove stuff from lf_ids and uf_ids
erase_filter(lf_ids, fpl);
@@ -652,10 +672,17 @@
try {
UTIDMap::const_iterator
it = uf_ids.find(std::make_pair(cmd_list[1], cmd_list[2]));
+
if (it == uf_ids.end())
throw std::runtime_error("No such Unit Factory");
+
std::string id = cmd_list[1] + ":" + cmd_list[2];
- core::UnitFactoryHandle* uth = &core.import_uf(*it->second.first);
+ core::UnitFactoryHandle* uth
+ = core::core_import_uf(*core, it->second.first, err);
+
+ if (uth == 0)
+ throw std::runtime_error("Coult not import uf");
+
uts[id] = uth;
std::cout << id << "
";
}
@@ -671,10 +698,13 @@
try {
std::map<std::string, core::UnitFactoryHandle*>::iterator
it = uts.find(cmd_list[1]);
+
if (it == uts.end())
throw std::runtime_error("No such unit factory");
- core.unimport_uf(*it->second);
+ if (!core::core_unimport_uf(*core, it->second, err))
+ throw std::runtime_error("Could not unimport uf");
+
uts.erase(it);
}
catch(std::exception& e) {
@@ -689,12 +719,13 @@
try {
std::map<std::string, core::UnitFactoryHandle*>::const_iterator
it = uts.find(cmd_list[1]);
+
if (it == uts.end())
throw std::runtime_error("No such unit factory");
core::UnitFactoryHandle* uth = it->second;
- typedef core::UnitFactoryHandle::PropertyMap PropertyMap;
- PropertyMap spec = uth->spec();
+ typedef core::PropertyMap PropertyMap;
+ PropertyMap spec = unitfactory_spec(uth);
utils::StructReader sr(spec);
sr.serialize(std::cout);
std::cout << "
";
@@ -710,21 +741,24 @@
<< " (UnitFactoryID, portID)
";
else {
try {
- typedef core::UnitFactoryHandle::PropertyMap PropertyMap;
+ typedef core::PropertyMap PropertyMap;
std::map<std::string, core::UnitFactoryHandle*>::const_iterator
it = uts.find(cmd_list[1]);
+
if (it == uts.end())
throw std::runtime_error("No such unit factory");
core::UnitFactoryHandle* uth = it->second;
- std::vector<core::PortID*> pids = uth->ports();
+
+ std::vector<core::PortID*> pids
+ = core::unitfactory_ports(uth);
std::vector<core::PortID*>::const_iterator itti = pids.end();
for (std::vector<core::PortID*>::const_iterator i = pids.begin();
i != pids.end(); ++i)
{
- if ((*i)->id() == cmd_list[2])
+ if (core::portid_id(*i) == cmd_list[2])
{
itti = i;
break;
@@ -734,7 +768,7 @@
throw std::runtime_error("No such port");
core::PortID* pid = *itti;
- PropertyMap spec = pid->spec();
+ PropertyMap spec = core::portid_spec(pid);
utils::StructReader sr(spec);
sr.serialize(std::cout);
std::cout << "
";
@@ -751,17 +785,19 @@
try {
std::map<std::string, core::UnitFactoryHandle*>::const_iterator
it = uts.find(cmd_list[1]);
+
if (it == uts.end())
throw std::runtime_error("No such unit factory");
core::UnitFactoryHandle* uth = it->second;
- std::vector<core::PortID*> pids = uth->ports();
+ std::vector<core::PortID*> pids
+ = core::unitfactory_ports(uth);
std::cout << "(";
for (std::vector<core::PortID*>::const_iterator i = pids.begin();
i != pids.end(); ++i)
{
- std::cout << (*i)->id() << ";";
+ std::cout << core::portid_id(*i) << ";";
}
std::cout << ")
";
}
@@ -772,16 +808,24 @@
}
else if (cmd_name == "lf_import") {
if (cmd_list.size() != 3)
- std::cout << "lf_import takes two parameters (factory and version)
";
+ std::cout << "lf_import takes two parameters "
+ << "(factory and version)
";
else {
try
{
LTIDMap::const_iterator
it = lf_ids.find(std::make_pair(cmd_list[1], cmd_list[2]));
+
if (it == lf_ids.end())
throw std::runtime_error("No such link factory");
+
std::string id = cmd_list[1] + ":" + cmd_list[2];
- core::LinkFactoryHandle* lth = &core.import_lf(*it->second.first);
+ core::LinkFactoryHandle* lth
+ = core::core_import_lf(*core, it->second.first, err);
+
+ if (!lth)
+ throw std::runtime_error("Could not import lf");
+
lts[id] = lth;
std::cout << id << "
";
}
@@ -800,7 +844,9 @@
if (lts.find(cmd_list[1]) == lts.end())
throw std::runtime_error("No such link factory");
- core.unimport_lf(*it->second);
+ if (!core::core_unimport_lf(*core, it->second, err))
+ throw std::runtime_error("Could not unimport lf");
+
lts.erase(it);
}
catch(std::exception& e) {
@@ -822,7 +868,11 @@
if (units.count(cmd_list[1]) != 0)
throw std::runtime_error("Unit id already used");
- core::UnitHandle* uh = &core.create_unit(*it->second);
+ core::UnitHandle* uh = core::core_create_unit(*core, it->second);
+
+ if (!uh)
+ throw std::runtime_error("Could not create unit");
+
units[cmd_list[1]] = uh;
std::cout << cmd_list[1] << "
";
}
@@ -838,10 +888,13 @@
try {
std::map<std::string, core::UnitHandle*>::iterator
it = units.find(cmd_list[1]);
+
if (it == units.end())
throw std::runtime_error("No such unit");
- core.destroy_unit(*it->second);
+ if (!core::core_destroy_unit(*core, it->second, err))
+ throw std::runtime_error("Could not destroy unit");
+
units.erase(it);
}
catch(std::exception& e) {
@@ -863,7 +916,12 @@
if (links.count(cmd_list[1]) != 0)
throw std::runtime_error("Link id already used");
- core::LinkHandle* lh = &core.create_link(*it->second);
+ core::LinkHandle*
+ lh = core::core_create_link(*core, it->second);
+
+ if (!lh)
+ throw std::runtime_error("Could not create link");
+
links[cmd_list[1]] = lh;
std::cout << cmd_list[1] << "
";
}
@@ -879,10 +937,13 @@
try {
std::map<std::string, core::LinkHandle*>::iterator
it = links.find(cmd_list[1]);
+
if (it == links.end())
throw std::runtime_error("No such link");
- core.destroy_link(*it->second);
+ if (!core::core_destroy_link(*core, it->second, err))
+ throw std::runtime_error("Could not destroy link");
+
links.erase(it);
}
catch(std::exception& e) {
@@ -911,29 +972,37 @@
core::LinkHandle* lh = lit->second;
core::UnitHandle* uh = uit->second;
- core::UnitFactoryHandle* uth = &uh->factory_handle();
+ core::UnitFactoryHandle*
+ uth = core::unithandle_factory_handle(uh);
- std::vector<core::PortID*> pids = uth->ports();
+ std::vector<core::PortID*> pids =
+ core::unitfactory_ports(uth);
std::vector<core::PortID*>::const_iterator itti = pids.end();
for (std::vector<core::PortID*>::const_iterator
i = pids.begin(); i != pids.end(); ++i)
{
//std::cout << "id = " << (*i)->id() << "
";
- if ((*i)->id() == cmd_list[3])
+ if (core::portid_id(*i) == cmd_list[3])
{
itti = i;
break;
}
}
+
if (itti == pids.end())
throw std::runtime_error("No such port");
core::PortID* pid = *itti;
- unsigned int index = pid->index();
- core::PortHandle* ph = &uh->port_handle(index);
+ unsigned int index = core::portid_index(pid);
+ core::PortHandle* ph
+ = core::unithandle_port_handle(uh, index);
- core::ConnectionHandle* conn = &core.attach(*lh, *ph);
+ core::ConnectionHandle* conn =
+ core::core_attach(*core, lh, ph, err);
+
+ if (conn == 0)
+ throw std::runtime_error("Could not attach");
connections[cmd_list[4]] = conn;
std::cout << cmd_list[4] << "
";
@@ -953,7 +1022,7 @@
if (it == connections.end())
throw std::runtime_error("No such connection");
- core.detach(*it->second);
+ core::core_detach(*core, it->second);
connections.erase(it);
}
@@ -976,7 +1045,9 @@
throw std::runtime_error("No such unit");
unitIDs.push_back(it->second);
- core.update(unitIDs, system_time);
+ if (!core::core_update(*core, unitIDs, system_time, err))
+ throw std::runtime_error("Could not update");
+
system_time += 1;
std::cout << "done
";
@@ -993,12 +1064,13 @@
try {
std::map<std::string, core::LinkHandle*>::const_iterator
it = links.find(cmd_list[1]);
+
if (it == links.end())
throw std::runtime_error("No such link");
core::LinkHandle* lh = it->second;
- std::cout << lh->get_value() << "
";
+ std::cout << core::linkhandle_get_value(lh) << "
";
}
catch(std::exception& e) {
std::cout << "Error: " << e.what() << "
";
@@ -1012,12 +1084,13 @@
try {
std::map<std::string, core::LinkHandle*>::const_iterator
it = links.find(cmd_list[1]);
+
if (it == links.end())
throw std::runtime_error("No such link");
core::LinkHandle* lh = it->second;
- lh->set_value(cmd_list[2], system_time);
+ linkhandle_set_value(lh, cmd_list[2], system_time);
std::cout << cmd_list[2] << "
";
}
catch(std::exception& e) {
@@ -1073,13 +1146,13 @@
//cleanup
std::for_each(connections.begin(), connections.end(),
- ConnectionCleaner(core));
- std::for_each(links.begin(), links.end(), LinkCleaner(core));
- std::for_each(units.begin(), units.end(), UnitCleaner(core));
- std::for_each(lts.begin(), lts.end(), LTCleaner(core));
- std::for_each(uts.begin(), uts.end(), UTCleaner(core));
+ ConnectionCleaner(*core));
+ std::for_each(links.begin(), links.end(), LinkCleaner(*core));
+ std::for_each(units.begin(), units.end(), UnitCleaner(*core));
+ std::for_each(lts.begin(), lts.end(), LTCleaner(*core));
+ std::for_each(uts.begin(), uts.end(), UTCleaner(*core));
std::for_each(loaded_plugins.begin(), loaded_plugins.end(),
- PlgCleaner(core));
+ PlgCleaner(*core));
return 0;
}
--- orig/pluc/src/main.cpp
+++ mod/pluc/src/main.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2004
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
@@ -58,32 +58,6 @@
return true;
}
-//-----------------------------------------------------------------------
-
-struct FileDesc
-{
- FileDesc(const std::string& fname_, const std::string& lang_)
- : fname(fname_), lang(lang_) {}
- virtual ~FileDesc() {}
-
- std::string fname;
- std::string lang;
-};
-
-template <typename T>
-struct SpecDesc : public FileDesc
-{
- SpecDesc(T* sp_, const std::string& fname, const std::string& lang)
- : FileDesc(fname, lang), sp(sp_) {}
- virtual ~SpecDesc() { delete sp; }
-
- T* sp;
-};
-
-typedef SpecDesc<pluc::UnitSpec> UnitSpecDesc;
-typedef SpecDesc<pluc::LinkSpec> LinkSpecDesc;
-
-typedef std::list<FileDesc*> FileDescList;
//-----------------------------------------------------------------------
@@ -100,18 +74,15 @@
//-----------------------------------------------------------------------
template <typename T, typename It, typename BinOp>
-T reduce(It begin, It end, BinOp op)
+T reduce(It begin, It end, BinOp op, const T& start)
{
T sum;
It it = begin;
- if (it != end)
- sum = *(it++);
+ sum = start;
while (it != end)
- {
sum = op(sum, *(it++));
- }
return sum;
}
@@ -176,12 +147,6 @@
return result;
}
-template <class T>
-static std::string iface_name(const SpecDesc<T>* sd)
-{
- return *sd->sp->m_name;
-}
-
static std::string iface_major_version(const pluc::KVMap& spec)
{
pluc::KVMap::const_iterator it = spec.find("version");
@@ -195,75 +160,6 @@
return full_version.substr(0, pos);
}
-template <class T>
-static std::string iface_major_version(const SpecDesc<T>* sd)
-{
- const pluc::KVMap& spec = *sd->sp->m_spec;
- return iface_major_version(spec);
-}
-
-static std::string iface_name(const FileDesc* fd)
-{
- if (typeid(*fd) == typeid(UnitSpecDesc))
- {
- const UnitSpecDesc* usd = dynamic_cast<const UnitSpecDesc*>(fd);
- return iface_name(usd);
- }
- else
- {
- const LinkSpecDesc* lsd = dynamic_cast<const LinkSpecDesc*>(fd);
- return iface_name(lsd);
- }
-}
-
-static std::string iface_major_version(const FileDesc* fd)
-{
- if (typeid(*fd) == typeid(UnitSpecDesc))
- {
- const UnitSpecDesc* usd = dynamic_cast<const UnitSpecDesc*>(fd);
- return iface_major_version(usd);
- }
- else
- {
- const LinkSpecDesc* lsd = dynamic_cast<const LinkSpecDesc*>(fd);
- return iface_major_version(lsd);
- }
-}
-
-// full name (with version) of the interface
-// (e.g. NumberLink_1)
-static std::string full_iface_name(const FileDesc* fd)
-{
- return iface_name(fd) + "_" + iface_major_version(fd);
-}
-
-// full name (with version) of the interface factory class
-// (e.g. NumberLink_1Factory)
-static std::string full_iface_factory_name(const FileDesc* fd)
-{
- return full_iface_name(fd) + "Factory";
-}
-
-// base file name (with version) of the interface
-// (e.g. numberlink_1)
-static std::string full_base_filename(const FileDesc* fd)
-{
- return tolower(full_iface_name(fd));
-}
-
-// full file name (with version) of the interface
-// (e.g. numberlink_1.if)
-static std::string full_iface_filename(const FileDesc* fd)
-{
- return full_base_filename(fd) + ".if";
-}
-
-// full file name (with version) of the factory interface
-// (e.g. numberlink_1factory.if)
-static std::string full_iface_factory_filename(const FileDesc* fd)
-{
- return tolower(full_iface_factory_name(fd)) + ".if";
-}
//-----------------------------------------------------------------------
@@ -308,6 +204,215 @@
return true;
}
+
+//-----------------------------------------------------------------------
+
+class FileDesc
+{
+public:
+ FileDesc(const std::string& fname)
+ : m_fname(fname) {}
+
+ virtual ~FileDesc() {}
+
+ std::string fname() const
+ {
+ return m_fname;
+ }
+
+ enum Type { UNIT, LINK };
+
+ virtual Type type() const = 0;
+
+ virtual std::string type_class() const = 0;
+ virtual std::string export_id() const = 0;
+ virtual std::string class_name() const = 0;
+
+ std::string file_prefix() const
+ {
+ return tolower(class_name());
+ }
+
+private:
+ std::string m_fname;
+
+};
+
+class UnitSpecDesc : public FileDesc
+{
+public:
+ UnitSpecDesc(pluc::UnitSpec* sp,
+ const std::string& fname)
+ : FileDesc(fname), m_sp(sp) {}
+
+ ~UnitSpecDesc() { delete m_sp; }
+
+ virtual Type type() const
+ {
+ return UNIT;
+ }
+
+ std::string type_class() const
+ {
+ return "Unit";
+ }
+
+ std::string export_id() const
+ {
+ return *m_sp->m_name + iface_major_version(*m_sp->m_spec);
+ }
+
+ std::string class_name() const
+ {
+ return *m_sp->m_name;
+ }
+
+ const pluc::PortList& port_list() const
+ {
+ return *m_sp->m_ports;
+ }
+
+private:
+ pluc::UnitSpec* m_sp;
+};
+
+
+class LinkSpecDesc : public FileDesc
+{
+public:
+ LinkSpecDesc(pluc::LinkSpec* sp,
+ const std::string& fname)
+ : FileDesc(fname), m_sp(sp) {}
+
+ ~LinkSpecDesc() { delete m_sp; }
+
+ virtual Type type() const
+ {
+ return LINK;
+ }
+
+ std::string type_class() const
+ {
+ return "LinkFactory";
+ }
+
+ std::string export_id() const
+ {
+ return *m_sp->m_name + iface_major_version(*m_sp->m_spec);
+ }
+
+ std::string class_name() const
+ {
+ return *m_sp->m_name;
+ }
+
+private:
+ pluc::LinkSpec* m_sp;
+};
+
+typedef std::list<FileDesc*> FileDescList;
+
+static std::string strip_version(const std::string& t)
+{
+ std::size_t pos = t.find(":");
+
+ if (pos == std::string::npos)
+ return t;
+ else
+ return t.substr(0, pos);
+}
+
+static std::string class_name(const pluc::PortSpec& ps)
+{
+ const pluc::KVMap spec = *ps.m_spec;
+
+ return strip_version(spec.find("linktype")->second);
+}
+
+static std::string name(const pluc::PortSpec& ps)
+{
+ const pluc::KVMap options = *ps.m_options;
+
+ return options.find("name")->second;
+}
+
+ struct port_tag
+ {
+ port_tag(std::string cn, std::string n, int i)
+ : class_name(cn), name(n), index(i) {}
+
+ std::string class_name;
+ std::string name;
+ int index;
+ };
+
+struct strunz
+{
+ std::string operator()(const std::string& l, const port_tag& r)
+ {
+ return l + ", " + r.name;
+ }
+
+};
+static void create_update_wrapper(std::ostream& os,
+ const std::string& cpp_class_name,
+ const pluc::PortList& ports)
+{
+
+ typedef std::list<port_tag> PortTagList;
+ PortTagList in_ports;
+ PortTagList out_ports;
+
+ int in_index = 0;
+ int out_index = 0;
+
+ for (pluc::PortList::const_iterator it = ports.begin();
+ it != ports.end(); ++it)
+ {
+ const pluc::PortSpec& ps = **it;
+
+ if ((*ps.m_spec)["io"] == "in")
+ in_ports.push_back(port_tag(class_name(ps), name(ps), in_index++));
+ else
+ out_ports.push_back(port_tag(class_name(ps), name(ps), out_index++));
+ }
+
+ os << "void " << cpp_class_name << "::update(const gsdk::Link** in_ports, "
+ << "gsdk::Link** out_ports, gsdk::Logger& log)
{
";
+
+ for (PortTagList::const_iterator i = in_ports.begin();
+ i != in_ports.end(); ++i)
+ {
+ std::string cpp_type = std::string("const ") + i->class_name + "*";
+ os << " " << cpp_type << " " << i->name
+ << " = dynamic_cast<" << cpp_type
+ << ">(in_ports[" << i->index << "]);
";
+ }
+
+ for (PortTagList::const_iterator i = out_ports.begin();
+ i != out_ports.end(); ++i)
+ {
+ std::string cpp_type = i->class_name + "*";
+ os << " " << cpp_type << " " << i->name
+ << " = dynamic_cast<" << cpp_type
+ << ">(out_ports[" << i->index << "]);
";
+ }
+
+ os << "
::update(";
+
+ PortTagList::iterator p1 = in_ports.begin();
+ PortTagList::iterator p2 = out_ports.begin();
+ ++p1;
+ ++p2;
+ os << reduce(p1, in_ports.end(), strunz(),
+ in_ports.begin()->name)
+ << ", "
+ << reduce(p2, out_ports.end(), strunz(),
+ out_ports.begin()->name);
+
+ os << ", log);
}
";
+}
+
//-----------------------------------------------------------------------
// linktypes must have the form "IDENTIFIER:[0-9]+"
@@ -365,29 +470,7 @@
}
std::string io = spec["io"];
- if (io == "in")
- {
- if (spec.count("strong_dep") == 0)
- {
- std::cerr << "Error: Port " << *psp.m_name
- << ": strong_dep key missing in spec.
";
- return false;
- }
-
- std::string strong_dep = spec["strong_dep"];
- if (!is_bool_value(strong_dep))
- {
- std::cerr << "Error: Port " << *psp.m_name
- << ": strong_dep must be 'true' or 'false' "
- << "(is '" << strong_dep<< "').
";
- return false;
- }
-
- }
- else if (io == "out")
- {
- }
- else
+ if (io != "in" && io != "out")
{
std::cerr << "Error: Port " << *psp.m_name
<< ": io must be 'in' or 'out' (is '"
@@ -440,7 +523,7 @@
static bool check_usp(const pluc::UnitSpec& usp)
{
- char* needed_spec_keys[] = { "author", "version", "icon", "deterministic",
+ char* needed_spec_keys[] = { "author", "version", "icon",
"description", 0 };
pluc::KVMap& spec = *usp.m_spec;
@@ -458,14 +541,6 @@
if (!check_version_string(spec["version"]))
return false;
- if (!is_bool_value(spec["deterministic"]))
- {
- std::cerr << "Error: expected bool value (true|false) for key '"
- << "deterministic', got '" << spec["deterministic"]
- << "'.
";
- return false;
- }
-
std::map<std::string, bool> port_names;
for (pluc::PortList::const_iterator it = usp.m_ports->begin();
it != usp.m_ports->end(); ++it)
@@ -489,25 +564,6 @@
//-----------------------------------------------------------------------
-/**
- * Returns wether all input ports are strong dependencies.
- */
-/*static bool all_strong_dep(const pluc::PortList::const_iterator& begin,
- const pluc::PortList::const_iterator& end)
-{
- for (pluc::PortList::const_iterator it = begin; it != end; ++it)
- {
- pluc::PortSpec* current = *it;
- pluc::KVMap& spec = *current->m_spec;
- if (spec["io"] == "in" && spec["strong_dep"] == "false")
- return false;
- }
-
- return true;
-}*/
-
-//-----------------------------------------------------------------------
-
void serialize_map(std::ostream& os, const pluc::KVMap& m)
{
for (pluc::KVMap::const_iterator it = m.begin(); it != m.end(); ++it)
@@ -544,158 +600,11 @@
return if_base_name + "_" + major_version;
}
-/**
- * Assumes that usp has passed check_usp().
- */
-static void create_unitfactory_if(std::ostream& s, const pluc::UnitSpec& usp)
-{
- std::string usp_name = full_name(*usp.m_name, *usp.m_spec);
-
- s << "# generated by pluc ver. " << VERSION << "
";
-
- s << "#@type[[[unitfactory]]]
";
- //GELB: HIER VERSION
- s << "#@created_iface[[[" << usp_name << "]]]
";
-
- s << "#@spec_string[[[unit_spec { ";
- serialize_map(s, *usp.m_spec);
- s << "ports=[" << port_names(usp.m_ports->begin(),
- usp.m_ports->end()) << "]";
- s << "}]]]
";
-
- s << "#@num_ports[[[" << usp.m_ports->size() << "]]]
";
-
- int port_num = 0;
- for (pluc::PortList::const_iterator it = usp.m_ports->begin();
- it != usp.m_ports->end(); ++it)
- {
- pluc::PortSpec& psp= **it;
- s << "#@port_spec_string_" << port_num << "[[[port_spec { ";
- s << " id=[" << *psp.m_name << "] ";
- serialize_map(s, *psp.m_spec);
- serialize_map(s, *psp.m_options);
- s << "}]]]
";
-
- ++port_num;
- }
-
- s << "interface " << usp_name << "Factory
";
- s << "{
";
-
- s << " init(in const ptr char name, in Logger l) : constructor;
"
- << " deinit() : destructor;
"
- << " " << usp_name << " create() : method;
";
-
- s << " const ptr char get_spec() : method;
";
-
- s << "
const ptr char get_port_spec(in int index) : method;
"
- << "}
";
-}
-
-//-----------------------------------------------------------------------
-
-/**
- * Assumes that usp has passed check_usp().
- */
-static void create_unit_if(std::ostream& s, const pluc::UnitSpec& usp)
-{
- std::string usp_name = full_name(*usp.m_name, *usp.m_spec);
-
- s << "# generated by pluc ver. " << VERSION << "
";
-
- s << "#@type[[[unit]]]
";
- s << "#@num_ports[[[" << usp.m_ports->size() << "]]]
";
-
- int port_num = 0;
- for (pluc::PortList::const_iterator it = usp.m_ports->begin();
- it != usp.m_ports->end(); ++it)
- {
- pluc::PortSpec& psp= **it;
- std::string port_type = (*psp.m_spec)["linktype"];
- std::string::size_type pos = port_type.find_first_of(":");
- assert(pos != std::string::npos); // because of check_usp
- port_type = port_type.substr(0, pos) + "_" + port_type.substr(pos+1);
- std::string port_id = *psp.m_name;
- s << "#@port_type_" << port_num << "[[[" << port_type << "]]]
";
- s << "#@port_id_" << port_num << "[[[" << port_id << "]]]
";
-
- ++port_num;
- }
-
- s << "interface " << usp_name << "
"
- << "{
"
- << " destroy() : destructor;
"
- << " void set_port(in int index, in Link l) : method;
"
- << " bool update(in double time, out ptr int patch) : method;
";
-
- /* if (!all_strong_dep(usp.m_ports->begin(),
- usp.m_ports->end()))
- {*/
- s << " void strong_deps_done(out ptr int needed_ports) : method;
";
- // }
-
- s << "}
";
-}
-
-//-----------------------------------------------------------------------
-
-void create_linkfactory_if(std::ostream& s, const pluc::LinkSpec& lsp)
-{
- std::string lsp_name = full_name(*lsp.m_name, *lsp.m_spec);
-
- s << "# generated by pluc ver. " << VERSION << "
";
-
- s << "#@type[[[linkfactory]]]
";
-
- s << "#@created_iface[[[" << lsp_name << "]]]
";
-
- pluc::KVMap spec = *lsp.m_spec;
- spec.erase("interface");
- s << "#@spec_string[[[link_spec { ";
- serialize_map(s, spec);
- s << "}]]]
";
-
- s << "interface " << lsp_name << "Factory
";
- s << "{
";
-
- s << " init(in const ptr char name, in Logger l) : constructor;
"
- << " deinit() : destructor;
"
- << " " << lsp_name << " create(in ptr int gphx_alloc,
"
- " in ptr int gphx_free) : method;
";
-
- s << " const ptr char get_spec() : method;
"
- << "}
";
-}
-
-void create_link_if(std::ostream& s, const pluc::LinkSpec& lsp)
-{
- std::string lsp_name = full_name(*lsp.m_name, *lsp.m_spec);
-
- pluc::KVMap spec = *lsp.m_spec;
- std::string interface = spec["interface"];
-
- s << "# generated by pluc ver. " << VERSION << "
"
- << "#@type[[[link]]]
"
- << "interface " << lsp_name << "
"
- << "{
";
-
- s << " destroy() : destructor;
"
-
- << " bool assign(in " << lsp_name << " t) : method;
"
-
- << " ptr char serialize() : const method;
"
- << " bool deserialize(in const ptr char buf) : method;
"
- << " # specific functions
"
- << interface << "
"
- << "}
";
-}
-
//-----------------------------------------------------------------------
bool check_link_spec(const pluc::LinkSpec& lsp)
{
- char* needed_spec_keys[] = { "author", "version", "description",
- "interface", 0 };
+ char* needed_spec_keys[] = { "author", "version", "description", 0 };
pluc::KVMap& spec = *lsp.m_spec;
char* key;
@@ -737,13 +646,7 @@
std::cerr << "Error: required key 'file' missing in plugin spec
";
return false;
}
- if (m.count("lang") == 0)
- {
- std::cerr << "Error: required key 'lang' missing in plugin spec
";
- return false;
- }
std::string filename = m.find("file")->second;
- std::string lang = m.find("lang")->second;
if (!file_exists(filename))
@@ -751,12 +654,6 @@
std::cerr << "Error: file '" << filename << "' not found.
";
return false;
}
- if (!(lang == "C" || lang == "C++"))
- {
- std::cerr << "Error: unknown language 'lang=" << lang << "'
"
- << " (so far only 'C' and 'C++' are supported)
";
- return false;
- }
}
return true;
@@ -799,467 +696,7 @@
const FileDescList& file_descs,
const pluc::PluginSpec& psp)
{
- typedef std::list<std::string> StrList;
-
- int num_cpp_units = 0;
- int num_c_units = 0;
- int num_links = 0;
- StrList c_external_ifaces;
- StrList cpp_external_ifaces;
- StrList cpp_built_ifaces;
- StrList c_built_ifaces;
- StrList cpp_wrapper_ifaces;
- StrList c_wrapper_ifaces;
-
- StrList cpp_auto_ifaces;
- StrList cpp_suffix_auto_ifaces;
-
- StrList c_auto_ifaces;
- StrList c_suffix_auto_ifaces;
-
- StrList sources;
- StrList built_sources;
- std::string pname = *psp.m_name;
-
- std::map<std::string, std::string> iface2specfile;
-
- std::set<std::string> cpp_used_linktypes;
- std::set<std::string> c_used_linktypes;
- std::set<std::string> exported_linktypes;
-
- sources.push_back(psp_filename);
- built_sources.push_back(pname + "_export.c");
- built_sources.push_back(pname + "_export.h");
- built_sources.push_back(pname + "_glue.h");
-
- for (FileDescList::const_iterator it = file_descs.begin();
- it != file_descs.end(); ++it)
- {
- const FileDesc* fd = *it;
- // std::string base_filename = path_basename(fd->fname);
- std::string lang = fd->lang;
-
- std::string full_if_basename = full_base_filename(fd);
- std::string full_if_filename = full_iface_filename(fd);
- std::string full_if_factory_filename = full_iface_factory_filename(fd);
- sources.push_back(fd->fname);
-
- if (lang == "C++")
- {
- sources.push_back(full_if_basename + ".cpp");
- cpp_auto_ifaces.push_back(full_if_factory_filename);
- cpp_built_ifaces.push_back(full_if_filename);
- cpp_built_ifaces.push_back(full_if_factory_filename);
- }
- else if (lang == "C")
- {
- sources.push_back(full_if_basename + ".c");
- c_auto_ifaces.push_back(full_if_factory_filename);
- c_built_ifaces.push_back(full_if_filename);
- c_built_ifaces.push_back(full_if_factory_filename);
- }
-
- iface2specfile[full_if_filename] = fd->fname;
- iface2specfile[full_if_factory_filename] = fd->fname;
-
- sources.push_back(full_if_basename + ".h");
- built_sources.push_back(full_if_basename + "factory.h");
-
- if (typeid(*fd) == typeid(UnitSpecDesc))
- {
- const UnitSpecDesc* usd = dynamic_cast<const UnitSpecDesc*>(fd);
-
- // first, compute the used linktypes
- std::set<std::string> used_linktypes = get_used_linktypes(*usd->sp);
-
- built_sources.push_back(full_if_basename + "auto.h");
-
- if (lang == "C++")
- {
- cpp_used_linktypes.insert(used_linktypes.begin(),
- used_linktypes.end());
- cpp_suffix_auto_ifaces.push_back(full_if_filename);
- ++num_cpp_units;
- }
- else
- {
- c_used_linktypes.insert(used_linktypes.begin(),
- used_linktypes.end());
- c_suffix_auto_ifaces.push_back(full_if_filename);
- ++num_c_units;
- }
- }
- else if (typeid(*fd) == typeid(LinkSpecDesc))
- {
- // const LinkSpecDesc* lsd = dynamic_cast<const LinkSpecDesc*>(fd);
-
- built_sources.push_back(full_if_basename + "vtablestruct.h");
-
- if (lang == "C++")
- cpp_used_linktypes.insert(full_if_filename);
- else
- c_used_linktypes.insert(full_if_filename);
-
- exported_linktypes.insert(full_if_filename);
- ++num_links;
- }
- }
-
- // now all unit and link specs have been processed once
-
- std::string iface_prefix ="$(IFACE_DIR)/";
-
- // create wrapper stuff for used linktypes
- for (std::set<std::string>::const_iterator it = c_used_linktypes.begin();
- it != c_used_linktypes.end(); ++it)
- {
- std::string full_if_filename = *it;
-
- if (exported_linktypes.count(full_if_filename) == 0)
- c_external_ifaces.push_back(iface_prefix + full_if_filename);
- else
- c_wrapper_ifaces.push_back(full_if_filename);
- }
-
- for (std::set<std::string>::const_iterator it = cpp_used_linktypes.begin();
- it != cpp_used_linktypes.end(); ++it)
- {
- std::string full_if_filename = *it;
- std::string full_if_basename = path_basename(full_if_filename);
-
- built_sources.push_back(path_basename(full_if_basename) + "wrapper.h");
-
- if (exported_linktypes.count(full_if_filename) == 0)
- cpp_external_ifaces.push_back(iface_prefix + full_if_filename);
- else
- cpp_wrapper_ifaces.push_back(full_if_filename);
- }
-
- bool any_cpp_ifaces = !cpp_auto_ifaces.empty();
- bool any_c_ifaces = !c_auto_ifaces.empty();
-
- if (any_cpp_ifaces)
- {
- built_sources.push_back(pname + "_cpp_wrapper.cpp");
- built_sources.push_back(pname + "_cpp_auto.cpp");
- built_sources.push_back(pname + "_cpp_glue.cpp");
- built_sources.push_back("loggerwrapper.h");
-
- if (num_cpp_units != 0)
- {
- cpp_external_ifaces.push_back("@top_srcdir@/gphxcore/interfaces/link.if");
- built_sources.push_back("linkwrapper.h");
- }
- }
-
- if (any_c_ifaces)
- {
- built_sources.push_back(pname + "_c_wrapper.c");
- built_sources.push_back(pname + "_c_auto.c");
- built_sources.push_back(pname + "_c_glue.c");
- built_sources.push_back("loggervtablestruct.h");
- }
-
- if (num_links == 0 && num_cpp_units == 0 && num_c_units == 0)
- {
- std::cerr << "No files given!
";
- return false;
- }
-
- c_external_ifaces.push_back("@top_srcdir@/gphxcore/interfaces/logger.if");
- cpp_external_ifaces.push_back("@top_srcdir@/gphxcore/interfaces/logger.if");
-
- out_am << "GIDLC = @top_builddir@/gidlc/src/gidlc
"
- << "PLUC = @top_builddir@/pluc/src/pluc
"
- << "IFACE_DIR = @builddir@/../../ifaces
"
- << "lib_LTLIBRARIES = " << pname << ".la
";
-
-
- if (any_c_ifaces)
- {
- out_am << "C_EXTERNAL_IFACES = \
";
-
- std::string cif = reduce<std::string>(c_external_ifaces.begin(),
- c_external_ifaces.end(),
- concater(" \
"));
-
- out_am << cif << "
";
-
- out_am << "C_BUILT_IFACES = \
";
-
- std::string bif = reduce<std::string>(c_built_ifaces.begin(),
- c_built_ifaces.end(),
- concater(" \
"));
-
- out_am << bif << "
";
-
- out_am << "C_WRAPPER_IFACES = $(C_EXTERNAL_IFACES) ";
-
- std::string wif = reduce<std::string>(c_wrapper_ifaces.begin(),
- c_wrapper_ifaces.end(),
- concater(" "));
-
- out_am << wif << "
"
- << "C_AUTO_IFACES = ";
-
- std::string nsaif = reduce<std::string>(c_auto_ifaces.begin(),
- c_auto_ifaces.end(),
- concater(" "));
-
- out_am << nsaif << "
";
-
- if (!c_suffix_auto_ifaces.empty())
- {
- out_am << "C_SUFFIX_AUTO_IFACES = ";
-
- std::string saif = reduce<std::string>(c_suffix_auto_ifaces.begin(),
- c_suffix_auto_ifaces.end(),
- concater(" "));
- out_am << saif << "
";
- }
- }
-
- if (any_cpp_ifaces)
- {
-
- out_am << "CPP_EXTERNAL_IFACES = \
";
-
- std::string cif = reduce<std::string>(cpp_external_ifaces.begin(),
- cpp_external_ifaces.end(),
- concater(" \
"));
-
- out_am << cif << "
";
-
- out_am << "CPP_BUILT_IFACES = \
";
-
- std::string bif = reduce<std::string>(cpp_built_ifaces.begin(),
- cpp_built_ifaces.end(),
- concater(" \
"));
-
- out_am << bif << "
";
-
- out_am << "CPP_WRAPPER_IFACES = $(CPP_EXTERNAL_IFACES) ";
-
- std::string wif = reduce<std::string>(cpp_wrapper_ifaces.begin(),
- cpp_wrapper_ifaces.end(),
- concater(" "));
-
- out_am << wif << "
"
- << "CPP_AUTO_IFACES = ";
-
- std::string nsaif = reduce<std::string>(cpp_auto_ifaces.begin(),
- cpp_auto_ifaces.end(),
- concater(" "));
-
-
- out_am << nsaif << "
";
-
- if (!cpp_suffix_auto_ifaces.empty())
- {
- out_am << "CPP_SUFFIX_AUTO_IFACES = ";
-
- std::string saif = reduce<std::string>(cpp_suffix_auto_ifaces.begin(),
- cpp_suffix_auto_ifaces.end(),
- concater(" "));
- out_am << saif << "
";
- }
- }
-
- out_am << pname << "_la_SOURCES = Makefile.am $(BUILT_SOURCES) \
";
-
- std::string src_str = reduce<std::string>(sources.begin(),
- sources.end(),
- concater(" \
"));
-
- out_am << src_str << " $(CPP_EXTERNAL_IFACES) $(C_EXTERNAL_IFACES)
";
-
- out_am << "BUILT_SOURCES = \
";
-
- std::string bs_str = reduce<std::string>(built_sources.begin(),
- built_sources.end(),
- concater(" \
"));
-
- out_am << bs_str << " $(CPP_BUILT_IFACES) $(C_BUILT_IFACES)
";
-
- out_am << "Makefile.am: " << psp_filename << "
"
- << " $(PLUC) create-am --force " << psp_filename << "
";
-
- for (StrList::const_iterator it = c_built_ifaces.begin();
- it != c_built_ifaces.end(); ++it)
- {
- out_am << *it << ": " << iface2specfile[*it] << "
"
- << " $(PLUC) create-ifs " << psp_filename << "
";
- }
-
- for (StrList::const_iterator it = cpp_built_ifaces.begin();
- it != cpp_built_ifaces.end(); ++it)
- {
- out_am << *it << ": " << iface2specfile[*it] << "
"
- << " $(PLUC) create-ifs " << psp_filename << "
";
- }
-
-
- // create headers for auto generated code
-
- // first c stuff
- for (StrList::const_iterator it = c_auto_ifaces.begin();
- it != c_auto_ifaces.end(); ++it)
- {
- std::string base = path_basename(*it);
- out_am << base << ".h: " << *it << "
"
- << " $(GIDLC) c-auto-header --suffix= " << *it
- << " > " << base << ".h
";
- }
-
- for (StrList::const_iterator it = c_suffix_auto_ifaces.begin();
- it != c_suffix_auto_ifaces.end(); ++it)
- {
- std::string base = path_basename(*it);
- out_am << base << "auto.h: " << *it << "
"
- << " $(GIDLC) c-auto-header " << *it
- << " > " << base << "auto.h
";
- }
-
- // now c++ stuff
- for (StrList::const_iterator it = cpp_auto_ifaces.begin();
- it != cpp_auto_ifaces.end(); ++it)
- {
- std::string base = path_basename(*it);
- out_am << base << ".h: " << *it << "
"
- << " $(GIDLC) cpp-auto-header --suffix= " << *it
- << " > " << base << ".h
";
- }
-
- for (StrList::const_iterator it = cpp_suffix_auto_ifaces.begin();
- it != cpp_suffix_auto_ifaces.end(); ++it)
- {
- std::string base = path_basename(*it);
- out_am << base << "auto.h: " << *it << "
"
- << " $(GIDLC) cpp-auto-header " << *it
- << " > " << base << "auto.h
";
- }
-
- // create wrapper headers for external interfaces
- for (StrList::const_iterator it = c_external_ifaces.begin();
- it != c_external_ifaces.end(); ++it)
- {
- std::string if_name = path_basename(path_filename(*it));
- std::string header_name = if_name + "vtablestruct.h";
-
- out_am << header_name << ": " << *it << "
"
- << " $(GIDLC) c-wrapper-header " << *it << " > "
- << header_name << "
";
- }
-
- for (StrList::const_iterator it = cpp_external_ifaces.begin();
- it != cpp_external_ifaces.end(); ++it)
- {
- std::string if_name = path_basename(path_filename(*it));
- std::string header_name = if_name + "wrapper.h";
-
- out_am << header_name << ": " << *it << "
"
- << " $(GIDLC) cpp-wrapper-header " << *it << " > "
- << header_name << "
";
- }
-
- // create wrapper headers for link interfaces
-
- // ... for c
- for (StrList::const_iterator it = c_wrapper_ifaces.begin();
- it != c_wrapper_ifaces.end(); ++it)
- {
- std::string if_name = path_basename(path_filename(*it));
- std::string header_name = if_name + "vtablestruct.h";
-
- out_am << header_name << ": " << *it << "
"
- << " $(GIDLC) c-wrapper-header " << *it << " > "
- << header_name << "
"
- << " cp " << *it << " $(IFACE_DIR)
";
- }
-
- // ... for c++
- for (StrList::const_iterator it = cpp_wrapper_ifaces.begin();
- it != cpp_wrapper_ifaces.end(); ++it)
- {
- std::string if_name = path_basename(path_filename(*it));
- std::string header_name = if_name + "wrapper.h";
-
- out_am << header_name << ": " << *it << "
"
- << " $(GIDLC) cpp-wrapper-header " << *it << " > "
- << header_name << "
"
- << " cp " << *it << " $(IFACE_DIR)
";
- }
-
- // create export, wrapper, and glue implementation
- out_am << pname << "_export.c: " << psp_filename << "
"
- << " $(PLUC) create-export-code --out="
- << pname << "_export.c " << psp_filename << "
"
- << pname << "_export.h: " << psp_filename << "
"
- << " $(PLUC) create-export-header --out="
- << pname << "_export.h " << psp_filename << "
";
-
- if (any_c_ifaces && any_cpp_ifaces)
- {
- out_am << pname << "_glue.h: $(C_BUILT_IFACES) $(CPP_BUILT_IFACES)
"
- << " $(GIDLC) c-glue-header $(C_BUILT_IFACES) > "
- << pname << "_glue.h
"
- << " $(GIDLC) cpp-glue-header $(CPP_BUILT_IFACES) >> "
- << pname << "_glue.h
";
- }
- else if (any_c_ifaces)
- {
- out_am << pname << "_glue.h: $(C_BUILT_IFACES)
"
- << " $(GIDLC) c-glue-header $(C_BUILT_IFACES) > "
- << pname << "_glue.h
";
- }
- else
- {
- out_am << pname << "_glue.h: $(CPP_BUILT_IFACES)
"
- << " $(GIDLC) cpp-glue-header $(CPP_BUILT_IFACES) > "
- << pname << "_glue.h
";
- }
-
- if (any_c_ifaces)
- {
- out_am << pname << "_c_glue.c: $(C_BUILT_IFACES)
"
- << " $(GIDLC) c-glue-code $(C_BUILT_IFACES) > "
- << pname << "_c_glue.c
"
- << pname << "_c_wrapper.c: $(C_WRAPPER_IFACES)
"
- << " $(GIDLC) c-wrapper-code $(C_WRAPPER_IFACES) > "
- << pname << "_c_wrapper.c
"
- << pname << "_c_auto.c: $(C_AUTO_IFACES) $(C_SUFFIX_AUTO_IFACES)
"
- << " $(GIDLC) c-auto-code --suffix= $(C_AUTO_IFACES) > "
- << pname << "_c_auto.c
";
- if (!c_suffix_auto_ifaces.empty())
- {
- out_am << " $(GIDLC) c-auto-code $(C_SUFFIX_AUTO_IFACES) >> "
- << pname << "_c_auto.c
";
- }
- out_am << "
";
- }
-
- if (any_cpp_ifaces)
- {
- out_am << pname << "_cpp_glue.cpp: $(CPP_BUILT_IFACES)
"
- << " $(GIDLC) cpp-glue-code $(CPP_BUILT_IFACES) > "
- << pname << "_cpp_glue.cpp
"
- << pname << "_cpp_wrapper.cpp: $(CPP_WRAPPER_IFACES)
"
- << " $(GIDLC) cpp-wrapper-code $(CPP_WRAPPER_IFACES) > "
- << pname << "_cpp_wrapper.cpp
"
- << pname << "_cpp_auto.cpp: $(CPP_AUTO_IFACES) $(CPP_SUFFIX_AUTO_IFACES)
"
- << " $(GIDLC) cpp-auto-code --suffix= $(CPP_AUTO_IFACES) > "
- << pname << "_cpp_auto.cpp
";
- if (!cpp_suffix_auto_ifaces.empty())
- {
- out_am << " $(GIDLC) cpp-auto-code $(CPP_SUFFIX_AUTO_IFACES) >> "
- << pname << "_cpp_auto.cpp
";
- }
- out_am << "
";
- }
-
- out_am << pname << "_la_LDFLAGS = -module -avoid-version
"
- << "CLEANFILES = $(BUILT_SOURCES)
";
-
+ //TODO
return true;
}
@@ -1278,8 +715,8 @@
<< "#endif
"
<< " const char* dock(void);
"
<< " void undock(void);
"
- << " void** board(const char*);
"
- << " void unboard(const char*, void**);
"
+ << " void* board(const char*);
"
+ << " void unboard(const char*, void*);
"
<< "#ifdef __cplusplus
"
<< "}
"
<< "#endif
"
@@ -1298,97 +735,50 @@
out << "#include \"" << header_filename << "\"
";
out << "#include \"" << *psp.m_name << "_glue.h\"
";
- typedef std::list<std::pair<std::string, std::string> > StrPairList;
- StrPairList exports;
-
- for (FileDescList::const_iterator it = file_descs.begin();
- it != file_descs.end(); ++it)
- {
- const FileDesc* fd = *it;
-
- if (typeid(*fd) == typeid(UnitSpecDesc))
- {
- const UnitSpecDesc* usd = dynamic_cast<const UnitSpecDesc*>(fd);
- const pluc::UnitSpec* usp = usd->sp;
-
- std::string version = (*usp->m_spec)["version"];
- version = version.substr(0, version.find("."));
-
- exports.push_back(std::make_pair("UnitFactory",
- *usp->m_name + "Factory:"
- + version));
- }
- else if (typeid(*fd) == typeid(LinkSpecDesc))
- {
- const LinkSpecDesc* lsd = dynamic_cast<const LinkSpecDesc*>(fd);
- const pluc::LinkSpec* lsp = lsd->sp;
-
- std::string version = (*lsp->m_spec)["version"];
- version = version.substr(0, version.find("."));
-
- exports.push_back(std::make_pair("LinkFactory",
- *lsp->m_name + "Factory:"
- + version));
- }
- }
-
out << "const char* dock(void)
"
<< "{
"
<< " return \"";
- for (StrPairList::const_iterator it = exports.begin();
- it != exports.end(); ++it)
+
+ for (FileDescList::const_iterator it = file_descs.begin();
+ it != file_descs.end(); ++it)
{
- out << it->first << ":" << it->second << ";";
+ out << (*it)->type_class() << ":" << (*it)->export_id() << ";";
}
out << "\";
"
<< "}
"
<< "void undock(void) {}
"
- << "void** board(const char* name)
{
";
+ << "void* board(const char* name)
{
";
- for (StrPairList::const_iterator it = exports.begin();
- it != exports.end(); ++it)
+ for (FileDescList::const_iterator it = file_descs.begin();
+ it != file_descs.end(); ++it)
{
- std::string type = it->second;
- std::string::size_type pos = type.find(":");
- assert(pos != std::string::npos);
- std::string type_base = tolower(type.substr(0, pos));
- std::string type_version = type.substr(pos+1);
-
- // split of "factory"
- type_base = type_base.substr(0, type_base.length() - 7);
-
- std::string prefix = type_base + "_" + type_version + "factory";
-
- if (it != exports.begin())
+ if (it != file_descs.begin())
out << " else ";
else
out << " ";
- out << "if (strcmp(name, \"" << it->second << "\") == 0)
"
- << " return " << prefix << "_create_vtable();
";
+ out << "if (strcmp(name, \"" << (*it)->export_id() << "\") == 0)
"
+ << " return new " << (*it)->class_name() << "();
";
}
out << " return 0;
}
"
- << "void unboard(const char* name, void** vtable)
{
";
+ << "void unboard(const char* name, void* obj)
{
";
- /* for (StrPairList::const_iterator it = exports.begin();
- it != exports.end(); ++it)
+ for (FileDescList::const_iterator it = file_descs.begin();
+ it != file_descs.end(); ++it)
{
- std::string type = it->second;
- type = type.substr(0, type.find(":"));
- std::string prefix = tolower(type);
-
- if (it != exports.begin())
+ if (it != file_descs.begin())
out << " else ";
else
out << " ";
- out << "if (strcmp(name, \"" << it->second << "\") == 0)
"
- << " " << prefix << "_destroy_vtable(vtable);
";
- }*/
-
- out << "}
";
+ out << "if (strcmp(name, \"" << (*it)->export_id() << "\") == 0)
"
+ << " delete reinterpret_cast<" << (*it)->class_name()
+ << "*>(obj);
";
+ }
+
+ out << " return;
}
";
return true;
}
@@ -1418,82 +808,20 @@
}
else if (cmd == "create-skeleton")
{
- bool ret = execute_cmd("create-ifs", options, psp_filename,
- psp, file_descs);
-
- if (!ret)
- return false;
-
- std::map<std::string, std::string>::const_iterator
- it = options.find("gidlc");
-
- if (it == options.end())
- {
- std::cerr << "You must tell me the full path of the gidlc
"
- << "binary with --gidlc=<foo/bar/gidlc>
";
- return false;
- }
-
- std::string gidlc_cmd = it->second;
-
for (FileDescList::const_iterator it = file_descs.begin();
it != file_descs.end(); ++it)
{
const FileDesc* fd = *it;
- std::string fname = fd->fname;
- std::string lang = fd->lang;
-
- std::string full_basename = full_base_filename(fd);
- std::string full_if_name = full_iface_filename(fd);
+ std::string fname = fd->fname();
- std::ostringstream cmdline;
- if (lang == "C")
+ if (fd->type() == FileDesc::UNIT)
{
- if (file_exists(full_basename + ".h") ||
- file_exists(full_basename + ".c"))
- {
- std::cerr << "Not overwriting existing file!
";
- return false;
- }
-
- cmdline << gidlc_cmd << " c-skel-header "
- << full_if_name << " > " << full_basename << ".h";
- if (!sys_exec(cmdline.str()))
- {
- return false;
- }
- cmdline.str("");
-
- cmdline << gidlc_cmd << " c-skel-code "
- << full_if_name << " > " << full_basename << ".c";
- if (!sys_exec(cmdline.str()))
- {
- return false;
- }
- }
- else if (lang == "C++")
- {
- if (file_exists(full_basename + ".h") ||
- file_exists(full_basename + ".cpp"))
- {
- std::cerr << "Not overwriting existing file!
";
- return false;
- }
-
- cmdline << gidlc_cmd << " cpp-skel-header "
- << full_if_name << " > " << full_basename << ".h";
- if (!sys_exec(cmdline.str()))
- {
- return false;
- }
- cmdline.str("");
-
- cmdline << gidlc_cmd << " cpp-skel-code "
- << full_if_name << " > " << full_basename << ".cpp";
- if (!sys_exec(cmdline.str()))
- {
- return false;
- }
+ const UnitSpecDesc* usd
+ = dynamic_cast<const UnitSpecDesc*>(fd);
+
+ create_update_wrapper(std::cout,
+ usd->class_name(),
+ usd->port_list());
}
}
}
@@ -1558,53 +886,6 @@
return ret;
}
- else if (cmd == "create-ifs")
- {
- for (FileDescList::const_iterator it = file_descs.begin();
- it != file_descs.end(); ++it)
- {
- const FileDesc* fd = *it;
-
- std::string if1_filename = full_iface_filename(fd);
- std::string if2_filename = full_iface_factory_filename(fd);
- std::ofstream out1_file(if1_filename.c_str());
- std::ofstream out2_file(if2_filename.c_str());
-
- if (!out1_file)
- {
- std::cerr << "Could not open "
- << if1_filename << " for writing
";
- return false;
- }
-
- if (!out2_file)
- {
- std::cerr << "Could not open "
- << if2_filename << " for writing
";
- return false;
- }
-
- if (typeid(*fd) == typeid(UnitSpecDesc))
- {
- const UnitSpecDesc* usd = dynamic_cast<const UnitSpecDesc*>(fd);
- const pluc::UnitSpec* usp = usd->sp;
-
- create_unitfactory_if(out2_file, *usp);
- create_unit_if(out1_file, *usp);
- }
- else if (typeid(*fd) == typeid(LinkSpecDesc))
- {
- const LinkSpecDesc* lsd = dynamic_cast<const LinkSpecDesc*>(fd);
- const pluc::LinkSpec* lsp = lsd->sp;
-
- create_linkfactory_if(out2_file, *lsp);
- create_link_if(out1_file, *lsp);
- }
-
- out1_file.close();
- out2_file.close();
- }
- }
else
{
std::cerr << "Unknown command '" << cmd << "'
";
@@ -1681,7 +962,6 @@
it != psp.m_files->end(); ++it)
{
std::string filename = (*it)->find("file")->second;
- std::string lang = (*it)->find("lang")->second;
//std::cout << "Parsing " << filename
//<< "(lang = '" << lang << "')...
";
@@ -1712,7 +992,7 @@
if (!check_usp(*usp))
return false; //TODO: cleanup
- file_descs.push_back(new UnitSpecDesc(usp, filename, lang));
+ file_descs.push_back(new UnitSpecDesc(usp, filename));
}
else if (tmp_spec.lspec != 0)
{
@@ -1720,7 +1000,7 @@
if (!check_link_spec(*lsp))
return false; //TODO: cleanup
- file_descs.push_back(new LinkSpecDesc(lsp, filename, lang));
+ file_descs.push_back(new LinkSpecDesc(lsp, filename));
}
}
--- orig/pluc/src/pluc_parser.tab.cpp
+++ mod/pluc/src/pluc_parser.tab.cpp
@@ -95,7 +95,7 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2004
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
--- orig/pluc/src/pluc_parser.ypp
+++ mod/pluc/src/pluc_parser.ypp
@@ -3,7 +3,7 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2004
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
--- orig/pluc/src/spec.cpp
+++ mod/pluc/src/spec.cpp
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2004
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
--- orig/pluc/src/spec.h
+++ mod/pluc/src/spec.h
@@ -1,6 +1,6 @@
/* This source file is a part of the GePhex Project.
- Copyright (C) 2001-2004
+ Copyright (C) 2001-2005
Georg Seidel <[email protected]>
Martin Bayer <[email protected]>
--- orig/plugins/src/Makefile.am
+++ mod/plugins/src/Makefile.am
@@ -1 +1 @@
-SUBDIRS = core freeframe_loader
+SUBDIRS = core