~ubuntu-branches/ubuntu/breezy/atlas-cpp/breezy

« back to all changes in this revision

Viewing changes to Atlas/Objects/Encoder.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2005-10-02 11:41:44 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051002114144-8qmn4d1cdn9g27ta
Tags: 0.5.98-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * This Encoder can be used to send objects in the Atlas::Objects hierarchy to
16
16
 * a certain Bridge (e.g. a codec).
17
17
 *
18
 
 * Simply call the StreamMessage member with a pointer to the object to be
 
18
 * Simply call the streamMessage member with a pointer to the object to be
19
19
 * sent.
20
20
 *
21
21
 * @see Atlas::Objects::Decoder
22
22
 * @author Stefanus Du Toit <sdt@gmx.net>
23
23
 */
24
 
class Encoder : public Atlas::EncoderBase
 
24
class ObjectsEncoder : public Atlas::EncoderBase
25
25
{
26
26
public:
27
27
    /// The default constructor.
28
28
    /// @param b The Bridge to which objects are to be sent.
29
 
    Encoder(Atlas::Bridge* b) : EncoderBase(b) { }
 
29
    explicit ObjectsEncoder(Atlas::Bridge & b) : EncoderBase(b) { }
30
30
    /// The default destructor.
31
 
    virtual ~Encoder() { }
 
31
    ~ObjectsEncoder();
32
32
 
33
33
    /// Send an object to the bridge.
34
34
    /// @param o The object that is to be sent.
35
 
    virtual void streamMessage(const Atlas::Objects::Root* o)
 
35
    template <class ObjectData>
 
36
    void streamObjectsMessage(const Atlas::Objects::SmartPtr<ObjectData> & o)
36
37
    {
37
 
        b->streamMessage(Bridge::MapBegin);
38
 
        o->sendContents(b);
39
 
        b->mapEnd();
 
38
        m_b.streamMessage();
 
39
        o->sendContents(m_b);
 
40
        m_b.mapEnd();
40
41
    }
41
42
};
42
43