Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

LDIFObject.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  filename  : LDIFObject.h 
00003  *  authors   : Salvatore Monforte <salvatore.monforte@ct.infn.it>
00004  *  copyright : (C) 2001 by INFN
00005  ***************************************************************************/
00006 
00007 // $Id:
00008 
00016 #ifndef _LDIFOBJECT_
00017 #define _LDIFOBJECT_
00018 
00019 #include <iostream>
00020 #include <map>
00021 #include <string>
00022 #include "edg/workload/common/utilities/edgstrstream.h"  // fix 2.95 vs 3.2 pb
00023 #include <vector>
00024 #include <classad_distribution.h>
00025 
00026 namespace edg {
00027 namespace workload {
00028 namespace common {
00029 namespace utilities {
00030 }
00031 namespace ldif2classad {
00032 
00033 #define LEFT  1
00034 #define RIGHT 2
00035 
00036 struct UndefinedRankEx
00037 {
00038 };
00039 
00041 typedef std::vector<std::string> LDIFValue;
00043 typedef std::map<std::string,LDIFValue> LDIFAttributes;
00044 
00050 class LDIFObject
00051 {
00052  public:
00053 
00058   LDIFObject();
00059   LDIFObject(classad::ClassAd*);
00060 
00066   LDIFObject(const LDIFObject&);
00073   LDIFObject& operator= (const LDIFObject& o );
00074   
00081   void add(const std::string&, const std::string&);
00082   
00083   void merge(const LDIFObject& o);
00084 
00092   bool EvaluateAttribute(const std::string&, std::vector<std::string>&) const;
00093 
00101   bool EvaluateAttribute(const std::string&, std::string&) const;       
00102 
00103   classad::ClassAd* asClassAd( void ) const { return ExportClassAd(); }
00104   classad::ClassAd* asClassAd( std::vector< std::string >::const_iterator b, std::vector<std::string>::const_iterator e) const { return ExportClassAd( b,e ); }
00105  private:
00106   void ParseValue( const std::string&, utilities::edgstrstream& ) const;
00107   void ParseMultiValue( const LDIFValue&, utilities::edgstrstream& ) const; 
00108   std::string as_string(const classad::Value& v);
00109   LDIFAttributes from_ad(classad::ClassAd *ad);
00110   classad::ClassAd* ExportClassAd ( void ) const;
00111   classad::ClassAd* ExportClassAd ( std::vector< std::string >::const_iterator, std::vector<std::string>::const_iterator ) const;
00119   friend std::ostream& operator << (std::ostream&, const LDIFObject&); 
00120 
00122  mutable LDIFAttributes attributes;
00123 };
00124 
00125 extern std::ostream& operator<<        (std::ostream&, const LDIFObject&);
00126 extern bool     MatchClassifiedAd (classad::ClassAd *where, classad::ClassAd *what);
00127 extern double   RankClassifiedAd  (classad::ClassAd *where, classad::ClassAd *what, int);
00128 
00129 } // namespace ldif2classad
00130 } // namespace common
00131 } // namespace workload
00132 } // namespace edg
00133 
00134 #endif
00135 
00136 /*
00137   Local Variables:
00138   mode: c++
00139   End:
00140 */

Generated on Wed Mar 1 00:37:55 2006 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen 1.3.5