00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef JobInfo_JobInfo_H
00016 #define JobInfo_JobInfo_H 1
00017
00018
00019 #include "Conventions/JobId.h"
00020 #include "GaudiKernel/boost_allocator.h"
00021 #include <string>
00022 #include <map>
00023 #include <ostream>
00024
00025
00026
00027 namespace DayaBay
00028 {
00029
00030
00031
00041 class JobInfo
00042 {
00043 public:
00044
00046 typedef std::map<std::string,std::string> JobParameters;
00047
00049 JobInfo() : m_jobId(),
00050 m_parameters() {}
00051
00053 JobInfo(const JobInfo & rh);
00054
00056 JobInfo & operator=(const JobInfo & rh);
00057
00059 virtual ~JobInfo() {}
00060
00062 bool exists(const std::string& name) const;
00063
00065 std::string get(const std::string& name) const;
00066
00068 void set(const std::string& name,
00069 const std::string& value);
00070
00072 std::ostream& fillStream(std::ostream& s) const;
00073
00076 const DayaBay::JobId& jobId() const;
00077
00080 void setJobId(const DayaBay::JobId& value);
00081
00084 const JobParameters& parameters() const;
00085
00088 void setParameters(const JobParameters& value);
00089
00090
00091 #ifndef GOD_NOALLOC
00093 static void* operator new ( size_t size )
00094 {
00095 return ( sizeof(JobInfo) == size ?
00096 boost::singleton_pool<JobInfo, sizeof(JobInfo)>::malloc() :
00097 ::operator new(size) );
00098 }
00099
00103 static void* operator new ( size_t size, void* pObj )
00104 {
00105 return ::operator new (size,pObj);
00106 }
00107
00109 static void operator delete ( void* p )
00110 {
00111 boost::singleton_pool<JobInfo, sizeof(JobInfo)>::is_from(p) ?
00112 boost::singleton_pool<JobInfo, sizeof(JobInfo)>::free(p) :
00113 ::operator delete(p);
00114 }
00115
00118 static void operator delete ( void* p, void* pObj )
00119 {
00120 ::operator delete (p, pObj);
00121 }
00122 #endif
00123 protected:
00124
00125 private:
00126
00127 DayaBay::JobId m_jobId;
00128 JobParameters m_parameters;
00129
00130 };
00131
00132 inline std::ostream& operator<< (std::ostream& str, const JobInfo& obj)
00133 {
00134 return obj.fillStream(str);
00135 }
00136
00137 }
00138
00139
00140
00141
00142
00143
00144
00145 inline DayaBay::JobInfo::JobInfo(const DayaBay::JobInfo & rh) :
00146 m_jobId( rh.m_jobId ),
00147 m_parameters( rh.m_parameters )
00148 {}
00149
00150 inline DayaBay::JobInfo & DayaBay::JobInfo::operator=(const DayaBay::JobInfo & rh) {
00151 if ( this != &rh ) {
00152 m_jobId = rh.m_jobId;
00153 m_parameters = rh.m_parameters;
00154 }
00155 return *this;
00156 }
00157
00158 inline const DayaBay::JobId& DayaBay::JobInfo::jobId() const
00159 {
00160 return m_jobId;
00161 }
00162
00163 inline void DayaBay::JobInfo::setJobId(const DayaBay::JobId& value)
00164 {
00165 m_jobId = value;
00166 }
00167
00168 inline const DayaBay::JobInfo::JobParameters& DayaBay::JobInfo::parameters() const
00169 {
00170 return m_parameters;
00171 }
00172
00173 inline void DayaBay::JobInfo::setParameters(const JobParameters& value)
00174 {
00175 m_parameters = value;
00176 }
00177
00178 inline bool DayaBay::JobInfo::exists(const std::string& name) const
00179 {
00180
00181 DayaBay::JobInfo::JobParameters::const_iterator pIter = m_parameters.find(name);
00182 if(pIter != m_parameters.end()){
00183 return true;
00184 }
00185 return false;
00186
00187 }
00188
00189 inline std::string DayaBay::JobInfo::get(const std::string& name) const
00190 {
00191
00192 DayaBay::JobInfo::JobParameters::const_iterator pIter = m_parameters.find(name);
00193 if(pIter != m_parameters.end()){
00194 return pIter->second;
00195 }
00196 return std::string();
00197
00198 }
00199
00200 inline void DayaBay::JobInfo::set(const std::string& name,
00201 const std::string& value)
00202 {
00203
00204 m_parameters[name]=value;
00205
00206 }
00207
00208
00209 #endif