00001 /********************************************************************** 00002 * base_ref_image.C: 00003 **********************************************************************/ 00004 #include "base_ref_image.H" 00005 00006 HASH BaseVisRefImage::_hash(32); 00007 BaseVisRefImageFactory* BaseVisRefImage::_factory = 0; 00008 00009 BaseVisRefImage* 00010 BaseVisRefImage::lookup(CVIEWptr& v) 00011 { 00012 // Used instead of a public constructor. Lookup the BaseVisRefImage 00013 // associated w/ a view. (If the view could know about this type, 00014 // we would probably just store the it on the view.) 00015 00016 if (!v) { 00017 err_msg("BaseVisRefImage::lookup: error -- view is nil"); 00018 return 0; 00019 } 00020 00021 // hash on the view implementation rather than the view itself 00022 long key = (long)v->impl(); 00023 BaseVisRefImage* ret = (BaseVisRefImage*) _hash.find(key); 00024 if (!ret && _factory && (ret = _factory->produce(v))) 00025 _hash.add(key, (void *)ret); 00026 return ret; 00027 } 00028 00029 /* end of file base_ref_image.C */