| classad.h | | classad.h | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| | | | |
| BEGIN_NAMESPACE( classad ) | | BEGIN_NAMESPACE( classad ) | |
| | | | |
| typedef std::set<std::string, CaseIgnLTStr> References; | | typedef std::set<std::string, CaseIgnLTStr> References; | |
| typedef std::map<const ClassAd*, References> PortReferences; | | typedef std::map<const ClassAd*, References> PortReferences; | |
| | | | |
| #if defined( EXPERIMENTAL ) | | #if defined( EXPERIMENTAL ) | |
| #include "classad/rectangle.h" | | #include "classad/rectangle.h" | |
| #endif | | #endif | |
| | | | |
|
| typedef classad_hash_map<std::string, ExprTree*, CaseIgnLTStr> AttrList; | | #ifdef WIN32 | |
| | | typedef classad_hash_map<std::string, ExprTree*, StringCaseIgnHash> AttrLis | |
| | | t; | |
| | | #else | |
| | | typedef classad_hash_map<std::string, ExprTree*, StringCaseIgnHash, CaseIgn | |
| | | EqStr> AttrList; | |
| | | #endif | |
| typedef std::set<std::string, CaseIgnLTStr> DirtyAttrList; | | typedef std::set<std::string, CaseIgnLTStr> DirtyAttrList; | |
| | | | |
| void ClassAdLibraryVersion(int &major, int &minor, int &patch); | | void ClassAdLibraryVersion(int &major, int &minor, int &patch); | |
| void ClassAdLibraryVersion(std::string &version_string); | | void ClassAdLibraryVersion(std::string &version_string); | |
| | | | |
| /// The ClassAd object represents a parsed %ClassAd. | | /// The ClassAd object represents a parsed %ClassAd. | |
| class ClassAd : public ExprTree | | class ClassAd : public ExprTree | |
| { | | { | |
| /** \mainpage C++ ClassAd API Documentation | | /** \mainpage C++ ClassAd API Documentation | |
| * Welcome to the C++ ClassAd API Documentation. | | * Welcome to the C++ ClassAd API Documentation. | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 7 lines changed or added | |
|
| collectionBase.h | | collectionBase.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| class ServerTransaction; | | class ServerTransaction; | |
| | | | |
| class ClassAdProxy { | | class ClassAdProxy { | |
| public: | | public: | |
| ClassAdProxy( ){ ad=NULL; }; | | ClassAdProxy( ){ ad=NULL; }; | |
| ~ClassAdProxy( ){ }; | | ~ClassAdProxy( ){ }; | |
| | | | |
| ClassAd *ad; | | ClassAd *ad; | |
| }; | | }; | |
| | | | |
|
| typedef classad_hash_map<std::string,View*> ViewRegistry; | | typedef classad_map<std::string,View*> ViewRegistry; | |
| typedef classad_hash_map<std::string,ClassAdProxy> ClassAdTable; | | typedef classad_map<std::string,ClassAdProxy> ClassAdTable; | |
| typedef classad_hash_map<std::string,ServerTransaction*> XactionTable; | | typedef classad_map<std::string,ServerTransaction*> XactionTable; | |
| | | | |
| /** A ClassAdCollection stores a set of ClassAds. It is similar to a | | /** A ClassAdCollection stores a set of ClassAds. It is similar to a | |
| hash table, but with more interesting querying capabilities. */ | | hash table, but with more interesting querying capabilities. */ | |
| class ClassAdCollection : public ClassAdCollectionInterface { | | class ClassAdCollection : public ClassAdCollectionInterface { | |
| public: | | public: | |
| /**@name Constructors/Destructor | | /**@name Constructors/Destructor | |
| * Note that the ClassAdCollection constructors talk about caching. | | * Note that the ClassAdCollection constructors talk about caching. | |
| * If caching is off, all ClassAds are stored in memory. For large | | * If caching is off, all ClassAds are stored in memory. For large | |
| * collections, this may be a problem. If caching is on, only some | | * collections, this may be a problem. If caching is on, only some | |
| * ClassAds will be kept in memory, and all of them will be written | | * ClassAds will be kept in memory, and all of them will be written | |
| | | | |
End of changes. 1 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| common.h | | common.h | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| #ifndef open | | #ifndef open | |
| #define open _open | | #define open _open | |
| #endif | | #endif | |
| #define strcasecmp _stricmp | | #define strcasecmp _stricmp | |
| #ifndef rint | | #ifndef rint | |
| #define rint(num) floor(num + .5) | | #define rint(num) floor(num + .5) | |
| #endif | | #endif | |
| #define isnan _isnan | | #define isnan _isnan | |
| // isinf() defined in util.h | | // isinf() defined in util.h | |
| | | | |
|
| | | #ifdef WIN32 | |
| | | #include <hash_map> | |
| | | #endif | |
| | | | |
| #define snprintf _snprintf | | #define snprintf _snprintf | |
| | | | |
| // Disable warnings about multiple template instantiations | | // Disable warnings about multiple template instantiations | |
| // (done for gcc) | | // (done for gcc) | |
| #pragma warning( disable : 4660 ) | | #pragma warning( disable : 4660 ) | |
| // Disable warnings about forcing bools | | // Disable warnings about forcing bools | |
| #pragma warning( disable : 4800 ) | | #pragma warning( disable : 4800 ) | |
| // Disable warnings about truncated debug identifiers | | // Disable warnings about truncated debug identifiers | |
| #pragma warning( disable : 4786 ) | | #pragma warning( disable : 4786 ) | |
| #endif // WIN32 | | #endif // WIN32 | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 164 | |
| | | | |
| class ExprTree; | | class ExprTree; | |
| struct ExprHash { | | struct ExprHash { | |
| size_t operator()( const ExprTree *const &x ) const { | | size_t operator()( const ExprTree *const &x ) const { | |
| return( (size_t)x ); | | return( (size_t)x ); | |
| } | | } | |
| }; | | }; | |
| | | | |
| struct StringHash { | | struct StringHash { | |
| size_t operator()( const std::string &s ) const { | | size_t operator()( const std::string &s ) const { | |
|
| size_t h = 0; | | unsigned long h = 0; | |
| for( int i = s.size()-1; i >= 0; i-- ) { | | char const *ch; | |
| h = 5*h + s[i]; | | for( ch = s.c_str(); *ch; ch++ ) { | |
| | | h = 5*h + (unsigned char)*ch; | |
| } | | } | |
|
| return( h ); | | return (size_t)h; | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| struct StringCaseIgnHash { | | struct StringCaseIgnHash | |
| | | #ifdef WIN32 | |
| | | : public stdext::hash_compare <std::string> | |
| | | #endif | |
| | | { | |
| size_t operator()( const std::string &s ) const { | | size_t operator()( const std::string &s ) const { | |
|
| size_t h = 0; | | unsigned long h = 0; | |
| for( int i = s.size()-1; i >= 0; i-- ) { | | char const *ch; | |
| h = 5*h + tolower(s[i]); | | for( ch = s.c_str(); *ch; ch++ ) { | |
| | | h = 5*h + (unsigned char)tolower(*ch); | |
| } | | } | |
|
| return( h ); | | return (size_t)h; | |
| | | } | |
| | | #ifdef WIN32 | |
| | | // On Windows, the hash_map comparison operator is less-than | |
| | | , | |
| | | // not equal-to. | |
| | | bool operator( )( const std::string &s1, const std::string &s2 ) con | |
| | | st { | |
| | | return( strcasecmp( s1.c_str( ), s2.c_str( ) ) < 0 ); | |
| } | | } | |
|
| | | #endif | |
| }; | | }; | |
| extern std::string CondorErrMsg; | | extern std::string CondorErrMsg; | |
| #endif | | #endif | |
| | | | |
| extern int CondorErrno; | | extern int CondorErrno; | |
| static const std::string NULL_XACTION = ""; | | static const std::string NULL_XACTION = ""; | |
| | | | |
| END_NAMESPACE // classad | | END_NAMESPACE // classad | |
| | | | |
| char* strnewp( const char* ); | | char* strnewp( const char* ); | |
| | | | |
End of changes. 7 change blocks. |
| 9 lines changed or deleted | | 28 lines changed or added | |
|
| exprTree.h | | exprTree.h | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| #include "classad/common.h" | | #include "classad/common.h" | |
| #include "classad/value.h" | | #include "classad/value.h" | |
| | | | |
| BEGIN_NAMESPACE( classad ) | | BEGIN_NAMESPACE( classad ) | |
| | | | |
| // forward declarations | | // forward declarations | |
| class ExprTree; | | class ExprTree; | |
| class ClassAd; | | class ClassAd; | |
| class MatchClassAd; | | class MatchClassAd; | |
| | | | |
|
| typedef classad_hash_map< const ExprTree*, Value > EvalCache; | | | |
| | | | |
| class EvalState { | | class EvalState { | |
| public: | | public: | |
| EvalState( ); | | EvalState( ); | |
| ~EvalState( ); | | ~EvalState( ); | |
| | | | |
| void SetRootScope( ); | | void SetRootScope( ); | |
| void SetScopes( const ClassAd* ); | | void SetScopes( const ClassAd* ); | |
| | | | |
|
| EvalCache cache; | | int depth_remaining; // max recursion depth - current depth | |
| | | | |
| ClassAd *rootAd; | | ClassAd *rootAd; | |
| ClassAd *curAd; | | ClassAd *curAd; | |
| | | | |
| bool flattenAndInline; // NAC | | bool flattenAndInline; // NAC | |
| | | | |
| // Cache_to_free are the things in the cache that must be | | // Cache_to_free are the things in the cache that must be | |
| // freed when this gets deleted. The problem is that we put | | // freed when this gets deleted. The problem is that we put | |
| // two kinds of things into the cache: some that must be | | // two kinds of things into the cache: some that must be | |
| // freed, and some that must not be freed. We keep track of | | // freed, and some that must not be freed. We keep track of | |
| // the ones that must be freed separately. Memory managment | | // the ones that must be freed separately. Memory managment | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 2 lines changed or added | |
|
| indexfile.h | | indexfile.h | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| bool WriteBack(std::string key, std::string ad); | | bool WriteBack(std::string key, std::string ad); | |
| //should delete it from file and index | | //should delete it from file and index | |
| bool DeleteFromStorageFile(std::string key); | | bool DeleteFromStorageFile(std::string key); | |
| bool UpdateIndex(std::string key, int offset); | | bool UpdateIndex(std::string key, int offset); | |
| int First(std::string &key); | | int First(std::string &key); | |
| int Next(std::string &key); | | int Next(std::string &key); | |
| std::string GetClassadFromFile(std::string key, int offset); | | std::string GetClassadFromFile(std::string key, int offset); | |
| bool TruncateStorageFile(); | | bool TruncateStorageFile(); | |
| int dump_index(); | | int dump_index(); | |
| private: | | private: | |
|
| classad_hash_map<std::string,int> Index; | | typedef classad_map<std::string,int> index_type; | |
| classad_hash_map<std::string,int>::iterator index_itr; | | typedef classad_map<std::string,int>::iterator index_itr_type; | |
| | | index_type Index; | |
| | | index_itr_type index_itr; | |
| int filed; | | int filed; | |
| }; | | }; | |
| | | | |
| END_NAMESPACE | | END_NAMESPACE | |
| | | | |
End of changes. 1 change blocks. |
| 2 lines changed or deleted | | 4 lines changed or added | |
|
| matchClassad.h | | matchClassad.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| ***************************************************************/ | | ***************************************************************/ | |
| | | | |
| #ifndef __MATCH_CLASSAD_H__ | | #ifndef __MATCH_CLASSAD_H__ | |
| #define __MATCH_CLASSAD_H__ | | #define __MATCH_CLASSAD_H__ | |
| | | | |
| #include "classad/classad.h" | | #include "classad/classad.h" | |
| | | | |
| BEGIN_NAMESPACE( classad ) | | BEGIN_NAMESPACE( classad ) | |
| | | | |
| /** Special case of a ClassAd which make it easy to do matching. | | /** Special case of a ClassAd which make it easy to do matching. | |
|
| The top-level ClassAd is defined as follows: | | The top-level ClassAd equivalent to the following, with some | |
| | | minor implementation differences for efficiency. Because of | |
| | | the use of global-scope references to .LEFT and .RIGHT, this | |
| | | ad is not suitable for nesting inside of other ads. The use | |
| | | of global-scope references is done purely for efficiency, | |
| | | since attribute lookups tends to be a big part of the time | |
| | | spent in matchmaking. | |
| <pre> | | <pre> | |
| [ | | [ | |
| symmetricMatch = leftMatchesRight && rightMatchesLeft; | | symmetricMatch = leftMatchesRight && rightMatchesLeft; | |
|
| leftMatchesRight = adcr.ad.requirements; | | leftMatchesRight = LEFT.requirements; | |
| rightMatchesLeft = adcl.ad.requirements; | | rightMatchesLeft = RIGHT.requirements; | |
| leftRankValue = adcl.ad.rank; | | leftRankValue = LEFT.rank; | |
| rightRankValue = adcr.ad.rank; | | rightRankValue = RIGHT.rank; | |
| adcl = | | RIGHT = rCtx.ad; | |
| | | LEFT = lCtx.ad; | |
| | | lCtx = | |
| [ | | [ | |
|
| other = adcr.ad; | | other = .RIGHT; | |
| my = ad; // for condor backwards compatibility | | target = .RIGHT; // for condor backwards compatibility | |
| target = other; // for condor backwards compatibility | | my = .LEFT; // for condor backwards compatibility | |
| ad = | | ad = | |
| [ | | [ | |
| // the ``left'' match candidate goes here | | // the ``left'' match candidate goes here | |
| ] | | ] | |
| ]; | | ]; | |
|
| adcr = | | rCtx = | |
| [ | | [ | |
|
| other = adcl.ad; | | other = .LEFT; | |
| my = ad; // for condor backwards compatibility | | target = .LEFT; // for condor backwards compatibility | |
| target = other; // for condor backwards compatibility | | my = .RIGHT; // for condor backwards compatibility | |
| ad = | | ad = | |
| [ | | [ | |
| // the ``right'' match candidate goes here | | // the ``right'' match candidate goes here | |
| ] | | ] | |
| ]; | | ]; | |
| ] | | ] | |
| </pre> | | </pre> | |
| */ | | */ | |
| class MatchClassAd : public ClassAd | | class MatchClassAd : public ClassAd | |
| { | | { | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 148 | |
| ClassAd *RemoveLeftAd( ); | | ClassAd *RemoveLeftAd( ); | |
| | | | |
| /** Removes the right candidate from the match classad. If
the | | /** Removes the right candidate from the match classad. If
the | |
| candidate ``lives'' in another data structure, this meth
od | | candidate ``lives'' in another data structure, this meth
od | |
| should be called so that the match classad doesn't d
elete the | | should be called so that the match classad doesn't d
elete the | |
| candidate. | | candidate. | |
| @return The right candidate ad. | | @return The right candidate ad. | |
| */ | | */ | |
| ClassAd *RemoveRightAd( ); | | ClassAd *RemoveRightAd( ); | |
| | | | |
|
| | | /** Modifies the requirements expression in the given ad to | |
| | | make matchmaking more efficient. This will only imp | |
| | | rove | |
| | | efficiency if it is called once and then the resulti | |
| | | ng | |
| | | requirements are used multiple times. Saves the old | |
| | | requirements expression so it can be restored via | |
| | | UnoptimizeAdForMatchmaking. | |
| | | @param ad The ad to be optimized. | |
| | | @param error_msg non-NULL if an error description is | |
| | | desired. | |
| | | @return True on success. | |
| | | */ | |
| | | bool OptimizeRightAdForMatchmaking( ClassAd *ad, std::string | |
| | | *error_msg ); | |
| | | | |
| | | /** Modifies the requirements expression in the given ad to | |
| | | make matchmaking more efficient. This will only imp | |
| | | rove | |
| | | efficiency if it is called once and then the resulti | |
| | | ng | |
| | | requirements are used multiple times. Saves the old | |
| | | requirements expression so it can be restored via | |
| | | UnoptimizeAdForMatchmaking. | |
| | | @param ad The ad to be optimized. | |
| | | @param error_msg non-NULL if an error description is | |
| | | desired. | |
| | | @return True on success. | |
| | | */ | |
| | | bool OptimizeLeftAdForMatchmaking( ClassAd *ad, std::string | |
| | | *error_msg ); | |
| | | | |
| | | /** Restores ad previously optimized with OptimizeAdForMatch | |
| | | making. | |
| | | @param ad The ad to be unoptimized. | |
| | | @return True on success. | |
| | | */ | |
| | | bool UnoptimizeAdForMatchmaking( ClassAd *ad ); | |
| | | | |
| protected: | | protected: | |
| const ClassAd *ladParent, *radParent; | | const ClassAd *ladParent, *radParent; | |
| ClassAd *lCtx, *rCtx, *lad, *rad; | | ClassAd *lCtx, *rCtx, *lad, *rad; | |
| | | | |
| private: | | private: | |
| // The copy constructor and assignment operator are defined | | // The copy constructor and assignment operator are defined | |
| // to be private so we don't have to write them, or worry about | | // to be private so we don't have to write them, or worry about | |
| // them being inappropriately used. The day we want them, we can | | // them being inappropriately used. The day we want them, we can | |
| // write them. | | // write them. | |
| MatchClassAd(const MatchClassAd &) : ClassAd(){ return; } | | MatchClassAd(const MatchClassAd &) : ClassAd(){ return; } | |
| MatchClassAd &operator=(const MatchClassAd &) { return *this; } | | MatchClassAd &operator=(const MatchClassAd &) { return *this; } | |
| | | | |
|
| | | /** Modifies the requirements expression in the given ad to | |
| | | make matchmaking more efficient. This will only imp | |
| | | rove | |
| | | efficiency if it is called once and then the resulti | |
| | | ng | |
| | | requirements are used multiple times. Saves the old | |
| | | requirements expression so it can be restored via | |
| | | UnoptimizeAdForMatchmaking. | |
| | | @param ad The ad to be optimized. | |
| | | @param is_right True if this ad will be the right ad | |
| | | . | |
| | | @param error_msg non-NULL if an error description is | |
| | | desired. | |
| | | @return True on success. | |
| | | */ | |
| | | bool OptimizeAdForMatchmaking( ClassAd *ad, bool is_right, s | |
| | | td::string *error_msg ); | |
| | | | |
| }; | | }; | |
| | | | |
| END_NAMESPACE // classad | | END_NAMESPACE // classad | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 13 lines changed or deleted | | 78 lines changed or added | |
|