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

Last change on this file since 2010 was 1930, checked in by ymipsl, 4 years ago

Big update on on going work related to data distribution and transfer between clients and servers.
Revisite of the source and store filter using "connectors".

YM

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