source: XIOS/dev/dev_trunk_omp/src/filter/data_packet.hpp @ 1679

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

MARK: Dynamic workflow graph developement. Branch up to date with trunk @1676. Using vis.js

File size: 1.3 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
9namespace xios
10{
11  class CField;
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    CArray<double, 1> data; //!< Array containing the data
26    CDate date;             //!< Date associated to the data
27    Time timestamp;         //!< Timestamp of the data
28    StatusCode status;      //!< Status of the packet
29    int src_filterID;
30    std::vector<int> filterIDoutputs;
31    CField *field;
32   
33    /*!
34     * Creates a deep copy of the packet.
35     *
36     * \return a deep copy of the packet
37     */
38    CDataPacket* copy() const {
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      return p;
46    };
47  }; // struct CDataPacket
48
49  typedef std::shared_ptr<CDataPacket> CDataPacketPtr;
50  typedef std::shared_ptr<const CDataPacket> CConstDataPacketPtr;
51} // namespace xios
52
53#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.