Logo Search packages:      
Sourcecode: c++-annotations version File versions  Download package

monitor.h

    #include <string>
    #include <map>
    #include "../selector.h"
    #include "child.h"

//CLASS
    class Monitor
    {
        enum Commands
        {
            UNKNOWN,
            START,
            EXIT,
            STOP,
            TEXT,
            sizeofCommands
        };

        class Find
        {
            int     d_nr;
            public:
                Find(int nr);
                bool operator()(std::map<int, Child *>::value_type &vt)
                                                                  const;
        };

        Selector                d_selector;
        int                     d_nr;
        std::map<int, Child *>  d_child;

        static void (Monitor::*s_handler[])(int, std::string const &);

        public:
            enum Done
            {};

            Monitor();
            void run();

        private:
            static void killChild(std::map<int, Child *>::value_type it);
            static void initialize();

            Commands    next(int *value, std::string *line);
            void    processInput();
            void    processChild(int fd);

            void    createNewChild(int, std::string const &);
            void    exiting(int = 0, std::string const &msg = std::string());
            void    sendChild(int value, std::string const &line);
            void    stopChild(int value, std::string const &);
            void    unknown(int, std::string const &);
    };
//=

//CONS
    inline Monitor::Monitor()
    :
        d_nr(0)
    {
        initialize();
    }
//=

//FINDIMP
    inline Monitor::Find::Find(int nr)
    :
        d_nr(nr)
    {}
    inline bool Monitor::Find::operator()(
                            std::map<int, Child *>::value_type &vt) const
    {
        return d_nr == vt.second->nr();
    }
//=

Generated by  Doxygen 1.6.0   Back to index