1 
2 //
3 // This source file is part of appleseed.
4 // Visit https://appleseedhq.net/ for additional information and resources.
5 //
6 // This software is released under the MIT license.
7 //
8 // Copyright (c) 2017-2018 Francois Beaune, The appleseedhq Organization
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to deal
12 // in the Software without restriction, including without limitation the rights
13 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 // copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included in
18 // all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 // THE SOFTWARE.
27 //
28 
29 #pragma once
30 
31 // appleseed.foundation headers.
32 #include "foundation/core/concepts/iunknown.h"
33 #include "foundation/utility/api/apiarray.h"
34 #include "foundation/utility/autoreleaseptr.h"
35 
36 // appleseed.main headers.
37 #include "main/dllsymbol.h"
38 
39 // Forward declarations.
40 namespace foundation    { class Dictionary; }
41 namespace foundation    { class DictionaryArray; }
42 namespace foundation    { class SearchPaths; }
43 namespace renderer      { class Object; }
44 namespace renderer      { class ParamArray; }
45 
46 namespace renderer
47 {
48 
49 //
50 // An array of objects.
51 //
52 
53 APPLESEED_DECLARE_APIARRAY(ObjectArray, Object*);
54 
55 
56 //
57 // Object factory interface.
58 //
59 
60 class APPLESEED_DLLSYMBOL IObjectFactory
61   : public foundation::IUnknown
62 {
63   public:
64     // Return a string identifying this object model.
65     virtual const char* get_model() const = 0;
66 
67     // Return metadata for this object model.
68     virtual foundation::Dictionary get_model_metadata() const = 0;
69 
70     // Return metadata for the inputs of this object model.
71     virtual foundation::DictionaryArray get_input_metadata() const = 0;
72 
73     // Create a new single empty object.
74     virtual foundation::auto_release_ptr<Object> create(
75         const char*                     name,
76         const ParamArray&               params) const = 0;
77 
78     // Create objects, potentially from external assets.
79     virtual bool create(
80         const char*                     name,
81         const ParamArray&               params,
82         const foundation::SearchPaths&  search_paths,
83         const bool                      omit_loading_assets,
84         ObjectArray&                    objects) const = 0;
85 };
86 
87 }   // namespace renderer
88