Changeset 1399:01de1d7cc31d


Ignore:
Timestamp:
11/07/09 21:48:36 (2 years ago)
Author:
niam
Branch:
default
Message:

pc::execution::manager: get pointer to job itself

Location:
src/include/libdodo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/include/libdodo/pcExecutionJob.h

    r1386 r1399  
    9797                virtual bool isRunning() const = 0; 
    9898 
     99              protected: 
     100 
    99101                mutable bool cloned; ///< true if object was cloned 
    100102            }; 
  • src/include/libdodo/pcExecutionManager.h

    r1386 r1399  
    5555                 * destructor 
    5656                 */ 
    57                 virtual ~manager(); 
     57                ~manager(); 
    5858 
    5959                /** 
     
    6262                 * @param job defines job for managing 
    6363                 */ 
    64                 virtual unsigned long add(const T &job); 
     64                unsigned long add(const T &job); 
    6565 
    6666                /** 
     
    6969                 * @param terminate defines termination condition 
    7070                 */ 
    71                 virtual void remove(unsigned long id, 
     71                void remove(unsigned long id, 
    7272                                    bool          terminate = false); 
    7373 
     
    7777                 * @param force defines run condition; if true and job is running run job anyway 
    7878                 */ 
    79                 virtual void run(unsigned long id); 
     79                void run(unsigned long id); 
    8080 
    8181                /** 
     
    8383                 * @param id defines job identificator 
    8484                 */ 
    85                 virtual void stop(unsigned long id); 
     85                void stop(unsigned long id); 
    8686 
    8787                /** 
    8888                 * stop all registered jobs 
    8989                 */ 
    90                 virtual void stop(); 
     90                void stop(); 
    9191 
    9292                /** 
     
    9595                 * @param id defines job identificator 
    9696                 */ 
    97                 virtual int wait(unsigned long id); 
     97                int wait(unsigned long id); 
    9898 
    9999                /** 
    100100                 * wait for all registered jobs termination 
    101101                 */ 
    102                 virtual void wait(); 
     102                void wait(); 
    103103 
    104104                /** 
     
    106106                 * @param id defines job identificator 
    107107                 */ 
    108                 virtual bool isRunning(unsigned long id) const; 
     108                bool isRunning(unsigned long id) const; 
    109109 
    110110                /** 
    111111                 * @return amount of running jobs 
    112112                 */ 
    113                 virtual unsigned long running() const; 
     113                unsigned long running() const; 
    114114 
    115115                /** 
    116116                 * @return list of jobs in object 
    117117                 */ 
    118                 virtual dodoList<unsigned long> jobs(); 
     118                dodoList<unsigned long> jobs(); 
     119 
     120                /** 
     121                 * @return job object 
     122                 * @param id defines job identificator 
     123                 */ 
     124                T *job(unsigned long id); 
    119125 
    120126              protected: 
  • src/include/libdodo/pcExecutionManager.inline

    r1386 r1399  
    223223 
    224224//------------------------------------------------------------------- 
     225 
     226template <typename T> 
     227T * 
     228dodo::pc::execution::manager<T 
     229                             >::job(unsigned long id) 
     230{ 
     231    pc::sync::stack tg(keeper); 
     232 
     233    typename dodoMap<unsigned long, T>::const_iterator job = handles.find(id); 
     234 
     235    if (job == handles.end()) 
     236        throw exception::basic(exception::MODULE_PCEXECUTIONMANAGER, MANAGEREX_JOB, exception::ERRNO_LIBDODO, MANAGEREX_NOTFOUND, PCEXECUTIONMANAGEREX_NOTFOUND_STR, __LINE__, __FILE__); 
     237 
     238    return (T *)&job->second; 
     239} 
     240 
     241//------------------------------------------------------------------- 
  • src/include/libdodo/pcExecutionManagerEx.h

    r1386 r1399  
    5757                MANAGEREX_STOP, 
    5858                MANAGEREX_ISRUNNING, 
     59                MANAGEREX_JOB, 
    5960            }; 
    6061        }; 
Note: See TracChangeset for help on using the changeset viewer.