Commit Graph
4 Commits
Author SHA1 Message Date
Steve Checkoway 8d266cf4a2 Use a set instead of a vector. This makes Unregister() take O(log n) rather than O(n) while Register() now takes O(log n) rather than O(1). Since everything registered is eventually unregistered--as far as I can tell--this is a significant net gain. In practice, the speed up is quite noticable. 2008-07-21 08:57:07 +00:00
Steve Checkoway 4991a266df Remove unnecessary CACHED_REGISTER_CLASS. 2007-08-16 09:32:40 +00:00
Steve Checkoway 62b49f2d7f Fix compile and link errors. The relevant parts of the standard have been cited for those following along at home.
typename must be used for dependent name resolution as described in 14.6 [temp.res].
An elaborated-type-specifier with the class-key present is required ("shall be used") in a friend declaration for a class. 11.4.2 [class.friend] and 7.1.5.3.1 [decl.type.elab].
However, an elaborated-type-specifier cannot be  a typedef-name. 3.4.4.2 [basic.lookup.elab].
Lastly, the is no need for registration since "a definition for a static data member may be provided in a namespace scope enclosing the definition of the static member's class template." 14.5.1.3.1 [temp.static].
2007-08-14 09:17:56 +00:00
Glenn Maynard 40ad9a166c A common problem we have is being able to manipulate major objects,
like songs and courses: it's difficult to guarantee that all references
to them are updated if they're deleted or reallocated, which is a brittleness
that leads to obscure bugs.

A general fix for this is to avoid storing pointers to objects, and
to use IDs instead; for example, SongID to reference a song (which
tags by directory).  This leads to an efficiency problem: searching
a map<RString> is much more expensive.  We need a robust way to
cache the results.

Implement CachedObject<T>, CachedObjectPointer<T>.  This implements
caching pointers to objects, negative caching, clearing cache when objects
are deleted, and clearing negative cache when objects are created.
2007-08-12 21:59:10 +00:00