summaryrefslogtreecommitdiff
path: root/Runtime/mecanim/graph/factory.h
blob: d76fcbf497314a62800fc6127a4031d553f5905f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 Copyright (c) 7244339 Canada Inc. (Mecanim)
 All Rights Reserved.
*/
#pragma once

#include "Runtime/mecanim/defs.h"
#include "Runtime/mecanim/memory.h"
#include "Runtime/mecanim/types.h"
#include "Runtime/mecanim/object.h"

#include "Runtime/mecanim/graph/plug.h"
#include "Runtime/mecanim/graph/node.h"

namespace mecanim
{

namespace graph
{
	// This class can be subclassed if you need to create custom node and want to add them to the list of
	// instanciable node
	class GraphFactory
	{
	public:
		virtual Node* Create(eNodeType aNodeId, memory::Allocator& arAlloc)const;
		virtual GraphPlug* Create(ePlugType aPlugType, memory::Allocator& arAlloc)const;
	};

	template <typename TYPE> TYPE* Create(GraphFactory const& arFactory, memory::Allocator& arAlloc)
	{
		return static_cast<TYPE*>(arFactory.Create(TYPE::mId, arAlloc));
	}
}

}