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

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

Big commit on graph functionality. Add buildWorkflowGraph function for filters

File size: 1.4 KB
RevLine 
[637]1#ifndef __XIOS_CDataPacket__
2#define __XIOS_CDataPacket__
3
[1542]4#include <memory>
[637]5
6#include "array_new.hpp"
[643]7#include "date.hpp"
[2143]8#include "graph_package.hpp"
[637]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
[2143]25    CGraphDataPackage * graphPackage;
26
[637]27    CArray<double, 1> data; //!< Array containing the data
[643]28    CDate date;             //!< Date associated to the data
[637]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     */
[1930]37    CDataPacket* copy() const 
38    {
[637]39      CDataPacket* p = new CDataPacket;
40      p->data.resize(data.shape());
41      p->data = data;
[643]42      p->date = date;
[637]43      p->timestamp = timestamp;
44      p->status = status;
[2143]45      p->graphPackage = graphPackage;
[637]46      return p;
47    };
[2143]48
49
50    CDataPacket() : graphPackage(nullptr) {}
51
[637]52  }; // struct CDataPacket
53
[1542]54  typedef std::shared_ptr<CDataPacket> CDataPacketPtr;
55  typedef std::shared_ptr<const CDataPacket> CConstDataPacketPtr;
[637]56} // namespace xios
57
58#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.