summaryrefslogtreecommitdiffstats
path: root/xpa/doc/pod/xpacmdnew.pod
blob: 429972b8ee402c7563373fbdf3612484d58d8ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
=pod

=head1 NAME



B<XPACmdNew: create a new XPA public access point for commands>



=head1 SYNOPSIS





  #include <xpa.h>

  XPA XPACmdNew(char *class, char *name);





=head1 DESCRIPTION




Create a new XPA public access point for commands that will share a
common identifier class:name. Enter this access point into the XPA
name server, so that it can be accessed by external processes.
XPACmdNew() returns an XPA struct.


It often is more convenient to have one public access point that can
manage a number of commands, rather than having individual access
points for each command. For example, it is easier to command the
ds9 image display using:

  echo "colormap I8"   | xpaset ds9
  echo "scale log"     | xpaset ds9
  echo "file foo.fits" | xpaset ds9


then to use:

  echo "I8"       | xpaset ds9_colormap
  echo "log"      | xpaset ds9_scale
  echo "foo.fits" | xpaset ds9_file


In the first case, the commands remain the same regardless of the
target XPA name.  In the second case, the command names must change
for each instance of ds9.  That is, if a second instance of ds9
called DS9 were running, it would be commanded either as:

  echo "colormap I8"   | xpaset DS9
  echo "scale log"     | xpaset DS9
  echo "file foo.fits" | xpaset DS9


or as:

  echo "I8"       | xpaset DS9_colormap
  echo "log"      | xpaset DS9_scale
  echo "foo.fits" | xpaset DS9_file


Thus, in cases where a program is going to manage many commands, it
generally is easier to define them as commands associated with the
XPACmdNew() routine, rather than as separate access points using
XPANew().


When XPACmdNew() is called, only the class:name identifier is
specified.  Each sub-command is subsequently defined using the
XPACmdAdd() routine.




=head1 SEE ALSO



See xpa(n) for a list of XPA help pages


=cut