ctkAbstractFileBasedFactory.tpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.commontk.org/LICENSE
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkAbstractFileBasedFactory_tpp
  15. #define __ctkAbstractFileBasedFactory_tpp
  16. // CTK includes
  17. #include "ctkAbstractFileBasedFactory.h"
  18. //----------------------------------------------------------------------------
  19. // ctkFactoryFileBasedItem methods
  20. //----------------------------------------------------------------------------
  21. template<typename BaseClassType>
  22. ctkAbstractFactoryFileBasedItem<BaseClassType>::ctkAbstractFactoryFileBasedItem(const QString& _path)
  23. :ctkAbstractFactoryItem<BaseClassType>()
  24. ,Path(_path)
  25. {
  26. }
  27. //----------------------------------------------------------------------------
  28. template<typename BaseClassType>
  29. QString ctkAbstractFactoryFileBasedItem<BaseClassType>::path()const
  30. {
  31. return this->Path;
  32. }
  33. //----------------------------------------------------------------------------
  34. // ctkAbstractFileBasedFactory methods
  35. //-----------------------------------------------------------------------------
  36. template<typename BaseClassType>
  37. ctkAbstractFileBasedFactory<BaseClassType>::ctkAbstractFileBasedFactory()
  38. :ctkAbstractFactory<BaseClassType>()
  39. {
  40. }
  41. //-----------------------------------------------------------------------------
  42. template<typename BaseClassType>
  43. ctkAbstractFileBasedFactory<BaseClassType>::~ctkAbstractFileBasedFactory()
  44. {
  45. }
  46. //----------------------------------------------------------------------------
  47. template<typename BaseClassType>
  48. QString ctkAbstractFileBasedFactory<BaseClassType>::path(const QString& key)
  49. {
  50. ctkAbstractFactoryFileBasedItem<BaseClassType>* _item =
  51. dynamic_cast<ctkAbstractFactoryFileBasedItem<BaseClassType>*>(this->item(key));
  52. Q_ASSERT(_item);
  53. return _item->path();
  54. }
  55. #endif