BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / cortex / RouteApp / LiveNodeIO.h
blobee3abecc3c660c3aa51613022e64e9ca36178ecb
1 /*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
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.
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.
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.
32 // LiveNodeIO.h
33 // * PURPOSE
34 // Manage the import and export of an 'existing node'
35 // descriptor -- which refers to a system node
36 // (video input, audio mixer, etc.,) a dormant node
37 // described in the same document, or some other external
38 // node.
40 // In the first two cases, the node is described by a key
41 // string; the following preset key strings correspond to
42 // system nodes:
44 // AUDIO_INPUT
45 // AUDIO_OUTPUT
46 // AUDIO_MIXER
47 // VIDEO_INPUT
48 // VIDEO_OUTPUT
49 // DAC_TIME_SOURCE
50 // SYSTEM_TIME_SOURCE
52 // There's no way to describe a particular live node instance
53 // in a persistent fashion (an instance of the same node created
54 // in the future will have a different node ID.) At the moment,
55 // LiveNodeIO describes such nodes via two pieces of information:
56 // - the node name
57 // - the node's 'kind' bitmask
59 // * HISTORY
60 // e.moon 20dec99 begun
62 #ifndef __LiveNodeIO_H__
63 #define __LiveNodeIO_H__
65 #include "NodeRef.h"
66 #include "XML.h"
68 #include <String.h>
69 #include <Entry.h>
71 #include "cortex_defs.h"
72 __BEGIN_CORTEX_NAMESPACE
74 class NodeManager;
75 class NodeSetIOContext;
77 class LiveNodeIO :
78 public IPersistent {
80 public: // *** ctor/dtor
81 virtual ~LiveNodeIO();
83 LiveNodeIO();
84 LiveNodeIO(
85 const NodeManager* manager,
86 const NodeSetIOContext* context,
87 media_node_id node);
89 bool exportValid() const { return m_exportValid; }
91 // if true, call key() to fetch the key string; otherwise,
92 // call name()/kind()
93 bool hasKey() const { return m_key.Length() > 0; }
95 const char* key() const { return m_key.String(); }
97 const char* name() const { return m_name.String(); }
98 int64 kind() const { return m_kind; }
100 public: // *** import operations
102 // locate the referenced live node
103 status_t getNode(
104 const NodeManager* manager,
105 const NodeSetIOContext* context,
106 media_node_id* outNode) const;
108 public: // *** document-type setup
109 static void AddTo(
110 XML::DocumentType* docType);
112 public: // *** IPersistent
114 // EXPORT:
116 void xmlExportBegin(
117 ExportContext& context) const;
119 void xmlExportAttributes(
120 ExportContext& context) const;
122 void xmlExportContent(
123 ExportContext& context) const;
125 void xmlExportEnd(
126 ExportContext& context) const;
128 // IMPORT:
130 void xmlImportBegin(
131 ImportContext& context);
133 void xmlImportAttribute(
134 const char* key,
135 const char* value,
136 ImportContext& context);
138 void xmlImportContent(
139 const char* data,
140 uint32 length,
141 ImportContext& context);
143 void xmlImportChild(
144 IPersistent* child,
145 ImportContext& context);
147 void xmlImportComplete(
148 ImportContext& context);
150 private: // *** implementation
152 BString m_key;
153 BString m_name;
154 int64 m_kind;
156 bool m_exportValid;
159 __END_CORTEX_NAMESPACE
160 #endif /*__LiveNodeIO_H__*/