Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

libs/Network/uip/CallbackStream.h

Committer:
Michael J. Spencer
Date:
2014-02-28
Revision:
2:1df0b61d3b5a

File content as of revision 2:1df0b61d3b5a:

#ifndef CALLBACKSTREAM_H
#define CALLBACKSTREAM_H

typedef int (*cb_t)(const char *, void *);

#ifdef __cplusplus
#include "libs/StreamOutput.h"


class CallbackStream : public StreamOutput {
    public:
        CallbackStream(cb_t cb, void *u);
        virtual ~CallbackStream();
        int puts(const char*);
        void inc() { use_count++; }
        void dec();
        int get_count() { return use_count; }
        void mark_closed();

    private:
        cb_t callback;
        void *user;
        bool closed;
        int use_count;
};

#else

extern void *new_callback_stream(cb_t cb, void *);
extern void delete_callback_stream(void *);

#endif // __cplusplus

#endif