home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / flowsystem.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  4.1 KB  |  148 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.     Boston, MA 02111-1307, USA.
  20.  
  21.     */
  22.  
  23. #ifndef FLOWSYSTEM_H
  24. #define FLOWSYSTEM_H
  25.  
  26. #include "arts_export.h"
  27. #include "object.h"
  28. #include "common.h"
  29.  
  30. /*
  31.  * BC - Status (2002-03-08): ScheduleNode, FlowSystem, FlowSystem_impl,
  32.  *   RemoteScheduleNode
  33.  *
  34.  * Heavy interactions with generated and hand-written code, flowsystem binding
  35.  * and whatever. DO KEEP COMPATIBLE. Do not change the underlying IDL MODEL.
  36.  * d ptrs available.
  37.  */
  38.  
  39. namespace Arts {
  40.  
  41. class Object_skel;
  42. class Object_stub;
  43. class RemoteScheduleNode;
  44. class ScheduleNodePrivate;
  45.  
  46. class ARTS_EXPORT ScheduleNode
  47. {
  48. private:
  49.     Object_base *_nodeObject;
  50.     ScheduleNodePrivate *d;    // unused
  51.  
  52. public:
  53.     ScheduleNode(Object_base *object);
  54.     virtual ~ScheduleNode();
  55.  
  56.     Object nodeObject();
  57.  
  58.     // check if this is a remote schedule node
  59.  
  60.     virtual RemoteScheduleNode *remoteScheduleNode();
  61.  
  62.     // other casts
  63.     
  64.     virtual void *cast(const std::string& target);
  65.  
  66.     // internal interface against Object_skel
  67.     
  68.     typedef bool (*QueryInitStreamFunc)(Object_skel *object,
  69.                                             const std::string& name);
  70.  
  71.     virtual void initStream(const std::string& name, void *ptr, long flags) = 0;
  72.  
  73.     // interface against node implementation
  74.     
  75.     virtual void requireFlow() = 0;
  76.     virtual void virtualize(const std::string& port, ScheduleNode *implNode,
  77.                                             const std::string& implPort) = 0;
  78.     virtual void devirtualize(const std::string& port, ScheduleNode *implNode,
  79.                                             const std::string& implPort) = 0;
  80.  
  81.     // interface to modify the node from outside
  82.     
  83.     virtual void start() = 0;
  84.     virtual void stop() = 0;
  85.     virtual void connect(const std::string& port, ScheduleNode *remoteNode,
  86.                                     const std::string& remotePort) = 0;
  87.     virtual void disconnect(const std::string& port, ScheduleNode *remoteNode,
  88.                                         const std::string& remotePort) = 0;
  89.  
  90.     // constant values
  91.     virtual void setFloatValue(const std::string& port, float value) = 0;
  92. };
  93.  
  94. class RemoteScheduleNodePrivate;
  95.  
  96. class ARTS_EXPORT RemoteScheduleNode : public ScheduleNode
  97. {
  98. private:
  99.     RemoteScheduleNodePrivate *d; // unused
  100. public:
  101.     RemoteScheduleNode(Object_stub *stub);
  102.  
  103.     RemoteScheduleNode *remoteScheduleNode();
  104.  
  105.     // internal interface against Object_skel
  106.     
  107.     void initStream(const std::string& name, void *ptr, long flags);
  108.  
  109.     // interface against node implementation
  110.     
  111.     void requireFlow();
  112.     virtual void virtualize(const std::string& port, ScheduleNode *implNode,
  113.                                             const std::string& implPort);
  114.     virtual void devirtualize(const std::string& port, ScheduleNode *implNode,
  115.                                             const std::string& implPort);
  116.  
  117.     // interface to modify the node from outside
  118.     
  119.     void start();
  120.     void stop();
  121.     void connect(const std::string& port, ScheduleNode *remoteNode,
  122.                                     const std::string& remotePort);
  123.     void disconnect(const std::string& port, ScheduleNode *remoteNode,
  124.                                         const std::string& remotePort);
  125.  
  126.     // constant values
  127.     void setFloatValue(const std::string& port, float value);
  128. };
  129.  
  130. class FlowSystem_impl_private;
  131.  
  132. class FlowSystem_impl :virtual public FlowSystem_skel
  133. {
  134. private:
  135.     FlowSystem_impl_private *d;
  136. public:
  137.     virtual ScheduleNode *addObject(Object_skel *object) = 0;
  138.     virtual void removeObject(ScheduleNode *node) = 0;
  139.     virtual bool suspendable() = 0;
  140.     virtual bool suspended() = 0;
  141.     virtual void suspend() = 0;
  142.     virtual void restart() = 0;
  143. };
  144.  
  145. }
  146.  
  147. #endif
  148.