Commits

Tuukka Norri committed 3a3a717

Renamed PGTSHOM since it isn't tied to the PostgreSQL interface
- Tried to improve readability in the process.

  • Participants
  • Parent commits 22d2e30

Comments (0)

Files changed (23)

File Sources/BXDatabaseContext.m

 
 #import "PGTSCFScannedMemoryAllocator.h"
 #import "PGTSCollections.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 
 #import "BXDatabaseContext.h"
 #import "BXDatabaseContextPrivate.h"
 	{
 		if ([NSNull null] != currentObject)
 		{
-			id targets = [[rels PGTSCollectDK] registeredTargetFor: currentObject fireFault: shouldFire]; 
+			id targets = [[rels BX_CollectDK] registeredTargetFor: currentObject fireFault: shouldFire]; 
 			if (targets)
 				[targetsByObject setObject: targets forKey: currentObject];
 		}
 			if (nil != excludedFields)
 			{
 				excludedFields = [entity attributes: excludedFields];
-				[[excludedFields PGTSDo] setExcluded: YES];
+				[[excludedFields BX_Do] setExcluded: YES];
 			}
 			
 			if (BASETEN_BEGIN_FETCH_ENABLED ())
 	NSMutableDictionary* relsByEntity = [NSMutableDictionary dictionary];
 	NSMutableDictionary* oldTargetsByObject = [NSMutableDictionary dictionary];
 	NSMutableDictionary* newTargetsByObject = [NSMutableDictionary dictionary];
-	NSArray* objectIDs = (id) [[givenObjects PGTSCollect] objectID];
+	NSArray* objectIDs = (id) [[givenObjects BX_Collect] objectID];
 	NSMutableDictionary* idsByEntity = ObjectsByEntity (objectIDs);
 	AddObjectIDsForInheritance (idsByEntity);
 	
 			[relsByEntity setObject: rels forKey: entity];
 			BXEnumerate (currentObject, e, [objects objectEnumerator])
 			{
-				oldTargets = [[rels PGTSCollectDK] registeredTargetFor: currentObject fireFault: NO] ?: [NSDictionary dictionary];
+				oldTargets = [[rels BX_CollectDK] registeredTargetFor: currentObject fireFault: NO] ?: [NSDictionary dictionary];
 				
 				//FIXME: this seems really bad.
 				NSDictionary* oldValues = [[[currentObject cachedValues] copy] autorelease];
 				[currentObject setCachedValuesForKeysWithDictionary: newValues];
 				
-				newTargets = [[rels PGTSCollectDK] registeredTargetFor: currentObject fireFault: NO] ?: [NSDictionary dictionary];
+				newTargets = [[rels BX_CollectDK] registeredTargetFor: currentObject fireFault: NO] ?: [NSDictionary dictionary];
 				[currentObject setCachedValuesForKeysWithDictionary: oldValues];
 				
 				[currentObject willChangeInverseToOneRelationships: rels from: oldTargets to: newTargets];
 		BXEnumerate (currentEntity, e, [objectsByEntity keyEnumerator])
 		{
 			NSArray* objects = [objectsByEntity objectForKey: currentEntity];
-			NSArray* objectIDs = (id) [[objects PGTSCollect] objectID];
+			NSArray* objectIDs = (id) [[objects BX_Collect] objectID];
 			NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
 									  objectIDs, kBXObjectIDsKey,
 									  objects, kBXObjectsKey,
 		BXEnumerate (currentEntity, e, [objectsByEntity keyEnumerator])
 		{
 			NSArray* objects = [objectsByEntity objectForKey: currentEntity];
-			NSArray* objectIDs = (id) [[objects PGTSCollect] objectID];
+			NSArray* objectIDs = (id) [[objects BX_Collect] objectID];
 			NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
 									  objectIDs, kBXObjectIDsKey,
 									  objects, kBXObjectsKey,

File Sources/BXDatabaseObject.m

 #import <sys/types.h>
 #import <unistd.h>
 
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 
 #import "BXDatabaseObject.h"
 #import "BXDatabaseObjectPrivate.h"
 				id newTargets = nil;
 				if (0 < [rels count])
 				{
-					oldTargets = [[rels PGTSCollectDK] registeredTargetFor: self fireFault: NO];
+					oldTargets = [[rels BX_CollectDK] registeredTargetFor: self fireFault: NO];
 					[self setCachedValue: aVal forKey: aKey];
-					newTargets = [[rels PGTSCollectDK] registeredTargetFor: self fireFault: NO];
+					newTargets = [[rels BX_CollectDK] registeredTargetFor: self fireFault: NO];
 					[self willChangeInverseToOneRelationships: rels from: oldTargets to: newTargets];
 				}
 				
 	id newTargets = nil;
 	if (0 < [rels count])
 	{
-		oldTargets = [[rels PGTSCollectDK] registeredTargetFor: self fireFault: NO];
+		oldTargets = [[rels BX_CollectDK] registeredTargetFor: self fireFault: NO];
 		[self setCachedValuesForKeysWithDictionary: aDict];
-		newTargets = [[rels PGTSCollectDK] registeredTargetFor: self fireFault: NO];
+		newTargets = [[rels BX_CollectDK] registeredTargetFor: self fireFault: NO];
 		[self willChangeInverseToOneRelationships: rels from: oldTargets to: newTargets];
 	}
 		
         entity = [mObjectID entity];
 	
     //Object ID
-    NSArray* pkeyFNames = (id) [[[entity primaryKeyFields] PGTSCollect] name];
+    NSArray* pkeyFNames = (id) [[[entity primaryKeyFields] BX_Collect] name];
     NSArray* pkeyFValues = nil;
     
     @synchronized (mValues)

File Sources/BXDatabaseObjectModelMOMSerialization.mm

 #import "BXRelationshipDescriptionPrivate.h"
 #import "BXLogger.h"
 #import "BXForeignKey.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 
 
 typedef std::tr1::unordered_map <id, NSAttributeType,
 			NSEntityDescription* currentEntity = [[[NSEntityDescription alloc] init] autorelease];
 			[currentEntity setName: [bxEntity name]];
 			
-			NSMutableArray* attrs = (id) [[bxEntity attributesByName] PGTSValueSelectFunction: &FilterVisibleAttrs];
+			NSMutableArray* attrs = (id) [[bxEntity attributesByName] BX_ValueSelectFunction: &FilterVisibleAttrs];
 			[attrs sortUsingFunction: &CompareAttrIndices context: NULL];
 			NSMutableArray* sanitizedNames = [NSMutableArray arrayWithCapacity: [attrs count]];
-			[[attrs PGTSVisit: self] sanitizeAttrName: nil target: sanitizedNames];
+			[[attrs BX_Visit: self] sanitizeAttrName: nil target: sanitizedNames];
 			
 			[currentEntity setUserInfo: [NSDictionary dictionaryWithObject: sanitizedNames forKey: @"Sorted Attribute Names"]];
 			

File Sources/BXEntityDescription.m

 #import "BXConstantsPrivate.h"
 #import "BXLogger.h"
 #import "BXWeakNotification.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSCollections.h"
 #import "BXEnumerate.h"
 #import "NSURL+BaseTenAdditions.h"
  */
 - (NSArray *) primaryKeyFields
 {
-	return [mAttributes PGTSValueSelectFunction: &FilterPkeyAttributes argument: (void *) 1L] ?: nil;
+	return [mAttributes BX_ValueSelectFunction: &FilterPkeyAttributes argument: (void *) 1L] ?: nil;
 }
 	
 + (NSSet *) keyPathsForValuesAffectingFields
  */
 - (NSArray *) fields
 {
-	return [mAttributes PGTSValueSelectFunction: &FilterPkeyAttributes argument: (void *) 0L] ?: nil;
+	return [mAttributes BX_ValueSelectFunction: &FilterPkeyAttributes argument: (void *) 0L] ?: nil;
 }
 
 /** 
 
 - (void) resetAttributeExclusion
 {
-	[[mAttributes PGTSDo] resetAttributeExclusion];
+	[[mAttributes BX_Do] resetAttributeExclusion];
 }
 
 - (NSArray *) attributes: (NSArray *) strings
 
 - (id) inverseToOneRelationships;
 {
-	return [mRelationships PGTSValueSelectFunction: &InverseToOneRelationships];
+	return [mRelationships BX_ValueSelectFunction: &InverseToOneRelationships];
 }
 
 - (BOOL) beginValidation

File Sources/BXHOM.h

+//
+// BXHOM.h
+// BaseTen
+//
+// Copyright (C) 2008-2010 Marko Karppinen & Co. LLC.
+//
+// Before using this software, please review the available licensing options
+// by visiting http://www.karppinen.fi/baseten/licensing/ or by contacting
+// us at sales@karppinen.fi. Without an additional license, this software
+// may be distributed only in compliance with the GNU General Public License.
+//
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2.0,
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// $Id$
+//
+
+#import <Foundation/Foundation.h>
+
+
+@protocol BXHOM <NSObject>
+- (id) BX_Any;
+- (id) BX_Do;
+- (id) BX_Collect;
+- (id) BX_CollectReturning: (Class) aClass;
+
+/**
+ * \internal
+ * \brief Make a dictionary of collected objects.
+ *
+ * Make existing objects values and collected objects keys.
+ * \return An invocation recorder that creates an NSDictionary.
+ */
+- (id) BX_CollectD;
+
+/**
+ * \internal
+ * \brief Make a dictionary of collected objects.
+ *
+ * Make existing objects keys and collected objects values.
+ * \return An invocation recorder that creates an NSDictionary.
+ */
+- (id) BX_CollectDK;
+
+/**
+ * \internal
+ * \brief Visit each item.
+ *
+ * The first parameter after self and _cmd will be replaced with the visited object.
+ * \param visitor The object that will be called.
+ * \return An invocation recorder.
+ */
+- (id) BX_Visit: (id) visitor;
+@end
+
+
+
+@interface NSSet (BXHOM) <BXHOM>
+- (id) BX_SelectFunction: (int (*)(id)) fptr;
+- (id) BX_SelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
+@end
+
+
+
+@interface NSArray (BXHOM) <BXHOM>
+- (NSArray *) BX_Reverse;
+- (id) BX_SelectFunction: (int (*)(id)) fptr;
+- (id) BX_SelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
+@end
+
+
+
+@interface NSDictionary (BXHOM) <BXHOM>
+/**
+ * \internal
+ * \brief Make a dictionary of objects collected from keys.
+ *
+ * Make existing objects values and collected objects keys.
+ * \return An invocation recorder that creates an NSDictionary.
+ */
+- (id) BX_KeyCollectD;
+
+- (id) BX_ValueSelectFunction: (int (*)(id)) fptr;
+- (id) BX_ValueSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
+@end

File Sources/BXHOM.m

+//
+// BXHOM.m
+// BaseTen
+//
+// Copyright (C) 2008-2010 Marko Karppinen & Co. LLC.
+//
+// Before using this software, please review the available licensing options
+// by visiting http://www.karppinen.fi/baseten/licensing/ or by contacting
+// us at sales@karppinen.fi. Without an additional license, this software
+// may be distributed only in compliance with the GNU General Public License.
+//
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License, version 2.0,
+// as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+// $Id$
+//
+
+#import "BXHOM.h"
+#import "PGTSInvocationRecorder.h"
+#import "BXEnumerate.h"
+
+
+static id 
+VisitorTrampoline (id self, id target, SEL callback, id userInfo)
+{
+	id retval = nil;
+	if (0 < [self count])
+	{
+		PGTSCallbackInvocationRecorder* recorder = [[[PGTSCallbackInvocationRecorder alloc] init] autorelease];
+		[recorder setTarget: target];
+		[recorder setCallbackTarget: self];
+		[recorder setCallback: callback];
+		[recorder setUserInfo: userInfo];
+		retval = [recorder record];
+	}
+	return retval;
+}
+
+
+static id
+HOMTrampoline (id self, SEL callback, id userInfo)
+{
+	id retval = nil;
+	if (0 < [self count])
+	{
+		PGTSHOMInvocationRecorder* recorder = [[[PGTSHOMInvocationRecorder alloc] init] autorelease];
+		[recorder setCallback: callback target: self];
+		[recorder setUserInfo: userInfo];
+		retval = [recorder record];
+	}
+	return retval;
+}
+
+
+static id
+KeyTrampoline (id self, SEL callback, id userInfo)
+{
+	id retval = nil;
+	if (0 < [self count])
+	{
+		PGTSCallbackInvocationRecorder* recorder = [[[PGTSCallbackInvocationRecorder alloc] init] autorelease];
+		[recorder setCallback: callback];
+		[recorder setCallbackTarget: self];
+		[recorder setTarget: [[self keyEnumerator] nextObject]];
+		retval = [recorder record];
+	}
+	return retval;
+}
+
+
+static void
+CollectAndPerform (id self, id retval, NSInvocation* invocation, NSEnumerator* e)
+{
+	id currentObject = nil;
+	while ((currentObject = [e nextObject]))
+	{
+		[invocation invokeWithTarget: currentObject];
+		id collected = nil;
+		[invocation getReturnValue: &collected];
+		if (! collected) collected = [NSNull null];
+		[retval addObject: collected];
+	}
+	retval = [[retval copy] autorelease];
+	[invocation setReturnValue: &retval];
+}
+
+
+static void
+CollectAndPerformD (id self, NSMutableDictionary* retval, NSInvocation* invocation, NSEnumerator* e)
+{
+	id currentObject = nil;
+	while ((currentObject = [e nextObject]))
+	{
+		[invocation invokeWithTarget: currentObject];
+		id collected = nil;
+		[invocation getReturnValue: &collected];
+		if (collected)
+			[retval setObject: currentObject forKey: collected];
+	}
+	retval = [[retval copy] autorelease];
+	[invocation setReturnValue: &retval];
+}
+
+
+static void
+CollectAndPerformDK (id self, NSMutableDictionary* retval, NSInvocation* invocation, NSEnumerator* e)
+{
+	id currentObject = nil;
+	while ((currentObject = [e nextObject]))
+	{
+		[invocation invokeWithTarget: currentObject];
+		id collected = nil;
+		[invocation getReturnValue: &collected];
+		if (collected)
+			[retval setObject: collected forKey: currentObject];
+	}
+	retval = [[retval copy] autorelease];
+	[invocation setReturnValue: &retval];
+}
+
+
+static void
+Do (NSInvocation* invocation, NSEnumerator* enumerator)
+{
+	BXEnumerate (currentObject, e, enumerator)
+		[invocation invokeWithTarget: currentObject];
+}
+
+
+static id
+SelectFunction (id sender, id retval, int (* fptr)(id))
+{
+	BXEnumerate (currentObject, e, [sender objectEnumerator])
+	{
+		if (fptr (currentObject))
+			[retval addObject: currentObject];
+	}
+	retval = [[retval copy] autorelease];
+	return retval;
+}
+
+
+static id
+SelectFunction2 (id sender, id retval, int (* fptr)(id, void*), void* arg)
+{
+	BXEnumerate (currentObject, e, [sender objectEnumerator])
+	{
+		if (fptr (currentObject, arg))
+			[retval addObject: currentObject];
+	}
+	retval = [[retval copy] autorelease];
+	return retval;
+}
+
+
+static void
+Visit (NSInvocation* invocation, NSEnumerator* enumerator)
+{
+	BXEnumerate (currentObject, e, enumerator)
+	{
+		[invocation setArgument: &currentObject atIndex: 2];
+		[invocation invoke];
+	}
+}
+
+
+
+@implementation NSSet (BXHOM)
+- (void) _BX_Collect: (NSInvocation *) invocation userInfo: (Class) retclass
+{
+	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectD: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectDK: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_Do: (NSInvocation *) invocation userInfo: (id) anObject
+{
+	Do (invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_Visit: (NSInvocation *) invocation userInfo: (id) userInfo
+{
+	Visit (invocation, [self objectEnumerator]);
+}
+
+
+- (id) BX_Any
+{
+	return [self anyObject];
+}
+
+
+- (id) BX_Collect
+{
+	return [self BX_CollectReturning: [NSMutableSet class]];
+}
+
+
+- (id) BX_CollectReturning: (Class) aClass
+{
+	return HOMTrampoline (self, @selector (_BX_Collect:userInfo:), aClass);
+}
+
+
+- (id) BX_CollectD
+{
+	return HOMTrampoline (self, @selector (_BX_CollectD:userInfo:), nil);
+}
+
+
+- (id) BX_CollectDK
+{
+	return HOMTrampoline (self, @selector (_BX_CollectDK:userInfo:), nil);
+}
+
+
+- (id) BX_SelectFunction: (int (*)(id)) fptr
+{
+	id retval = [NSMutableSet setWithCapacity: [self count]];
+	return SelectFunction (self, retval, fptr);
+}
+
+
+- (id) BX_SelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
+{
+	id retval = [NSMutableSet setWithCapacity: [self count]];
+	return SelectFunction2 (self, retval, fptr, arg);
+}
+
+
+- (id) BX_Do
+{
+	return HOMTrampoline (self, @selector (_BX_Do:userInfo:), nil);
+}
+
+
+- (id) BX_Visit: (id) visitor
+{
+	return VisitorTrampoline (self, visitor, @selector (_BX_Visit:userInfo:), nil);
+}
+@end
+
+
+
+@implementation NSArray (BXHOM)
+- (void) _BX_Collect: (NSInvocation *) invocation userInfo: (Class) retclass
+{
+	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectD: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectDK: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_Do: (NSInvocation *) invocation userInfo: (id) userInfo
+{
+	Do (invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_Visit: (NSInvocation *) invocation userInfo: (id) userInfo
+{
+	Visit (invocation, [self objectEnumerator]);
+}
+
+
+- (NSArray *) BX_Reverse
+{
+	return [[self reverseObjectEnumerator] allObjects];
+}
+
+
+- (id) BX_Any
+{
+	return [self lastObject];
+}
+
+
+- (id) BX_Collect
+{
+	return [self BX_CollectReturning: [NSMutableArray class]];
+}
+
+
+- (id) BX_CollectReturning: (Class) aClass
+{
+	return HOMTrampoline (self, @selector (_BX_Collect:userInfo:), aClass);
+}
+
+
+- (id) BX_CollectD
+{
+	return HOMTrampoline (self, @selector (_BX_CollectD:userInfo:), nil);
+}
+
+
+- (id) BX_CollectDK
+{
+	return HOMTrampoline (self, @selector (_BX_CollectDK:userInfo:), nil);
+}
+
+
+- (id) BX_Do
+{
+	return HOMTrampoline (self, @selector (_BX_Do:userInfo:), nil);
+}
+
+
+- (id) BX_Visit: (id) visitor
+{
+	return VisitorTrampoline (self, visitor, @selector (_BX_Visit:userInfo:), nil);
+}
+
+
+- (id) BX_SelectFunction: (int (*)(id)) fptr
+{
+	id retval = [NSMutableArray arrayWithCapacity: [self count]];
+	return SelectFunction (self, retval, fptr);
+}
+
+
+- (id) BX_SelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
+{
+	id retval = [NSMutableArray arrayWithCapacity: [self count]];
+	return SelectFunction2 (self, retval, fptr, arg);
+}
+@end
+
+
+
+@implementation NSDictionary (BXHOM)
+- (void) _BX_Collect: (NSInvocation *) invocation userInfo: (Class) retclass
+{
+	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectD: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_CollectDK: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_KeyCollectD: (NSInvocation *) invocation userInfo: (id) ignored
+{
+	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
+	BXEnumerate (currentKey, e, [self keyEnumerator])
+	{
+		id value = [self objectForKey: currentKey];
+		id newKey = nil;
+		[invocation invokeWithTarget: currentKey];
+		[invocation getReturnValue: &newKey];
+		if (newKey)
+			[retval setObject: value forKey: newKey];
+	}
+	retval = [[retval copy] autorelease];
+	[invocation setReturnValue: &retval];
+}
+
+
+- (void) _BX_Do: (NSInvocation *) invocation userInfo: (id) userInfo
+{
+	Do (invocation, [self objectEnumerator]);
+}
+
+
+- (void) _BX_Visit: (NSInvocation *) invocation userInfo: (id) userInfo
+{
+	Visit (invocation, [self objectEnumerator]);
+}
+
+
+- (id) BX_Any
+{
+	return [[self objectEnumerator] nextObject];
+}
+
+
+- (id) BX_Collect
+{
+	return [self BX_CollectReturning: [NSMutableArray class]];
+}
+
+
+- (id) BX_CollectReturning: (Class) aClass
+{
+	return HOMTrampoline (self, @selector (_BX_Collect:userInfo:), aClass);
+}
+
+
+- (id) BX_CollectD
+{
+	return HOMTrampoline (self, @selector (_BX_CollectD:userInfo:), nil);
+}
+
+
+- (id) BX_CollectDK
+{
+	return HOMTrampoline (self, @selector (_BX_CollectDK:userInfo:), nil);
+}
+
+
+- (id) BX_KeyCollectD
+{
+	return KeyTrampoline (self, @selector (_BX_KeyCollectD:userInfo:), nil);
+}
+
+
+- (id) BX_Do
+{
+	return HOMTrampoline (self, @selector (_BX_Do:userInfo:), nil);
+}
+
+
+- (id) BX_Visit: (id) visitor
+{
+	return VisitorTrampoline (self, visitor, @selector (_BX_Visit:userInfo:), nil);
+}
+
+
+- (id) BX_ValueSelectFunction: (int (*)(id)) fptr
+{
+	id retval = [NSMutableArray arrayWithCapacity: [self count]];
+	return SelectFunction (self, retval, fptr);
+}
+
+
+- (id) BX_ValueSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
+{
+	id retval = [NSMutableArray arrayWithCapacity: [self count]];
+	return SelectFunction2 (self, retval, fptr, arg);
+}
+@end

File Sources/BXPGClearLocksHandler.m

 #import "BXDatabaseObjectIDPrivate.h"
 #import "BXLogger.h"
 #import "PGTSAdditions.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSOids.h"
 
 
 			@" AND baseten_lock_timestamp > COALESCE ($1, '-infinity')::timestamp ";
 						
 			//Primary key field names.
-			NSArray* pkeyfnames = (id) [[[[table primaryKey] columns] PGTSCollect] quotedName: mConnection];
+			NSArray* pkeyfnames = (id) [[[[table primaryKey] columns] BX_Collect] quotedName: mConnection];
 			NSString* pkeystr = [pkeyfnames componentsJoinedByString: @", "];
 			
 			//Table names.

File Sources/BXPGEntityImporter.m

 #import "BXPGTransactionHandler.h"
 #import "BXPGEntityConverter.h"
 #import "PGTSResultSet.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSDatabaseDescription.h"
 
 
 	ExpectR (mSchemaName, NO);
 	if (0 < [entities count])
 	{
-		NSArray* names = (id) [[entities PGTSCollect] name];
+		NSArray* names = (id) [[entities BX_Collect] name];
 		NSString* queryString = 
 		@"SELECT baseten.disable (c.oid) "
 		"  FROM pg_class c, pg_namespace n "

File Sources/BXPGExpressionVisitor.m

 // $Id$
 //
 
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXAttributeDescription.h"
 #import "BXPGFromItem.h"
 #import "BXManyToManyRelationshipDescription.h"

File Sources/BXPGFunctionExpressionEvaluator.mm

 #import "BXPGFunctionExpressionEvaluator.h"
 #import "BXPGExpressionValueType.h"
 #import "NSExpression+PGTSAdditions.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXPGPredefinedFunctionExpressionValueType.h"
 #import "BXEnumerate.h"
 #import <map>
 	if (function->fc_variable_argument_count)
 	{
 		NSArray* arguments = [valueType arguments];
-		arguments = (id) [[arguments PGTSCollect] expressionSQL: visitor];
+		arguments = (id) [[arguments BX_Collect] expressionSQL: visitor];
 		[invocation setArgument: &arguments atIndex: 2];
 	}
 	else if (0 < function->fc_arguments)

File Sources/BXPGInterface.m

 //
 
 #import "PGTS.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSDeleteRule.h"
 #import "PGTSConstants.h"
 #import "PGTSOids.h"
 	BXPGFromItem* fromItem = [queryBuilder primaryRelation];
 	BXEntityDescription* entity = [fromItem entity];
 	NSDictionary* attrs = [entity attributesByName];
-	NSArray* filteredAttrs = [attrs PGTSValueSelectFunction: filterFunction];
+	NSArray* filteredAttrs = [attrs BX_ValueSelectFunction: filterFunction];
 	return ReturnedFields (queryBuilder, filteredAttrs, prependAlias);
 }
 
 		[mTransactionHandler checkSuperEntities: entity];
 		
 		NSArray* objectIDs = ObjectIDs (entity, res);
-		NSDictionary* values = (id) [[valueDict PGTSKeyCollectD] name];
+		NSDictionary* values = (id) [[valueDict BX_KeyCollectD] name];
 		BXEnumerate (currentID, e, [objectIDs objectEnumerator])
 		{
 			BXDatabaseObject* object = [mContext registeredObjectWithID: currentID];

File Sources/BXPGModificationHandler.mm

 #import "BXEntityDescriptionPrivate.h"
 #import "BXDatabaseObjectIDPrivate.h"
 #import "PGTSScannedMemoryAllocator.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXEnumerate.h"
 #import <tr1/unordered_map>
 
 	BXPGTableDescription* rel = [mInterface tableForEntity: mEntity];
 	PGTSIndexDescription* pkey = [rel primaryKey];
 	NSArray* columns = [[[pkey columns] allObjects] sortedArrayUsingSelector: @selector (indexCompare:)];
-	NSString* pkeyString = [(id) [[columns PGTSCollect] columnDefinition] componentsJoinedByString: @", "];
+	NSString* pkeyString = [(id) [[columns BX_Collect] columnDefinition] componentsJoinedByString: @", "];
 	
 	NSString* queryFormat = 
 	@"SELECT * FROM \"baseten\".modification ($1, $2, $3, $4) "

File Sources/BXPGQueryHandler.m

 #import "BXPGQueryHandler.h"
 #import "BXPredicateVisitor.h"
 #import "BXPGFromItem.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXRelationshipDescriptionPrivate.h"
 #import "BXForeignKey.h"
 

File Sources/BXPGRelationAliasMapper.m

 #import "BXEntityDescription.h"
 #import "BXPGFromItem.h"
 #import "BXRelationshipDescription.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXManyToManyRelationshipDescription.h"
 #import "BXRelationshipDescriptionPrivate.h"
 #import "BXForeignKey.h"
 	NSString* retval = nil;
 
 	mIsFirstInUpdate = YES;
-	NSArray* components = (id) [[mFromItems PGTSCollect] BXPGVisitFromItem: self];
+	NSArray* components = (id) [[mFromItems BX_Collect] BXPGVisitFromItem: self];
 	if (0 < [components count])
 		retval = [components componentsJoinedByString: @" "];
 	mIsFirstInUpdate = NO;

File Sources/BXPGTransactionHandler.m

 
 #import "PGTS.h"
 #import "PGTSAdditions.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSOids.h"
 
 #import "BXInterface.h"
 		//Get and sort the primary key fields.
 		NSArray* pkeyFields = [[[[table primaryKey] columns] allObjects] sortedArrayUsingSelector: @selector (indexCompare:)];
 		BXAssertVoidReturn (nil != pkeyFields, @"Expected to know the primary key.");
-		NSArray* pkeyNames = (id) [[pkeyFields PGTSCollect] name];
+		NSArray* pkeyNames = (id) [[pkeyFields BX_Collect] name];
 		NSArray* attrs = [[entity attributesByName] objectsForKeys: pkeyNames notFoundMarker: [NSNull null]];
 		ExpectV (! [attrs containsObject: [NSNull null]]);
 		NSString* fieldList = BXPGReturnList (attrs, alias, YES);

File Sources/BXPredicateVisitor.m

 #import "BXPGExpressionVisitor.h"
 #import "BXPGConstantParameterMapper.h"
 #import "PGTSConstants.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXPGFunctionExpressionEvaluator.h"
 #import "BXPGKeypathExpressionValueType.h"
 #import "BXPGAggregateExpressionValueType.h"
 
 - (NSString *) handlePGAggregateExpressionValue: (NSArray *) valueTree
 {
-	NSArray* subValues = (id)[[valueTree PGTSCollect] expressionSQL: self];
+	NSArray* subValues = (id)[[valueTree BX_Collect] expressionSQL: self];
 	NSString* retval = [NSString stringWithFormat: @"ARRAY [%@]", [subValues componentsJoinedByString: @","]];
 	return retval;
 }

File Sources/BXRelationshipDescription.m

 #import "BXSetRelationProxy.h"
 #import "BXDatabaseObjectPrivate.h"
 #import "BXLogger.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "BXPropertyDescriptionPrivate.h"
 #import "BXProbes.h"
 #import "BXAttributeDescriptionPrivate.h"
 		if ([self isToMany])
 			retval = res;
 		else
-			retval = [res PGTSAny];
+			retval = [res BX_Any];
 	}
 	
 	if (! retval)

File Sources/NSAttributeDescription+BXPGAdditions.m

 
 #import "NSAttributeDescription+BXPGAdditions.h"
 #import "NSPredicate+PGTSAdditions.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSConstantValue.h"
 #import "BXLogger.h"
 #import "PGTSFoundationObjects.h"
 	[predicates addObjectsFromArray: [self validationPredicates]];
 	
 	NSExpression* lengthExp = [NSExpression expressionForKeyPath: @"length"];
-	[[predicates PGTSVisit: self] BXPGPredicate: nil lengthExp: lengthExp maxLength: &retval];
+	[[predicates BX_Visit: self] BXPGPredicate: nil lengthExp: lengthExp maxLength: &retval];
 	
 	if (retval <= 0)
 		retval = NSIntegerMax;

File Sources/PGTSHOM.h

-//
-// PGTSHOM.h
-// BaseTen
-//
-// Copyright (C) 2008-2010 Marko Karppinen & Co. LLC.
-//
-// Before using this software, please review the available licensing options
-// by visiting http://www.karppinen.fi/baseten/licensing/ or by contacting
-// us at sales@karppinen.fi. Without an additional license, this software
-// may be distributed only in compliance with the GNU General Public License.
-//
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, version 2.0,
-// as published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-// $Id$
-//
-
-#import <Foundation/Foundation.h>
-
-
-@protocol PGTSHOM <NSObject>
-- (id) PGTSAny;
-- (id) PGTSDo;
-- (id) PGTSCollect;
-- (id) PGTSCollectReturning: (Class) aClass;
-
-/**
- * \internal
- * \brief Make a dictionary of collected objects.
- *
- * Make existing objects values and collected objects keys.
- * \return An invocation recorder that creates an NSDictionary.
- */
-- (id) PGTSCollectD;
-
-/**
- * \internal
- * \brief Make a dictionary of collected objects.
- *
- * Make existing objects keys and collected objects values.
- * \return An invocation recorder that creates an NSDictionary.
- */
-- (id) PGTSCollectDK;
-
-/**
- * \internal
- * \brief Visit each item.
- *
- * The first parameter after self and _cmd will be replaced with the visited object.
- * \param visitor The object that will be called.
- * \return An invocation recorder.
- */
-- (id) PGTSVisit: (id) visitor;
-@end
-
-
-@interface NSSet (PGTSHOM) <PGTSHOM>
-- (id) PGTSSelectFunction: (int (*)(id)) fptr;
-- (id) PGTSSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
-@end
-
-
-@interface NSArray (PGTSHOM) <PGTSHOM>
-- (NSArray *) PGTSReverse;
-- (id) PGTSSelectFunction: (int (*)(id)) fptr;
-- (id) PGTSSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
-@end
-
-
-@interface NSDictionary (PGTSHOM) <PGTSHOM>
-/**
- * \internal
- * \brief Make a dictionary of objects collected from keys.
- *
- * Make existing objects values and collected objects keys.
- * \return An invocation recorder that creates an NSDictionary.
- */
-- (id) PGTSKeyCollectD;
-
-- (id) PGTSValueSelectFunction: (int (*)(id)) fptr;
-- (id) PGTSValueSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg;
-@end

File Sources/PGTSHOM.m

-//
-// PGTSHOM.m
-// BaseTen
-//
-// Copyright (C) 2008-2010 Marko Karppinen & Co. LLC.
-//
-// Before using this software, please review the available licensing options
-// by visiting http://www.karppinen.fi/baseten/licensing/ or by contacting
-// us at sales@karppinen.fi. Without an additional license, this software
-// may be distributed only in compliance with the GNU General Public License.
-//
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, version 2.0,
-// as published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-// $Id$
-//
-
-#import "PGTSHOM.h"
-#import "PGTSInvocationRecorder.h"
-#import "BXEnumerate.h"
-
-
-static id 
-VisitorTrampoline (id self, id target, SEL callback, id userInfo)
-{
-	id retval = nil;
-	if (0 < [self count])
-	{
-		PGTSCallbackInvocationRecorder* recorder = [[[PGTSCallbackInvocationRecorder alloc] init] autorelease];
-		[recorder setTarget: target];
-		[recorder setCallbackTarget: self];
-		[recorder setCallback: callback];
-		[recorder setUserInfo: userInfo];
-		retval = [recorder record];
-	}
-	return retval;
-}
-
-
-static id
-HOMTrampoline (id self, SEL callback, id userInfo)
-{
-	id retval = nil;
-	if (0 < [self count])
-	{
-		PGTSHOMInvocationRecorder* recorder = [[[PGTSHOMInvocationRecorder alloc] init] autorelease];
-		[recorder setCallback: callback target: self];
-		[recorder setUserInfo: userInfo];
-		retval = [recorder record];
-	}
-	return retval;
-}
-
-
-static id
-KeyTrampoline (id self, SEL callback, id userInfo)
-{
-	id retval = nil;
-	if (0 < [self count])
-	{
-		PGTSCallbackInvocationRecorder* recorder = [[[PGTSCallbackInvocationRecorder alloc] init] autorelease];
-		[recorder setCallback: callback];
-		[recorder setCallbackTarget: self];
-		[recorder setTarget: [[self keyEnumerator] nextObject]];
-		retval = [recorder record];
-	}
-	return retval;
-}
-
-
-static void
-CollectAndPerform (id self, id retval, NSInvocation* invocation, NSEnumerator* e)
-{
-	id currentObject = nil;
-	while ((currentObject = [e nextObject]))
-	{
-		[invocation invokeWithTarget: currentObject];
-		id collected = nil;
-		[invocation getReturnValue: &collected];
-		if (! collected) collected = [NSNull null];
-		[retval addObject: collected];
-	}
-	retval = [[retval copy] autorelease];
-	[invocation setReturnValue: &retval];
-}
-
-
-static void
-CollectAndPerformD (id self, NSMutableDictionary* retval, NSInvocation* invocation, NSEnumerator* e)
-{
-	id currentObject = nil;
-	while ((currentObject = [e nextObject]))
-	{
-		[invocation invokeWithTarget: currentObject];
-		id collected = nil;
-		[invocation getReturnValue: &collected];
-		if (collected)
-			[retval setObject: currentObject forKey: collected];
-	}
-	retval = [[retval copy] autorelease];
-	[invocation setReturnValue: &retval];
-}
-
-
-static void
-CollectAndPerformDK (id self, NSMutableDictionary* retval, NSInvocation* invocation, NSEnumerator* e)
-{
-	id currentObject = nil;
-	while ((currentObject = [e nextObject]))
-	{
-		[invocation invokeWithTarget: currentObject];
-		id collected = nil;
-		[invocation getReturnValue: &collected];
-		if (collected)
-			[retval setObject: collected forKey: currentObject];
-	}
-	retval = [[retval copy] autorelease];
-	[invocation setReturnValue: &retval];
-}
-
-
-static void
-Do (NSInvocation* invocation, NSEnumerator* enumerator)
-{
-	BXEnumerate (currentObject, e, enumerator)
-		[invocation invokeWithTarget: currentObject];
-}
-
-
-static id
-SelectFunction (id sender, id retval, int (* fptr)(id))
-{
-	BXEnumerate (currentObject, e, [sender objectEnumerator])
-	{
-		if (fptr (currentObject))
-			[retval addObject: currentObject];
-	}
-	retval = [[retval copy] autorelease];
-	return retval;
-}
-
-
-static id
-SelectFunction2 (id sender, id retval, int (* fptr)(id, void*), void* arg)
-{
-	BXEnumerate (currentObject, e, [sender objectEnumerator])
-	{
-		if (fptr (currentObject, arg))
-			[retval addObject: currentObject];
-	}
-	retval = [[retval copy] autorelease];
-	return retval;
-}
-
-
-static void
-Visit (NSInvocation* invocation, NSEnumerator* enumerator)
-{
-	BXEnumerate (currentObject, e, enumerator)
-	{
-		[invocation setArgument: &currentObject atIndex: 2];
-		[invocation invoke];
-	}
-}
-
-
-
-@implementation NSSet (PGTSHOM)
-- (void) _PGTSCollect: (NSInvocation *) invocation userInfo: (Class) retclass
-{
-	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectD: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectDK: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSDo: (NSInvocation *) invocation userInfo: (id) anObject
-{
-	Do (invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSVisit: (NSInvocation *) invocation userInfo: (id) userInfo
-{
-	Visit (invocation, [self objectEnumerator]);
-}
-
-
-- (id) PGTSAny
-{
-	return [self anyObject];
-}
-
-
-- (id) PGTSCollect
-{
-	return [self PGTSCollectReturning: [NSMutableSet class]];
-}
-
-
-- (id) PGTSCollectReturning: (Class) aClass
-{
-	return HOMTrampoline (self, @selector (_PGTSCollect:userInfo:), aClass);
-}
-
-
-- (id) PGTSCollectD
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectD:userInfo:), nil);
-}
-
-
-- (id) PGTSCollectDK
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectDK:userInfo:), nil);
-}
-
-
-- (id) PGTSSelectFunction: (int (*)(id)) fptr
-{
-	id retval = [NSMutableSet setWithCapacity: [self count]];
-	return SelectFunction (self, retval, fptr);
-}
-
-
-- (id) PGTSSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
-{
-	id retval = [NSMutableSet setWithCapacity: [self count]];
-	return SelectFunction2 (self, retval, fptr, arg);
-}
-
-
-- (id) PGTSDo
-{
-	return HOMTrampoline (self, @selector (_PGTSDo:userInfo:), nil);
-}
-
-
-- (id) PGTSVisit: (id) visitor
-{
-	return VisitorTrampoline (self, visitor, @selector (_PGTSVisit:userInfo:), nil);
-}
-@end
-
-
-
-@implementation NSArray (PGTSHOM)
-- (void) _PGTSCollect: (NSInvocation *) invocation userInfo: (Class) retclass
-{
-	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectD: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectDK: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSDo: (NSInvocation *) invocation userInfo: (id) userInfo
-{
-	Do (invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSVisit: (NSInvocation *) invocation userInfo: (id) userInfo
-{
-	Visit (invocation, [self objectEnumerator]);
-}
-
-
-- (NSArray *) PGTSReverse
-{
-	return [[self reverseObjectEnumerator] allObjects];
-}
-
-
-- (id) PGTSAny
-{
-	return [self lastObject];
-}
-
-
-- (id) PGTSCollect
-{
-	return [self PGTSCollectReturning: [NSMutableArray class]];
-}
-
-
-- (id) PGTSCollectReturning: (Class) aClass
-{
-	return HOMTrampoline (self, @selector (_PGTSCollect:userInfo:), aClass);
-}
-
-
-- (id) PGTSCollectD
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectD:userInfo:), nil);
-}
-
-
-- (id) PGTSCollectDK
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectDK:userInfo:), nil);
-}
-
-
-- (id) PGTSDo
-{
-	return HOMTrampoline (self, @selector (_PGTSDo:userInfo:), nil);
-}
-
-
-- (id) PGTSVisit: (id) visitor
-{
-	return VisitorTrampoline (self, visitor, @selector (_PGTSVisit:userInfo:), nil);
-}
-
-
-- (id) PGTSSelectFunction: (int (*)(id)) fptr
-{
-	id retval = [NSMutableArray arrayWithCapacity: [self count]];
-	return SelectFunction (self, retval, fptr);
-}
-
-
-- (id) PGTSSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
-{
-	id retval = [NSMutableArray arrayWithCapacity: [self count]];
-	return SelectFunction2 (self, retval, fptr, arg);
-}
-@end
-
-
-
-@implementation NSDictionary (PGTSHOM)
-- (void) _PGTSCollect: (NSInvocation *) invocation userInfo: (Class) retclass
-{
-	id retval = [[[retclass alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerform (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectD: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformD (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSCollectDK: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	CollectAndPerformDK (self, retval, invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSKeyCollectD: (NSInvocation *) invocation userInfo: (id) ignored
-{
-	id retval = [[[NSMutableDictionary alloc] initWithCapacity: [self count]] autorelease];
-	BXEnumerate (currentKey, e, [self keyEnumerator])
-	{
-		id value = [self objectForKey: currentKey];
-		id newKey = nil;
-		[invocation invokeWithTarget: currentKey];
-		[invocation getReturnValue: &newKey];
-		if (newKey)
-			[retval setObject: value forKey: newKey];
-	}
-	retval = [[retval copy] autorelease];
-	[invocation setReturnValue: &retval];
-}
-
-
-- (void) _PGTSDo: (NSInvocation *) invocation userInfo: (id) userInfo
-{
-	Do (invocation, [self objectEnumerator]);
-}
-
-
-- (void) _PGTSVisit: (NSInvocation *) invocation userInfo: (id) userInfo
-{
-	Visit (invocation, [self objectEnumerator]);
-}
-
-
-- (id) PGTSAny
-{
-	return [[self objectEnumerator] nextObject];
-}
-
-
-- (id) PGTSCollect
-{
-	return [self PGTSCollectReturning: [NSMutableArray class]];
-}
-
-
-- (id) PGTSCollectReturning: (Class) aClass
-{
-	return HOMTrampoline (self, @selector (_PGTSCollect:userInfo:), aClass);
-}
-
-
-- (id) PGTSCollectD
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectD:userInfo:), nil);
-}
-
-
-- (id) PGTSCollectDK
-{
-	return HOMTrampoline (self, @selector (_PGTSCollectDK:userInfo:), nil);
-}
-
-
-- (id) PGTSKeyCollectD
-{
-	return KeyTrampoline (self, @selector (_PGTSKeyCollectD:userInfo:), nil);
-}
-
-
-- (id) PGTSDo
-{
-	return HOMTrampoline (self, @selector (_PGTSDo:userInfo:), nil);
-}
-
-
-- (id) PGTSVisit: (id) visitor
-{
-	return VisitorTrampoline (self, visitor, @selector (_PGTSVisit:userInfo:), nil);
-}
-
-
-- (id) PGTSValueSelectFunction: (int (*)(id)) fptr
-{
-	id retval = [NSMutableArray arrayWithCapacity: [self count]];
-	return SelectFunction (self, retval, fptr);
-}
-
-
-- (id) PGTSValueSelectFunction: (int (*)(id, void*)) fptr argument: (void *) arg
-{
-	id retval = [NSMutableArray arrayWithCapacity: [self count]];
-	return SelectFunction2 (self, retval, fptr, arg);
-}
-@end

File Sources/PGTSInvocationRecorder.m

 //
 
 #import "PGTSInvocationRecorder.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 
 @class PGTSInvocationRecorder;
 
 {
 	[self setCallback: callback];
 	[self setCallbackTarget: target];
-	[self setTarget: [mCallbackTarget PGTSAny]];
+	[self setTarget: [mCallbackTarget BX_Any]];
 }
 @end

File Sources/PGTSQuery.m

 #import "PGTSConnection.h"
 #import "PGTSConnectionPrivate.h"
 #import "PGTSProbes.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 
 
 @implementation PGTSQuery
 		if ([connection canSend])
 		{
 			NSUInteger nParams = [self parameterCount];
-			NSArray* parameterObjects = [[mParameters PGTSCollect] PGTSParameter: connection];
+			NSArray* parameterObjects = [[mParameters BX_Collect] PGTSParameter: connection];
 			
 			const char** paramValues  = calloc (nParams, sizeof (char *));
 			Oid*   paramTypes   = calloc (nParams, sizeof (Oid));

File Sources/PGTSSchemaDescription.mm

 //
 
 #import "PGTSSchemaDescription.h"
-#import "PGTSHOM.h"
+#import "BXHOM.h"
 #import "PGTSTableDescription.h"
 #import "PGTSCollections.h"
 #import "BXLogger.h"