File: MEncoder.h

package info (click to toggle)
atlas-cpp 0.5.98-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,652 kB
  • ctags: 2,284
  • sloc: sh: 8,305; cpp: 6,372; python: 1,471; makefile: 216
file content (52 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// This file may be redistributed and modified only under the terms of
// the GNU Lesser General Public License (See COPYING for details).
// Copyright (C) 2000 Stefanus Du Toit

#ifndef ATLAS_MESSAGE_ENCODER_H
#define ATLAS_MESSAGE_ENCODER_H

#include <Atlas/EncoderBase.h>

#include <map>
#include <vector>
#include <string>

namespace Atlas { namespace Message {

class Element;

typedef std::map<std::string, Element> MapType;
typedef std::vector<Element> ListType;

/** Encoder that transmits Atlas::Message::Element.
 *
 * This encoder can be used to send Atlas::Message::Element objects representing
 * full atlas messages.
 *
 * @see Element
 * @see Atlas::Bridge
 * @see Atlas::EncoderBase
 * @author Stefanus Du Toit <sdt@gmx.net>
 */
class Encoder : public Atlas::EncoderBase
{
public:
    explicit Encoder(Atlas::Bridge &);

    ~Encoder();

    /// Send a message (must be a map!) in stream state.
    void streamMessageElement(const MapType & obj);
    /// Send an object as a map item.
    void mapElementItem(const std::string&, const Element&);
    void mapElementMapItem(const std::string&, const MapType&);
    void mapElementListItem(const std::string&, const ListType&);
    /// Send an object as a list item.
    void listElementItem(const Element&);
    void listElementMapItem(const MapType&);
    void listElementListItem(const ListType&);
};

} } // namespace Atlas::Message

#endif