1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADC_DISPLAY_HFI_HIERARCHY_HXX
25 #define ADC_DISPLAY_HFI_HIERARCHY_HXX
26 
27 // USED SERVICES
28 	// BASE CLASSES
29 	// COMPONENTS
30 	// PARAMETERS
31 #include <ary/idl/i_comrela.hxx>
32 #include <ary/idl/i_types4idl.hxx>
33 
34 
35 namespace csi
36 {
37 namespace xml
38 {
39     class Element;
40 }
41 }
42 
43 
44 class HF_IdlInterface;
45 class HtmlEnvironment_Idl;
46 
47 
48 
49 /** Represents a node in an pyramidic inheritance hierarchy which shall be
50     displayed in text mode.
51 */
52 class HF_IdlBaseNode
53 {
54   public:
55     typedef ary::idl::CodeEntity            CE;
56     typedef ary::idl::Type                  TYPE;
57     typedef ary::idl::Gate                  GATE;
58     typedef ary::idl::Ce_id                 Ce_id;
59     typedef ary::idl::Type_id               Type_id;
60 
61     /** @descr
62         The constructor recursively calls further constructors of
63         HF_IdlBaseNode for the bases of ->i_rType, if ->i_rType matches to a
64         ->CE.
65         So it builds up a complete hierarchy tree of all base classes
66         of ->i_pEntity.
67     */
68                         HF_IdlBaseNode(
69                             const TYPE &        i_rType,
70                             const GATE &        i_rGate,
71                             intt                i_nPositionOffset,
72                             HF_IdlBaseNode &    io_rDerived );
73                         ~HF_IdlBaseNode();
74 
75     /** Recursively fills ->o_rPositionList with the instances of base
76         classes in the order in which they will be displayed.
77     */
78     void                FillPositionList(
79                             std::vector< const HF_IdlBaseNode* > &
80                                                 o_rPositionList ) const;
81 
Type() const82     Type_id             Type() const            { return nType; }
BaseCount() const83     intt                BaseCount() const       { return nCountBases; }
Position() const84     intt                Position() const        { return nPosition; }
Xpos() const85     int                 Xpos() const            { return 3*Position(); }
Ypos() const86     int                 Ypos() const            { return 2*Position(); }
Derived() const87     const HF_IdlBaseNode *        Derived() const         { return pDerived; }
88 
89   private:
90     typedef std::vector< DYN HF_IdlBaseNode* > BaseList;
91 
92     void                GatherBases(
93                             const CE &          i_rCe,
94                             const GATE &        i_rGate );
95 
96     // DATA
97     Type_id             nType;
98     BaseList            aBases;
99     intt                nCountBases;
100     intt                nPosition;
101     HF_IdlBaseNode *    pDerived;
102 };
103 
104 void                Write_BaseHierarchy(
105                         csi::xml::Element & o_rOut,
106                         HtmlEnvironment_Idl &
107                                             i_env,
108                         const ary::idl::CodeEntity &
109                                             i_rCe );
110 
111 void                Write_Bases(
112                         csi::xml::Element & o_rOut,
113                         HtmlEnvironment_Idl &
114                                             i_env,
115                         const ary::idl::CodeEntity &
116                                             i_rCe,
117                         std::vector<uintt> &
118                                             io_setColumns );
119 
120 #endif
121