[ITK-users] confusion on ITK object factory

Han D. F jlu_hdf at 126.com
Mon May 5 16:11:21 EDT 2014


Hi Itk users
I just checked the itk object factory code and have some confusions> I think ITK should be right and anyone can help explain it?


in the itkObjectFactoryBase.cxx
void ObjectFactoryBase::RegisterOverride(
const char* classOverride,
const char* subclass,
const char* description,
bool enableFlag,
CreateObjectFunctionBase* createFunction)
{
ObjectFactoryBase::OverrideInformation info;


info.m_Description= description;
info.m_OverrideWithName = subclass;
info.m_EnabledFlag= enableFlag;
info.m_CreateObject= createFunction;


m_OverrideMap->insert(OverRideMap::value_type(classOverride, info));
}


where m_OverrideMap->insert(OverRideMap::value_type(classOverride, info));. it will insert the classOverride to the m_OverrideMap not  subclass. I think classOverride should be the farther class and the subclass is the class we working.


in the ObjectFactoryBase::CreateObject(const char* classname) function there is one 
OverRideMap::iterator start = m_OverrideMap->lower_bound(classname);
OverRideMap::iterator end = m_OverrideMap->upper_bound(classname);
I think the parameter classname should be the class we working() the working class).


So, I think we need call functions like   
->RegisterOverride( ITK::Object, MyObject,....)
->CreateObject("MyObject") 


In this way OverRideMap::iterator start = m_OverrideMap->lower_bound(classname) can not get the MyObject position


so, m_OverrideMap->insert(OverRideMap::value_type(classOverride, info)); should be 
m_OverrideMap->insert(OverRideMap::value_type(subclass, info)); ???


I just have this confusion
If I explain the problem well?
thanks
han











-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140506/2a47e861/attachment.html>


More information about the Insight-users mailing list