MAINT-6584: Streamline static LLImageJ2C implementation API.
Specifically, remove unused function pointer types CreateLLImageJ2CFunction, DestroyLLImageJ2CFunction and EngineInfoLLImageJ2CFunction. Also eliminate static fallbackDestroyLLImageJ2CImpl() and fallbackEngineInfoLLImageJ2CImpl(), leaving only static fallbackCreateLLImageJ2CImpl(). We do need a factory function to instantiate the appropriate LLImageJ2CImpl subclass, so leave the fallbackCreateLLImageJ2CImpl() link seam in place. However, given that every known LLImageJ2CImpl subclass is cheap to instantiate, make getEngineInfo() a pure virtual method on that subclass: the static LLImageJ2C::getEngineInfo() method can temporarily construct an instance to query. While we're at it, make getEngineInfo() return std::string like LLImageJ2C::getEngineInfo(). It's ridiculous that fallbackEngineInfoLLImageJ2CImpl() implementations constructed a static std::string and returned its c_str(), only to have LLImageJ2C::getEngineInfo() construct ANOTHER std::string from the returned const char*. fallbackDestroyLLImageJ2CImpl() never did anything useful: it merely deleted the passed LLImageJ2CImpl subclass pointer as the specific subclass type. But since LLImageJ2CImpl's destructor is virtual, LLImageJ2C's destructor could simply delete the stored LLImageJ2CImpl*. In fact, make mImpl a boost::scoped_ptr<LLImageJ2CImpl> so we don't even have to delete it manually.
Showing
- indra/llimage/llimagej2c.cpp 11 additions, 19 deletionsindra/llimage/llimagej2c.cpp
- indra/llimage/llimagej2c.h 4 additions, 3 deletionsindra/llimage/llimagej2c.h
- indra/llimagej2coj/llimagej2coj.cpp 4 additions, 11 deletionsindra/llimagej2coj/llimagej2coj.cpp
- indra/llimagej2coj/llimagej2coj.h 6 additions, 5 deletionsindra/llimagej2coj/llimagej2coj.h
- indra/llkdu/llimagej2ckdu.cpp 3 additions, 9 deletionsindra/llkdu/llimagej2ckdu.cpp
- indra/llkdu/llimagej2ckdu.h 6 additions, 5 deletionsindra/llkdu/llimagej2ckdu.h
Please register or sign in to comment