1 # mob-port.tcl --
2 #
3 # Media object represetation of a port in a device.
4 #
5 # Copyright (c) 1996-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/imgr/mob-port.tcl,v 1.8 2002/07/18 22:49:32 weitsang Exp $
32
33 import Mob
34 import Object
35 Class MobPort -superclass Mob
36 Class MobInputPort -superclass MobPort
37 Class MobOutputPort -superclass MobPort
38
39 MobInputPort instproc init {name args} {
40 eval $self next $name $args
41 }
42
43
44 MobInputPort public get_type {} {
45 return "inport"
46 }
47
48
49 MobInputPort proc get_ext {} {
50 return ".in"
51 }
52
53 MobInputPort instproc share_readable {} {
54 return 1
55 }
56
57 MobInputPort instproc share_writable {} {
58 return 1
59 }
60
61 MobOutputPort instproc init {name args} {
62 eval $self next $name $args
63 }
64
65
66 MobOutputPort public get_type {} {
67 return "outport"
68 }
69
70 MobOutputPort proc get_ext {} {
71 return ".out"
72 }
73
74
75 MobOutputPort instproc share_readable {} {
76 return 1
77 }
78
79 MobPort instproc hostname { } {
80 set p [$self get_parent]
81 while {$p != ""} {
82 if {[$p is_instance_of MobDevice]} {
83 return [$p get_attribute hostname]
84 } else {
85 set p [$p get_parent]
86 }
87 }
88 return ""
89 }
90
91
92 MobPort instproc priority { } {
93 set p [$self get_parent]
94 while {$p != ""} {
95 if {[$p get_type] == "capturecard"} {
96 return [$p get_attribute priority]
97 } else {
98 set p [$p get_parent]
99 }
100 }
101 return "-1"
102 }
103
104
105 MobPort instproc device { } {
106 set p [$self get_parent]
107 while {$p != ""} {
108 if {[$p is_instance_of MobDevice]} {
109 return $p
110 } else {
111 set p [$p get_parent]
112 }
113 }
114 return ""
115 }
116
117 MobPort instproc device_name { } {
118 return [[$self device] name]
119 }
120
121 MobPort instproc port_name { } {
122 return [$self name]
123 }
124
125 MobPort instproc service_key {to} {
126 return "[[$self device] device_service_key $self $to]"
127 }
128
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.