refactor interfaceproxy.cpp to rather include the definitions
this allows to put the proxy definitions alongside with the actually implementing service, which makes much more sense than having all in one huge interfaceproxy.cpp file
This commit is contained in:
parent
da2519ac34
commit
268f8cbc4c
4 changed files with 287 additions and 160 deletions
|
|
@ -100,172 +100,25 @@ namespace lumiera {
|
|||
|
||||
|
||||
|
||||
/* ==================== GuiNotification =================================== */
|
||||
|
||||
/* ===================================================================== */
|
||||
/* including explicit Proxy-Definitions for all facade interfaces */
|
||||
/* ===================================================================== */
|
||||
|
||||
|
||||
|
||||
/* ==================== GuiNotification ================================ */
|
||||
|
||||
#include "include/guinotification-facade.h"
|
||||
|
||||
namespace gui {
|
||||
|
||||
/** storage for the facade proxy factory
|
||||
* used by client code to invoke through the interface */
|
||||
lumiera::facade::Accessor<GuiNotification> GuiNotification::facade;
|
||||
|
||||
} // namespace gui
|
||||
#include "gui/notification-interface-proxy.hpp"
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
/* ==================== gui::Display =================================== */
|
||||
|
||||
typedef InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0)
|
||||
, gui::GuiNotification
|
||||
> IHandle_GuiNotification;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_GuiNotification>
|
||||
: public Holder<IHandle_GuiNotification>
|
||||
{
|
||||
//----Proxy-Implementation-of-GuiNotification--------
|
||||
|
||||
void displayInfo (string const& text) { _i_.displayInfo (cStr(text)); }
|
||||
void triggerGuiShutdown (string const& cause) { _i_.triggerGuiShutdown (cStr(cause)); }
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_GuiNotification> (IHandle_GuiNotification const&);
|
||||
template void closeProxy<IHandle_GuiNotification> (void);
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
#include "gui/display-interface-proxy.hpp"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==================== gui::Display ====================================== */
|
||||
/* ==================== DummyPlayer ==================================== */
|
||||
|
||||
#include "include/display-facade.h"
|
||||
|
||||
namespace lumiera {
|
||||
|
||||
/** storage for the facade proxy factory
|
||||
* used by client code to invoke through the interface */
|
||||
lumiera::facade::Accessor<Display> Display::facade;
|
||||
|
||||
/// emit the vtable here into this translation unit within liblumieracommon.so...
|
||||
Display::~Display() { }
|
||||
|
||||
} // namespace lumiera
|
||||
#include "proc/play/dummy-player-interface-proxy.hpp"
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
typedef InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_Display, 0)
|
||||
, lumiera::Display
|
||||
> IHandle_Display;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_Display>
|
||||
: public Holder<IHandle_Display>
|
||||
{
|
||||
//----Proxy-Implementation-of-lumiera::Display--------
|
||||
|
||||
Display::Sink
|
||||
getHandle (LumieraDisplaySlot display)
|
||||
{
|
||||
_i_.allocate (display);
|
||||
Sink sinkHandle;
|
||||
sinkHandle.activate (display, _i_.release);
|
||||
if (lumiera_error_peek() || !sinkHandle)
|
||||
throw lumiera::error::State("failed to allocate output DisplayerSlot",
|
||||
lumiera_error());
|
||||
return sinkHandle;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_Display> (IHandle_Display const&);
|
||||
template void closeProxy<IHandle_Display> (void);
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==================== DummyPlayer ======================================= */
|
||||
|
||||
#include "proc/play/dummy-player-service.hpp"
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
/** storage for the DummyPlayer facade proxy factory... */
|
||||
lumiera::facade::Accessor<DummyPlayer> DummyPlayer::facade;
|
||||
|
||||
} }
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
|
||||
, proc::play::DummyPlayer
|
||||
> IHandle_DummyPlayer;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_DummyPlayer>
|
||||
: public Holder<IHandle_DummyPlayer>
|
||||
{
|
||||
//----Proxy-Implementation-of-DummyPlayer--------
|
||||
typedef proc::play::DummyPlayer::Process Process;
|
||||
typedef proc::play::ProcessImpl ProcessImpl;
|
||||
|
||||
/** @note as an optimisation we hand out a direct reference
|
||||
* to the implementing process object. While this ref could
|
||||
* still be passed as handle to the C Language interface, using
|
||||
* it directly within the client (=GUI) bypasses the C interface
|
||||
* and thus leaves us only with one level of indirection,
|
||||
* irrespective if using the C or C++ interface.
|
||||
*/
|
||||
Process start(LumieraDisplaySlot viewerHandle)
|
||||
{
|
||||
ProcessImpl* pP = static_cast<ProcessImpl*> (_i_.startPlay (viewerHandle));
|
||||
|
||||
if (!pP)
|
||||
throw lumiera::error::State("failed to start DummyPlayer", lumiera_error());
|
||||
|
||||
return pP->createHandle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_DummyPlayer> (IHandle_DummyPlayer const&);
|
||||
template void closeProxy<IHandle_DummyPlayer> (void);
|
||||
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
|
|
|
|||
94
src/gui/display-interface-proxy.hpp
Normal file
94
src/gui/display-interface-proxy.hpp
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Display(Proxy) - service providing access to a display for outputting frames
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
|
||||
/** @file display-interface-proxy.hpp
|
||||
** This is an implementation fragment, intended to be included into common/interfaceproxy.cpp
|
||||
**
|
||||
** The purpose is to define a proxy implementation of lumiera::Display, in order to
|
||||
** redirect any calls through the associated C Language Interface "lumieraorg_Display"
|
||||
**
|
||||
** @see display-facade.hpp
|
||||
** @see display-service.hpp actual implementation within the GUI
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==================== gui::Display ====================================== */
|
||||
|
||||
#include "include/display-facade.h"
|
||||
|
||||
namespace lumiera {
|
||||
|
||||
/** storage for the facade proxy factory
|
||||
* used by client code to invoke through the interface */
|
||||
lumiera::facade::Accessor<Display> Display::facade;
|
||||
|
||||
/// emit the vtable here into this translation unit within liblumieracommon.so...
|
||||
Display::~Display() { }
|
||||
|
||||
} // namespace lumiera
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
typedef InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_Display, 0)
|
||||
, lumiera::Display
|
||||
> IHandle_Display;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_Display>
|
||||
: public Holder<IHandle_Display>
|
||||
{
|
||||
//----Proxy-Implementation-of-lumiera::Display--------
|
||||
|
||||
Display::Sink
|
||||
getHandle (LumieraDisplaySlot display)
|
||||
{
|
||||
_i_.allocate (display);
|
||||
Sink sinkHandle;
|
||||
sinkHandle.activate (display, _i_.release);
|
||||
if (lumiera_error_peek() || !sinkHandle)
|
||||
throw lumiera::error::State("failed to allocate output DisplayerSlot",
|
||||
lumiera_error());
|
||||
return sinkHandle;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_Display> (IHandle_Display const&);
|
||||
template void closeProxy<IHandle_Display> (void);
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
81
src/gui/notification-interface-proxy.hpp
Normal file
81
src/gui/notification-interface-proxy.hpp
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Notification(Proxy) - public service allowing to push informations into the GUI
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
|
||||
/** @file notification-interface-proxy.hpp
|
||||
** This is an implementation fragment, intended to be included into common/interfaceproxy.cpp
|
||||
**
|
||||
** The purpose is to define a proxy implementation of gui::GuiNotification, in order to
|
||||
** redirect any calls through the associated C Language Interface "lumieraorg_GuiNotification"
|
||||
**
|
||||
** @see guinotification-facade.hpp
|
||||
** @see notification-service.hpp actual implementation within the GUI
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==================== GuiNotification =================================== */
|
||||
|
||||
#include "include/guinotification-facade.h"
|
||||
|
||||
namespace gui {
|
||||
|
||||
/** storage for the facade proxy factory
|
||||
* used by client code to invoke through the interface */
|
||||
lumiera::facade::Accessor<GuiNotification> GuiNotification::facade;
|
||||
|
||||
} // namespace gui
|
||||
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
typedef InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0)
|
||||
, gui::GuiNotification
|
||||
> IHandle_GuiNotification;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_GuiNotification>
|
||||
: public Holder<IHandle_GuiNotification>
|
||||
{
|
||||
//----Proxy-Implementation-of-GuiNotification--------
|
||||
|
||||
void displayInfo (string const& text) { _i_.displayInfo (cStr(text)); }
|
||||
void triggerGuiShutdown (string const& cause) { _i_.triggerGuiShutdown (cStr(cause)); }
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_GuiNotification> (IHandle_GuiNotification const&);
|
||||
template void closeProxy<IHandle_GuiNotification> (void);
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
99
src/proc/play/dummy-player-interface-proxy.hpp
Normal file
99
src/proc/play/dummy-player-interface-proxy.hpp
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
DummyPlayer(Proxy) - access point and service implementing a dummy test player
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2009, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
|
||||
|
||||
/** @file dummy-player-interface-proxy.hpp
|
||||
** This is an implementation fragment, intended to be included into common/interfaceproxy.cpp
|
||||
**
|
||||
** The purpose is to define a proxy implementation of lumiera::DummyPlayer, in order to
|
||||
** redirect any calls through the associated C Language Interface "lumieraorg_DummyPlayer"
|
||||
**
|
||||
** @see dummy-player-facade.hpp
|
||||
** @see dummy-player-service.hpp actual implementation within the Proc-Layer
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ==================== DummyPlayer ======================================= */
|
||||
|
||||
#include "proc/play/dummy-player-service.hpp"
|
||||
|
||||
namespace proc {
|
||||
namespace play {
|
||||
|
||||
/** storage for the DummyPlayer facade proxy factory... */
|
||||
lumiera::facade::Accessor<DummyPlayer> DummyPlayer::facade;
|
||||
|
||||
} }
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
||||
typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_DummyPlayer, 0)
|
||||
, proc::play::DummyPlayer
|
||||
> IHandle_DummyPlayer;
|
||||
|
||||
|
||||
template<>
|
||||
class Proxy<IHandle_DummyPlayer>
|
||||
: public Holder<IHandle_DummyPlayer>
|
||||
{
|
||||
//----Proxy-Implementation-of-DummyPlayer--------
|
||||
typedef proc::play::DummyPlayer::Process Process;
|
||||
typedef proc::play::ProcessImpl ProcessImpl;
|
||||
|
||||
/** @note as an optimisation we hand out a direct reference
|
||||
* to the implementing process object. While this ref could
|
||||
* still be passed as handle to the C Language interface, using
|
||||
* it directly within the client (=GUI) bypasses the C interface
|
||||
* and thus leaves us only with one level of indirection,
|
||||
* irrespective if using the C or C++ interface.
|
||||
*/
|
||||
Process start(LumieraDisplaySlot viewerHandle)
|
||||
{
|
||||
ProcessImpl* pP = static_cast<ProcessImpl*> (_i_.startPlay (viewerHandle));
|
||||
|
||||
if (!pP)
|
||||
throw lumiera::error::State("failed to start DummyPlayer", lumiera_error());
|
||||
|
||||
return pP->createHandle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
Proxy (IHandle const& iha) : THolder(iha) {}
|
||||
};
|
||||
|
||||
|
||||
template void openProxy<IHandle_DummyPlayer> (IHandle_DummyPlayer const&);
|
||||
template void closeProxy<IHandle_DummyPlayer> (void);
|
||||
|
||||
|
||||
} // namespace facade
|
||||
|
||||
} // namespace lumiera
|
||||
Loading…
Reference in a new issue