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