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

Last change on this file since 642 was 637, checked in by rlacroix, 9 years ago

Add the base classes for the new filter framework.

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