Main Page | Namespace List | File List | File Members

jobstate.h

Go to the documentation of this file.
00001 // File: jobstate.h
00002 // Author: Alessio Gianelle <gianelle@pd.infn.it>
00003 // Copyright (c) 2002 EU DataGrid.
00004 // For license conditions see http://www.eu-datagrid.org/license.html
00005 
00006 // $Id: jobstate.h,v 1.11 2003/11/14 15:07:41 gianelle Exp $
00007 
00017 #ifndef EDG_WORKLOAD_CHECKPOINTING_JOBSTATE_H
00018 #define EDG_WORKLOAD_CHECKPOINTING_JOBSTATE_H
00019 
00020 #include <string>
00021 #include <vector>
00022 
00023 #include <edg/workload/checkpointing/client/checkpointing_namespace.h>
00024 #include <edg/workload/checkpointing/client/step.h>
00025 #include <edg/workload/logging/client/context.h>
00026 
00027 #include <boost/shared_ptr.hpp>
00028 
00029 // classAd include files
00030 #include "classad_distribution.h"
00031 
00032 
00033 CHKPT_NAMESPACE_BEGIN {
00034  
00035 class StepsSet;
00036 
00058   class JobState {
00059   
00060   public:
00061 
00063     typedef enum state_type { 
00064       empty,  
00065       job     
00066     };
00067 
00069 
00070 
00077     JobState( state_type type = empty );
00082     JobState( const std::string state_str );
00087     JobState( classad::ClassAd *state_ad );
00093     JobState( std::istream* file );
00095     JobState( const JobState &js );
00099     JobState &operator=( const JobState &that );
00101     ~JobState();
00103   
00110 
00111 
00116     int saveValue (const std::string& name, int value);
00122     int saveValue (const std::string& name, bool value);
00128     int saveValue (const std::string& name, double value);
00134     int saveValue (const std::string& name, const char* value);
00140     int saveValue (const std::string& name, const std::string& value);
00142 
00146 
00147 
00153     int appendValue (const std::string& name, int value);
00160     int appendValue (const std::string& name, bool value);
00167     int appendValue (const std::string& name, double value);
00174     int appendValue (const std::string& name, const char* value); 
00181     int appendValue (const std::string& name, const std::string& value); 
00183 
00184 
00187 
00188 
00194     std::vector<int> getIntValue (const std::string& name);
00201     std::vector<bool> getBoolValue (const std::string& name);
00208     std::vector<double> getDoubleValue (const std::string& name);
00215     std::vector<std::string> getStringValue (const std::string& name);
00217 
00220 
00221 
00226     bool isIntValue (const std::string& name);
00232     bool isBoolValue (const std::string& name);
00238     bool isDoubleValue (const std::string& name);
00244     bool isStringValue (const std::string& name);
00250     bool isListValue (const std::string& name);
00252 
00253 
00255 
00256 
00258     void clearPairs ( void );
00261     void setId( const std::string& stateid );
00268     int checkState( void );
00273     Step getNextStep ( void );
00278     Step getCurrentStep ( void );
00282     classad::ClassAd toClassAd( void );
00286     std::string toString( void );
00290     void toFile( const std::string& filename );
00292                 
00294 
00295 
00308     int saveState ( void );
00317     JobState loadState ( const std::string& stateID, int num = 0 );
00319                 
00320   private:
00322 
00323 
00327     const char *createContext( void );
00329     void removeall( void );
00335     void isEmpty(int line, const char *func);
00339     int addValue( classad::ExprTree* trees, const classad::Value& val , const std::string& name);
00344     classad::Value getUnTypedValue(const std::string& name); 
00349     const std::string getType( classad::ExprTree *tree ); 
00354     void initialize ( classad::ClassAd *cstate );
00359     std::string getStateFromLB( const char *jobidi, int num = 0);
00361     
00362     std::string         js_stateId;            
00363     boost::shared_ptr<edg_wll_Context> js_ctx; 
00364     StepsSet           *js_stepper;            
00365     classad::ClassAd   *js_pairs;              
00366   };
00367 
00368 } CHKPT_NAMESPACE_END;
00369 
00370 #endif // EDG_WORKLOAD_CHECKPOINTING_JOBSTATE_H
00371 
00372 //  Local Variables:
00373 //  mode: c++
00374 //  End:

Generated on Wed Mar 1 00:37:46 2006 for CHECKPOINTING API by doxygen 1.3.5