Version: 9.15.0
InputPort.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef __INPUTPORT_HXX__
21 #define __INPUTPORT_HXX__
22 
23 #include "YACSlibEngineExport.hxx"
24 #include "Any.hxx"
25 #include "InPort.hxx"
26 #include "Runtime.hxx"
27 #include "DataFlowPort.hxx"
28 #include "ConversionException.hxx"
29 #include "yacsconfig.h"
30 
31 #include <string>
32 
33 namespace YACS
34 {
35  namespace ENGINE
36  {
37  class OutPort;
44  {
45  friend class Runtime; // for port creation
46  friend class OutPort;
47  public:
48  static const char NAME[];
49  public:
50  virtual ~InputPort();
51 
52  std::string getNameOfTypeOfCurrentInstance() const;
54 #ifdef NOCOVARIANT
55  virtual InPort *getPublicRepresentant() { return this; }
56 #else
57  virtual InputPort *getPublicRepresentant() { return this; }
58 #endif
59  virtual bool isIntermediate() const { return false; }
60  virtual bool edIsManuallyInitialized() const;
62  bool edIsInitialized() const;
63 
64  template<class T>
65  void edInit(T value);
66  void edInit(Any *value);
67  void edInit(const std::string& impl,const void* value);
68  virtual void edRemoveManInit();
69  virtual void checkBasicConsistency() const ;
70  virtual void exInit(bool start);
71  virtual void exSaveInit() = 0;
72  virtual void exRestoreInit() = 0;
73  virtual InputPort *clone(Node *newHelder) const = 0;
74  virtual bool isEmpty();
75 
76  virtual void *get() const = 0;
77  virtual void releaseData() = 0;
78  virtual void put(const void *data) = 0;
79  virtual std::string dump();
80  virtual std::string getHumanRepr();
81  virtual void setStringRef(std::string strRef);
82  virtual std::string typeName() {return "YACS__ENGINE__InputPort";}
83  bool canBeNull() const;
84  protected:
85  InputPort(const InputPort& other, Node *newHelder);
86  InputPort(const std::string& name, Node *node, TypeCode* type, bool canBeNull = false);
88  protected:
90  std::string _stringRef;
91  bool _canBeNull;
92  };
93 
100  {
101  public:
103  ~ProxyPort();
104 
105  void edRemoveAllLinksLinkedWithMe() ;
106  InputPort *clone(Node *newHelder) const;
107  void edNotifyReferencedBy(OutPort *fromPort, bool isLoopProof = true) override;
108  void edNotifyDereferencedBy(OutPort *fromPort);
109  std::set<OutPort *> edSetOutPort() const;
110 #ifdef NOCOVARIANT
111  InPort *getPublicRepresentant();
112 #else
113  InputPort *getPublicRepresentant();
114 #endif
115  void *get() const;
116  virtual void put(const void *data) ;
117  void releaseData() override;
118  int edGetNumberOfLinks() const;
119  bool isIntermediate() const { return true; }
120  void exRestoreInit();
121  void exSaveInit();
122  void getAllRepresentants(std::set<InPort *>& repr) const;
123  virtual std::string typeName() {return "YACS__ENGINE__ProxyPort";}
124  protected:
126  };
127 
128  template<class T>
129  void InputPort::edInit(T value)
130  {
131  Any* any=AtomAny::New(value);
132  try
133  {
134  edInit(any);
135  any->decrRef();
136  }
137  catch(ConversionException&)
138  {
139  any->decrRef();
140  throw;
141  }
142  }
143  }
144 }
145 
146 #endif
#define YACSLIBENGINE_EXPORT
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
static AtomAny * New(T val)
Definition: Any.hxx:126
Base class for Input Ports.
Definition: InputPort.hxx:44
virtual void put(const void *data)=0
virtual InputPort * clone(Node *newHelder) const =0
std::string _stringRef
Definition: InputPort.hxx:90
virtual InputPort * getPublicRepresentant()
returns the final physical port behind 'this'.
Definition: InputPort.hxx:57
virtual std::string typeName()
Definition: InputPort.hxx:82
virtual void * get() const =0
virtual void exRestoreInit()=0
virtual void exSaveInit()=0
virtual bool isIntermediate() const
Definition: InputPort.hxx:59
void edInit(T value)
Definition: InputPort.hxx:129
virtual void releaseData()=0
Base class for all nodes.
Definition: Node.hxx:70
Base class for Proxy Input Ports.
Definition: InputPort.hxx:100
bool isIntermediate() const
Definition: InputPort.hxx:119
virtual std::string typeName()
Definition: InputPort.hxx:123
Base class for all type objects.
Definition: TypeCode.hxx:68
Proc * p
Definition: driver.cxx:216