source: XIOS/dev/XIOS_DEV_CMIP6/src/filter/data_packet.hpp @ 1251

Last change on this file since 1251 was 643, checked in by rlacroix, 9 years ago

Use the filter infrastructure to handle the temporal operations.

Add a temporal filter to do so.

File size: 1.2 KB
Line 
1#ifndef __XIOS_CDataPacket__
2#define __XIOS_CDataPacket__
3
4#include <boost/shared_ptr.hpp>
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
29    /*!
30     * Creates a deep copy of the packet.
31     *
32     * \return a deep copy of the packet
33     */
34    CDataPacket* copy() const {
35      CDataPacket* p = new CDataPacket;
36      p->data.resize(data.shape());
37      p->data = data;
38      p->date = date;
39      p->timestamp = timestamp;
40      p->status = status;
41      return p;
42    };
43  }; // struct CDataPacket
44
45  typedef boost::shared_ptr<CDataPacket> CDataPacketPtr;
46  typedef boost::shared_ptr<const CDataPacket> CConstDataPacketPtr;
47} // namespace xios
48
49#endif //__XIOS_CDataPacket__
Note: See TracBrowser for help on using the repository browser.