~ubuntu-branches/ubuntu/saucy/zeromq3/saucy

« back to all changes in this revision

Viewing changes to src/i_encoder.hpp

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-10-16 19:49:30 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20121016194930-98r0bi746eoaa4iv
Tags: 3.2.1~rc2+dfsg-1
* New upstream RC release (Closes: #690704)
* Bump Standards-Version to 3.9.4 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2007-2012 iMatix Corporation
 
3
    Copyright (c) 2007-2012 Other contributors as noted in the AUTHORS file
 
4
 
 
5
    This file is part of 0MQ.
 
6
 
 
7
    0MQ is free software; you can redistribute it and/or modify it under
 
8
    the terms of the GNU Lesser General Public License as published by
 
9
    the Free Software Foundation; either version 3 of the License, or
 
10
    (at your option) any later version.
 
11
 
 
12
    0MQ is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
    GNU Lesser General Public License for more details.
 
16
 
 
17
    You should have received a copy of the GNU Lesser General Public License
 
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*/
 
20
 
 
21
#ifndef __ZMQ_I_ENCODER_HPP_INCLUDED__
 
22
#define __ZMQ_I_ENCODER_HPP_INCLUDED__
 
23
 
 
24
#include "stdint.hpp"
 
25
 
 
26
namespace zmq
 
27
{
 
28
 
 
29
    //  Forward declaration
 
30
    class i_msg_source;
 
31
 
 
32
    //  Interface to be implemented by message encoder.
 
33
 
 
34
    struct i_encoder
 
35
    {
 
36
        virtual ~i_encoder () {}
 
37
 
 
38
        //  Set message producer.
 
39
        virtual void set_msg_source (i_msg_source *msg_source_) = 0;
 
40
 
 
41
        //  The function returns a batch of binary data. The data
 
42
        //  are filled to a supplied buffer. If no buffer is supplied (data_
 
43
        //  is NULL) encoder will provide buffer of its own.
 
44
        //  If offset is not NULL, it is filled by offset of the first message
 
45
        //  in the batch.If there's no beginning of a message in the batch,
 
46
        //  offset is set to -1.
 
47
        virtual void get_data (unsigned char **data_, size_t *size_,
 
48
            int *offset_ = NULL) = 0;
 
49
 
 
50
    };
 
51
 
 
52
}
 
53
 
 
54
#endif