source: XIOS/dev/dev_trunk_omp/src/filter/output_pin.hpp @ 1677

Last change on this file since 1677 was 1677, checked in by yushan, 5 years ago

MARK: Dynamic workflow graph developement. Branch up to date with trunk @1663.

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