Scopira 20080306

task.h

00001 
00002 /*
00003  *  Copyright (c) 2005-2006    National Research Council
00004  *
00005  *  All rights reserved.
00006  *
00007  *  This material is confidential and proprietary information of
00008  *  National Research Council Canada ("Confidential Information").
00009  *  This Confidential Information may only be used and reproduced
00010  *  in accordance with the terms of the license agreement.
00011  *
00012  */
00013 
00014 #ifndef __INCLUDED_SCOPIRA_AGENT_TASK_H__
00015 #define __INCLUDED_SCOPIRA_AGENT_TASK_H__
00016 
00017 #include <scopira/tool/export.h>
00018 #include <scopira/tool/object.h>
00019 #include <scopira/tool/uuid.h>
00020 
00021 namespace scopira
00022 {
00023   namespace agent
00024   {
00025     class task_context; //fwd
00026     // users implement these
00027     class agent_task_i;
00028   }
00029 }
00030 
00045 class scopira::agent::agent_task_i : public virtual scopira::tool::object
00046 {
00047   public:
00048     enum {
00049       // the task is done, no need to run again
00050       run_done_c = 0,     // all done
00051 
00052       // pick one of these (whole first 8 bits (0xFF) are reserved for this stuff)
00053       run_again_0_c = 0x1,    // run again, as soon as possible
00054       run_again_1_c = 0x2,    // run again, ~1 sec
00055       run_again_10_c = 0x3,   // run again, ~10 sec
00056       run_again_100_c = 0x4,  // run again, ~100 sec
00057 
00058       // optional:
00059       run_canmove_c = 0x100,
00060 
00061       // optional:
00062       run_onmsg_c = 0x200,
00063     };
00064 
00065   public:
00080     SCOPIRA_EXPORT virtual int run(scopira::agent::task_context &ctx) = 0;
00081 };
00082 
00083 #endif
00084