1 /* 2 * Copyright (c) 1999-2000, Eric Moon. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions, and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 32 // ConnectionIO.h 33 // * PURPOSE 34 // Manage the import and export of a user-instantiated 35 // media node description. 36 // 37 // * HISTORY 38 // e.moon 8dec99 Begun 39 40 #ifndef __ConnectionIO_H__ 41 #define __ConnectionIO_H__ 42 43 #include "NodeRef.h" 44 #include "Connection.h" 45 #include "XML.h" 46 47 #include <String.h> 48 #include <Entry.h> 49 50 #include <MediaDefs.h> 51 52 class dormant_node_info; 53 54 #include "cortex_defs.h" 55 __BEGIN_CORTEX_NAMESPACE 56 57 class NodeManager; 58 class NodeSetIOContext; 59 class LiveNodeIO; 60 61 class ConnectionIO : 62 public IPersistent { 63 64 public: // *** ctor/dtor 65 virtual ~ConnectionIO(); 66 67 ConnectionIO(); 68 69 ConnectionIO( 70 const Connection* con, 71 const NodeManager* manager, 72 const NodeSetIOContext* context); 73 74 bool exportValid() const { return m_exportValid; } 75 76 public: // *** operations 77 78 // call when object imported to create the described 79 // connection 80 status_t instantiate( 81 NodeManager* manager, 82 const NodeSetIOContext* context, 83 Connection* outCon); 84 85 public: // *** document-type setup 86 static void AddTo( 87 XML::DocumentType* docType); 88 89 public: // *** IPersistent 90 91 // EXPORT: 92 93 void xmlExportBegin( 94 ExportContext& context) const; 95 96 void xmlExportAttributes( 97 ExportContext& context) const; 98 99 void xmlExportContent( 100 ExportContext& context) const; 101 102 void xmlExportEnd( 103 ExportContext& context) const; 104 105 // IMPORT: 106 107 virtual void xmlImportBegin( 108 ImportContext& context); 109 110 virtual void xmlImportAttribute( 111 const char* key, 112 const char* value, 113 ImportContext& context); 114 115 virtual void xmlImportContent( 116 const char* data, 117 uint32 length, 118 ImportContext& context); 119 120 virtual void xmlImportChild( 121 IPersistent* child, 122 ImportContext& context); 123 124 virtual void xmlImportComplete( 125 ImportContext& context); 126 127 128 virtual void xmlImportChildBegin( 129 const char* name, 130 ImportContext& context); 131 132 virtual void xmlImportChildComplete( 133 const char* name, 134 ImportContext& context); 135 136 private: // *** implementation 137 138 LiveNodeIO* m_inputNodeIO; 139 140 BString m_outputName; // original name if available 141 media_format m_outputFormat; 142 143 LiveNodeIO* m_outputNodeIO; 144 145 BString m_inputName; // original name if available 146 media_format m_inputFormat; 147 148 media_format m_requestedFormat; 149 150 uint32 m_flags; 151 152 bool m_exportValid; 153 154 // import state 155 enum import_state_t { 156 IMPORT_NONE, 157 IMPORT_OUTPUT, 158 IMPORT_INPUT 159 }; 160 import_state_t m_importState; 161 }; 162 163 __END_CORTEX_NAMESPACE 164 #endif /*__ConnectionIO_H__*/ 165 166