PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/factory.h

http://github.com/mozy/mordor
C Header | 23 lines | 14 code | 6 blank | 3 comment | 0 complexity | 7b9edc2af2f3206597fb368c65f5ad91 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. #ifndef __MORDOR_FACTORY_H__
  2. #define __MORDOR_FACTORY_H__
  3. // Copyright (c) 2010 - Mozy, Inc.
  4. namespace Mordor {
  5. // Wish I could use boost functional/factory, but that's new in boost 1.43,
  6. // which no version of Debian currently has
  7. struct Dummy;
  8. template <class BaseType, class T, class A1 = Dummy, class A2 = Dummy>
  9. class Creator
  10. {
  11. public:
  12. BaseType *create0() { return new T(); }
  13. BaseType *create1(A1 a1) { return new T(a1); }
  14. BaseType *create2(A1 a1, A2 a2) { return new T(a1, a2); }
  15. };
  16. };
  17. #endif