source: XIOS/dev/dev_olga/src/filter/output_pin.hpp @ 1654

Last change on this file since 1654 was 1654, checked in by oabramkina, 3 years ago

Corrections for workflow visualization.

File size: 3.4 KB
Line 
1#ifndef __XIOS_COutputPin__
2#define __XIOS_COutputPin__
3
4#include "garbage_collector.hpp"
5#include "input_pin.hpp"
6
7namespace xios
8{
9  /*!
10   * An output pin handles the connections with downstream filters.
11   */
12  class COutputPin : public InvalidableObject
13  {
14    public:
15      /*!
16       * Constructs an ouput pin with manual or automatic trigger
17       * and an associated garbage collector.
18       *
19       * \param gc the garbage collector associated with this ouput pin
20       * \param slotsCount the number of slots
21       * \param buildWorkflowGraph indicates whether data will be visualized
22       */
23      COutputPin(CGarbageCollector& gc, bool manualTrigger = false, bool buildWorkflowGraph = false);
24
25      StdString virtual GetName(void);
26     
27      /*!
28       * Connects to a specific slot of the input pin of a downstream filter.
29       * Note that the output pin holds a reference on the downstream filter.
30       *
31       * \param inputPin the input pin to connect
32       * \param inputSlot the input slot number
33       */
34      void connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot);
35
36      /*!
37       * Triggers the output of any buffered packet for the specified timestamp.
38       *
39       * \param timestamp the timestamp for which we are triggering the output
40       */
41      void virtual trigger(Time timestamp);
42
43      /*!
44       * Tests if the pin can be triggered.
45       *
46       * \return true if the pin can be triggered
47       */
48      bool virtual canBeTriggered() const;
49
50      /*!
51       * Tests if the pin must auto-trigger.
52       *
53       * \return true if the pin must auto-trigger
54       */
55      bool virtual mustAutoTrigger() const;
56
57      /*!
58       * Tests whether data is expected for the specified date.
59       *
60       * \param date the date associated to the data
61       */
62      bool virtual isDataExpected(const CDate& date) const;
63
64      /*!
65       * Removes all pending packets which are older than the specified timestamp.
66       *
67       * \param timestamp the timestamp used for invalidation
68       */
69      void virtual invalidate(Time timestamp);
70
71      /*!
72       * Returns filter's id needed in case of building workflow graph
73       */
74      int getFilterId();
75
76    protected:
77      /*!
78       * Function triggered when a packet is ready to be delivered.
79       *
80       * \param packet the packet ready for output
81       */
82      void onOutputReady(CDataPacketPtr packet);
83
84      /*!
85       * Informs the downstream pins that this output pin should be triggered.
86       */
87      void setOutputTriggers();
88
89    private:
90      /*!
91       * Delivers an output packet to the downstreams filter.
92       *
93       * \param packet the packet to output
94       */
95      void deliverOuput(CDataPacketPtr packet);
96
97      CGarbageCollector& gc; //!< The garbage collector associated to the output pin
98
99      //! Whether the ouput should be triggered manually
100      bool manualTrigger;
101
102      //! The list of connected filters and the corresponding slot numbers
103      std::vector<std::pair<std::shared_ptr<CInputPin>, size_t> > outputs;
104
105      //! Output buffer, store the packets until the output is triggered
106      std::map<Time, CDataPacketPtr> outputPackets;
107
108      //! Indicates whether the workflow will be visualized
109      bool buildWorkflowGraph;
110
111      //! Filter's id needed in case of building a workflow graph
112      int filterId;
113
114
115  }; // class COutputPin
116} // namespace xios
117
118#endif //__XIOS_COutputPin__
Note: See TracBrowser for help on using the repository browser.