source: XIOS/trunk/src/filter/data_packet.hpp @ 1876

Last change on this file since 1876 was 1876, checked in by yushan, 4 years ago

trunk : Bug fixed in workflow graph. wrong connection happens when a chain of arithmetic operations is applied on a field.

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=0;
30    std::vector<int> filterIDoutputs;
31    CField *field=nullptr;
32    int distance=-1;
33   
34    /*!
35     * Creates a deep copy of the packet.
36     *
37     * \return a deep copy of the packet
38     */
39    CDataPacket* copy() const {
40      CDataPacket* p = new CDataPacket;
41      p->data.resize(data.shape());
42      p->data = data;
43      p->date = date;
44      p->timestamp = timestamp;
45      p->status = status;
46      return p;
47    };
48  }; // struct CDataPacket
49
50  typedef std::shared_ptr<CDataPacket> CDataPacketPtr;
51  typedef std::shared_ptr<const CDataPacket> CConstDataPacketPtr;
52} // namespace xios
53
54#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.