source: XIOS/dev/dev_trunk_omp/src/filter/data_packet.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: 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  /*!
12   * A packet corresponds to a timestamped array of data.
13   */
14  struct CDataPacket
15  {
16    /*!
17     * Describes the status associated to a packet
18     */
19    enum StatusCode {
20      NO_ERROR,     //!< No error were encountered when handling the packet
21      END_OF_STREAM //!< Last packet of the stream, does not have data
22    };
23
24    CArray<double, 1> data; //!< Array containing the data
25    CDate date;             //!< Date associated to the data
26    Time timestamp;         //!< Timestamp of the data
27    StatusCode status;      //!< Status of the packet
28    int src_filterID;
29    std::vector<int> filterIDoutputs;
30    StdString fieldID;
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      CDataPacket* p = new CDataPacket;
39      p->data.resize(data.shape());
40      p->data = data;
41      p->date = date;
42      p->timestamp = timestamp;
43      p->status = status;
44      return p;
45    };
46  }; // struct CDataPacket
47
48  typedef std::shared_ptr<CDataPacket> CDataPacketPtr;
49  typedef std::shared_ptr<const CDataPacket> CConstDataPacketPtr;
50} // namespace xios
51
52#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.