X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FReadHelper.hh;h=011b51a370f95d8ae580741269c8068796baf284;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=d1393ad3ba3507e1c1c389ce7ca2c59524c92c07;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Scheduler/ReadHelper.hh b/Scheduler/ReadHelper.hh index d1393ad..011b51a 100644 --- a/Scheduler/ReadHelper.hh +++ b/Scheduler/ReadHelper.hh @@ -21,8 +21,8 @@ /** \file \brief ReadHelper public header */ -#ifndef HH_ReadHelper_ -#define HH_ReadHelper_ 1 +#ifndef HH_SENF_Scheduler_ReadHelper_ +#define HH_SENF_Scheduler_ReadHelper_ 1 // Custom includes #include @@ -30,7 +30,7 @@ #include #include -#include "Utils/intrusive_refcount.hh" +#include "../Utils/intrusive_refcount.hh" #include "Scheduler.hh" //#include "ReadHelper.mpp" @@ -42,7 +42,7 @@ namespace senf { /** \brief Asyncronous reading helper This class provides a simple asynchronous reading facility. This helper will register with - the Scheduler and read incoming data. It will collect the data until a specific numbner of + the Scheduler and read incoming data. It will collect the data until a specific number of bytes has been read or some Predicate evaluated on the data read thus far signals end of data. @@ -58,7 +58,7 @@ namespace senf { The predicate is any class instance with an operator(std::string const &). This operator is called, whenever some data has been read. If the data is not yet complete, the - predicate must return \c std::string::npos. If the ReadHelper should stop readeing more + predicate must return \c std::string::npos. If the ReadHelper should stop reading more data, the predicate must return the number of bytes which are to be considered 'matched'. \todo Move all not Handle dependent members to a ReadHandleBase class @@ -90,7 +90,7 @@ namespace senf { \param[in] handle file descriptor or handle providing the Handle interface defined above. \param[in] maxSize maximum number of bytes to read - \param[in] cb callback + \param[in] callback callback \returns Smart pointer to new ReadHelper instance */ template @@ -106,21 +106,21 @@ namespace senf { the Handle interface defined above. \param[in] maxSize maximum number of bytes to read \param[in] predicate predicate to check - \param[in] cb callback + \param[in] callback callback \returns smart pointer to new ReadHelper instance */ ///@} /////////////////////////////////////////////////////////////////////////// Handle handle() const; ///< Access the handle object - unsigned maxSize() const; ///< Return maximum number of bytes to be read + std::string::size_type maxSize() const; ///< Return maximum number of bytes to be read std::string const & data() const; ///< return data read std::string const & tail() const; ///< return data read but not matched by the predicate - bool complete() const; ///< Check wether the read has completed successfully + bool complete() const; ///< Check whether the read has completed successfully bool error() const; ///< Check for error condition - void throw_error() const; ///< If an error occured, throw it + void throw_error() const; ///< If an error occurred, throw it void revoke(); ///< Remove the ReadHelper from the scheduler @@ -129,13 +129,15 @@ namespace senf { private: struct InternalPredicate; - ReadHelper(Handle handle, unsigned maxSize, InternalPredicate * predicate, Callback cb); + ReadHelper(Handle handle, std::string::size_type maxSize, + InternalPredicate * predicate, Callback cb); - static void dispatchProcess(ptr helper, Handle handle, senf::Scheduler::EventId event); - void process(Handle handle, senf::Scheduler::EventId event); + static void dispatchProcess(ptr helper, Handle handle, int event); + void process(Handle handle, int event); void done(); Handle handle_; + scheduler::FdEvent fde_; std::string::size_type maxSize_; boost::scoped_ptr predicate_; Callback callback_; @@ -177,4 +179,6 @@ namespace senf { // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: