source: XIOS/dev/dev_ym/XIOS_COUPLING/src/filter/data_packet.hpp @ 2230

Last change on this file since 2230 was 2143, checked in by yushan, 3 years ago

Big commit on graph functionality. Add buildWorkflowGraph function for filters

File size: 1.4 KB
Line 
1#ifndef __XIOS_CDataPacket__
2#define __XIOS_CDataPacket__
3
4#include <memory>
5
6#include "array_new.hpp"
7#include "date.hpp"
8#include "graph_package.hpp"
9
10namespace xios
11{
12  /*!
13   * A packet corresponds to a timestamped array of data.
14   */
15  struct CDataPacket
16  {
17    /*!
18     * Describes the status associated to a packet
19     */
20    enum StatusCode {
21      NO_ERROR,     //!< No error were encountered when handling the packet
22      END_OF_STREAM //!< Last packet of the stream, does not have data
23    };
24
25    CGraphDataPackage * graphPackage;
26
27    CArray<double, 1> data; //!< Array containing the data
28    CDate date;             //!< Date associated to the data
29    Time timestamp;         //!< Timestamp of the data
30    StatusCode status;      //!< Status of the packet
31
32    /*!
33     * Creates a deep copy of the packet.
34     *
35     * \return a deep copy of the packet
36     */
37    CDataPacket* copy() const 
38    {
39      CDataPacket* p = new CDataPacket;
40      p->data.resize(data.shape());
41      p->data = data;
42      p->date = date;
43      p->timestamp = timestamp;
44      p->status = status;
45      p->graphPackage = graphPackage;
46      return p;
47    };
48
49
50    CDataPacket() : graphPackage(nullptr) {}
51
52  }; // struct CDataPacket
53
54  typedef std::shared_ptr<CDataPacket> CDataPacketPtr;
55  typedef std::shared_ptr<const CDataPacket> CConstDataPacketPtr;
56} // namespace xios
57
58#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.