Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / slib / mp_ptype.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                   */
24 /*%%  (c) Copyright 1993, 1994 International Business Machines Corp.     */
25 /*%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                    */
26 /*%%  (c) Copyright 1993, 1994 Novell, Inc.                              */
27 /*%%  $XConsortium: mp_ptype.h /main/3 1995/10/23 11:52:31 rswiston $                                                    */
28 /*
29  *  Tool Talk Message Passer (MP) - mp_ptype.h
30  *
31  *  Copyright (c) 1990 by Sun Microsystems, Inc.
32  *
33  *  Declaration of the _Tt_ptype class representing an in-memory process type
34  *  definition.
35  */
36
37 #ifndef _MP_PTYPE_H
38 #define _MP_PTYPE_H
39
40 #include "mp/mp_global.h"
41 #include "mp/mp_trace.h"
42 #include "mp_s_message_utils.h"
43 #include "mp_s_procid_utils.h"
44 #include "mp_signature_utils.h"
45 #include "util/tt_table.h"
46
47
48 /*
49  * _Tt_ptype is an in-memory representation of a process type
50  * definition in a ptype database.
51  */
52
53 declare_list_of(_Tt_ptype_prop)
54
55 class _Tt_ptype_prop : public _Tt_object {
56       public:
57         _Tt_ptype_prop();
58         _Tt_ptype_prop(_Tt_string name, _Tt_string value);
59         virtual ~_Tt_ptype_prop();
60         _Tt_string              name();
61         _Tt_string              value();
62         void                    print(const _Tt_ostream &os) const;
63         void                    pretty_print(const _Tt_ostream &os) const;
64         bool_t                  xdr(XDR *xdrs);
65       private:
66         _Tt_string              _name;
67         _Tt_string              _value;
68 };
69
70 class _Tt_ptype_ptr;
71 class _Tt_ptype : public _Tt_object {
72       public:
73         _Tt_ptype();
74         virtual ~_Tt_ptype();
75         _Tt_signature_list_ptr  &osigs();
76         _Tt_signature_list_ptr  &hsigs();
77         void                    proc_replied();
78         void                    proc_started(const _Tt_s_procid_ptr &pr);
79         const _Tt_string &      ptid() const {return _ptid;};
80         int                     getprop(_Tt_string propname,
81                                         _Tt_string &value);
82         Tt_status               start(_Tt_s_message_ptr &m,
83                                         const _Tt_msg_trace &trace);
84         void                    set_ptid(_Tt_string ptid);
85         void                    append_osigs(_Tt_signature_list_ptr &sigs);
86         void                    append_hsigs(_Tt_signature_list_ptr &sigs,
87                                         Tt_category category);
88         void                    append_osig(_Tt_signature_ptr sig);
89         void                    append_hsig(_Tt_signature_ptr sig,
90                                         Tt_category category);
91         void                    appendprop(_Tt_string name, _Tt_string value);
92         void                    print(const _Tt_ostream &os) const;
93         void                    pretty_print(const _Tt_ostream &os) const;
94         int                     check_semantics();
95         bool_t                  xdr(XDR *xdrs);
96         pid_t                   start_pid() const;
97         int                     launching() const;
98         void                    launch_failed();
99         void                    merge_with(_Tt_ptype_ptr &pt);
100         void                    *ce_entry;
101         int                     xdr_version_required() const;
102       private:
103         friend class  _Tt_typedb;
104         Tt_status               launch(_Tt_s_message_ptr &m,
105                                         const _Tt_msg_trace &trace);
106         int                     _launching;
107         pid_t                   _start_pid;
108         _Tt_string              _ptid;
109         _Tt_ptype_prop_list_ptr _props;
110         _Tt_s_message_list_ptr  _queued_messages;
111         _Tt_s_message_ptr       _startmsg;
112         _Tt_signature_list_ptr  _osigs;
113         _Tt_signature_list_ptr  _hsigs;
114       
115         friend int              operator==(_Tt_ptype&,_Tt_ptype&);
116         friend int              operator!=(_Tt_ptype&,_Tt_ptype&);
117 };
118
119 _Tt_string _tt_ptype_ptid(_Tt_object_ptr &o);
120 void _tt_otype_print(const _Tt_ostream &os, const _Tt_object *obj);
121 #endif                          /* _MP_PTYPE_H */