| 1 | // Licensed to the .NET Foundation under one or more agreements. |
|---|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | #ifndef _FACTORY_INL_ |
| 6 | #define _FACTORY_INL_ |
| 7 | |
| 8 | #include "factory.h" |
| 9 | |
| 10 | template<typename PRODUCT, DWORD MAX_FACTORY_PRODUCT> |
| 11 | PRODUCT* InlineFactory<PRODUCT, MAX_FACTORY_PRODUCT>::Create() |
| 12 | { |
| 13 | WRAPPER_NO_CONTRACT; |
| 14 | |
| 15 | if (m_cProduct == MAX_FACTORY_PRODUCT) |
| 16 | { |
| 17 | InlineFactory* pNext = GetNext(); |
| 18 | if (pNext) |
| 19 | { |
| 20 | return pNext->Create(); |
| 21 | } |
| 22 | else |
| 23 | { |
| 24 | return NULL; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | return &m_product[m_cProduct++]; |
| 29 | } |
| 30 | |
| 31 | #endif |
| 32 | |
| 33 |