@implementation WOCompoundElement
#ifdef DEBUG
-static int profElements = -1;
+static int profElements = -1;
+static int embedInPool = -1;
+static int logId = -1;
static Class NSDateClass = Nil;
#endif
static int descriptiveIDs = -1;
++ (void)initialize {
+ NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
+
+ if (descriptiveIDs == -1) {
+ descriptiveIDs =
+ [[ud objectForKey:@"WODescriptiveElementIDs"] boolValue] ? 1 : 0;
+ }
+
+#if DEBUG
+ if (profElements == -1) {
+ profElements = [[[NSUserDefaults standardUserDefaults]
+ objectForKey:@"WOProfileElements"]
+ boolValue] ? 1 : 0;
+ }
+ if (embedInPool == -1) {
+ embedInPool = [[[NSUserDefaults standardUserDefaults]
+ objectForKey:@"WOCompoundElementPool"]
+ boolValue] ? 1 : 0;
+ NSLog(@"WOCompoundElement: pool embedding is on.");
+ }
+ if (logId == -1) {
+ logId = [[[NSUserDefaults standardUserDefaults]
+ objectForKey:@"WOCompoundElementLogID"]
+ boolValue] ? 1 : 0;
+ NSLog(@"WOCompoundElement: id logging is on.");
+ }
+#endif
+}
+
+ (id)allocForCount:(int)_count zone:(NSZone *)_zone {
return NSAllocateObject(self, _count * sizeof(WOElement *), _zone);
}
self = [super init];
- if (descriptiveIDs == -1) {
- descriptiveIDs =
- [[[NSUserDefaults standardUserDefaults]
- objectForKey:@"WODescriptiveElementIDs"]
- boolValue] ? 1 : 0;
- }
-
objAtIdx = (void *)[_children methodForSelector:
@selector(objectAtIndex:)];
NSAssert1(objAtIdx != NULL,
static NSString *cName = @"componentName";
static NSString *elemId = @"elementID";
#endif
- static int embedInPool = -1;
- static int logId = -1;
NSTimeInterval st = 0.0;
-
+
if (NSDateClass == Nil)
NSDateClass = [NSDate class];
-
- if (profElements == -1) {
- profElements = [[[NSUserDefaults standardUserDefaults]
- objectForKey:@"WOProfileElements"]
- boolValue] ? 1 : 0;
- }
- if (embedInPool == -1) {
- embedInPool = [[[NSUserDefaults standardUserDefaults]
- objectForKey:@"WOCompoundElementPool"]
- boolValue] ? 1 : 0;
- NSLog(@"WOCompoundElement: pool embedding is on.");
- }
- if (logId == -1) {
- logId = [[[NSUserDefaults standardUserDefaults]
- objectForKey:@"WOCompoundElementLogID"]
- boolValue] ? 1 : 0;
- NSLog(@"WOCompoundElement: id logging is on.");
- }
#endif
depth++;