1 // LiveNodeIO.h 2 // * PURPOSE 3 // Manage the import and export of an 'existing node' 4 // descriptor -- which refers to a system node 5 // (video input, audio mixer, etc.,) a dormant node 6 // described in the same document, or some other external 7 // node. 8 // 9 // In the first two cases, the node is described by a key 10 // string; the following preset key strings correspond to 11 // system nodes: 12 // 13 // AUDIO_INPUT 14 // AUDIO_OUTPUT 15 // AUDIO_MIXER 16 // VIDEO_INPUT 17 // VIDEO_OUTPUT 18 // DAC_TIME_SOURCE 19 // SYSTEM_TIME_SOURCE 20 // 21 // There's no way to describe a particular live node instance 22 // in a persistent fashion (an instance of the same node created 23 // in the future will have a different node ID.) At the moment, 24 // LiveNodeIO describes such nodes via two pieces of information: 25 // - the node name 26 // - the node's 'kind' bitmask 27 // 28 // * HISTORY 29 // e.moon 20dec99 begun 30 31 #ifndef __LiveNodeIO_H__ 32 #define __LiveNodeIO_H__ 33 34 #include "NodeRef.h" 35 #include "XML.h" 36 37 #include <String.h> 38 #include <Entry.h> 39 40 #include "cortex_defs.h" 41 __BEGIN_CORTEX_NAMESPACE 42 43 class NodeManager; 44 class NodeSetIOContext; 45 46 class LiveNodeIO : 47 public IPersistent { 48 49 public: // *** ctor/dtor 50 virtual ~LiveNodeIO(); 51 52 LiveNodeIO(); 53 LiveNodeIO( 54 const NodeManager* manager, 55 const NodeSetIOContext* context, 56 media_node_id node); 57 58 bool exportValid() const { return m_exportValid; } 59 60 // if true, call key() to fetch the key string; otherwise, 61 // call name()/kind() 62 bool hasKey() const { return m_key.Length() > 0; } 63 64 const char* key() const { return m_key.String(); } 65 66 const char* name() const { return m_name.String(); } 67 int64 kind() const { return m_kind; } 68 69 public: // *** import operations 70 71 // locate the referenced live node 72 status_t getNode( 73 const NodeManager* manager, 74 const NodeSetIOContext* context, 75 media_node_id* outNode) const; 76 77 public: // *** document-type setup 78 static void AddTo( 79 XML::DocumentType* docType); 80 81 public: // *** IPersistent 82 83 // EXPORT: 84 85 void xmlExportBegin( 86 ExportContext& context) const; 87 88 void xmlExportAttributes( 89 ExportContext& context) const; 90 91 void xmlExportContent( 92 ExportContext& context) const; 93 94 void xmlExportEnd( 95 ExportContext& context) const; 96 97 // IMPORT: 98 99 void xmlImportBegin( 100 ImportContext& context); 101 102 void xmlImportAttribute( 103 const char* key, 104 const char* value, 105 ImportContext& context); 106 107 void xmlImportContent( 108 const char* data, 109 uint32 length, 110 ImportContext& context); 111 112 void xmlImportChild( 113 IPersistent* child, 114 ImportContext& context); 115 116 void xmlImportComplete( 117 ImportContext& context); 118 119 private: // *** implementation 120 121 BString m_key; 122 BString m_name; 123 int64 m_kind; 124 125 bool m_exportValid; 126 }; 127 128 __END_CORTEX_NAMESPACE 129 #endif /*__LiveNodeIO_H__*/ 130 131