Free Electron
MetaGraph.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __operator_MetaGraph_h__
8 #define __operator_MetaGraph_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Common graph navigation for Houdini, Maya, etc
17 
18  @ingroup meta
19 *//***************************************************************************/
20 class FE_DL_EXPORT MetaGraph: public OperatorGraphI
21 {
22  protected:
23 
24  class MetaNode: public DAGNode
25  {
26  public:
27  void set(void* a_nativeNode,String a_nodeName)
28  { m_nativeNode=a_nativeNode;
29  m_nodeName=a_nodeName; }
30 
31  void* m_nativeNode; //* MObject.ptr for Maya
32  String m_nodeName;
33  };
34 
35  public:
36  MetaGraph(void) {}
37 virtual ~MetaGraph(void) {}
38 
39 virtual U32 inputCount(String a_nodeName) const;
40 virtual String inputConnector(String a_nodeName,U32 a_index) const;
41 virtual BWORD hasInputConnector(String a_nodeName,
42  String a_inputConnector) const;
43 virtual String inputNode(String a_nodeName,
44  String a_inputConnector) const;
45 virtual String inputNodeOutputConnector(String a_nodeName,
46  String a_inputConnector) const;
47 
48 virtual U32 outputCount(String a_nodeName) const;
49 virtual String outputConnector(String a_nodeName,U32 a_index) const;
50 virtual BWORD hasOutputConnector(String a_nodeName,
51  String a_outputConnector) const;
52 virtual String outputNode(String a_nodeName,
53  String a_outputConnector) const;
54 
55  U32 inputCount(const void* a_rNativeNode) const;
56  String inputConnector(const void* a_rNativeNode,
57  U32 a_index) const;
58  BWORD hasInputConnector(const void* a_rNativeNode,
59  String a_inputConnector) const;
60  void* inputNode(const void* a_rNativeNode,
61  String a_inputConnector) const;
62 
63  U32 outputCount(const void* a_rNativeNode) const;
64  String outputConnector(const void* a_rNativeNode,
65  U32 a_index) const;
66  BWORD hasOutputConnector(const void* a_rNativeNode,
67  String a_outputConnector) const;
68  void* outputNode(const void* a_rNativeNode,
69  String a_outputConnector) const;
70 
71  protected:
72 
73  BWORD addConnection(String a_outputName,String a_outputConnector,
74  String a_inputName,String a_inputConnector);
75  BWORD removeConnection(String a_inputName,
76  String a_inputConnector);
77  void clear(void);
78  void add(void* a_nativeNode,String a_nodeName);
79  void addInput(const void* a_nativeNode,
80  String a_inputConnector);
81  void addOutput(const void* a_nativeNode,
82  String a_outputConnector);
83  BWORD addConnection(void* a_outputNode,String a_outputConnector,
84  void* a_inputNode,String a_inputConnector);
85  BWORD removeConnection(void* a_inputNode,String a_inputConnector);
86 
87  void dump(void) const;
88  String generateDot(void) const;
89 
90  sp<ImageI> render(void);
91 
92  private:
93 
94  std::map< const void*, sp<MetaNode> > m_nodeMap;
95  std::map<String,const void*> m_voidMap;
96  std::map<const void*,String> m_nameMap;
97 
98  String m_source;
99  sp<ImageI> m_spRenderer;
100 };
101 
102 } /* namespace ext */
103 } /* namespace fe */
104 
105 #endif /* __operator_MetaGraph_h__ */
kernel
Definition: namespace.dox:3
Node in a Directed Acyclic Graph.
Definition: DAGNode.h:18
Common graph navigation for Houdini, Maya, etc.
Definition: MetaGraph.h:20
Automatically reference-counted string container.
Definition: String.h:128
General graph navigation.
Definition: OperatorGraphI.h:20