summaryrefslogtreecommitdiff
path: root/autodoc/source/ary/kernel/reposy.cxx
blob: 419eb90491cf83a2a8058495dffd2570d1d3ba68 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
/*************************************************************************
 *
 *  $RCSfile: reposy.cxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: np $ $Date: 2002-11-01 17:14:11 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

//  VERSION:            Autodoc 2.2


#include <precomp.h>
#include <reposy.hxx>


// NOT FULLY DECLARED SERVICES
#include <ary/x_ary.hxx>
#include <ary/actions.hxx>
#include <idl/i_reposypart.hxx>

    // S P L I T //

#include <store/storage.hxx>
#include <store/strg_ifc.hxx>
#include <id_gener.hxx>
#include <cpp/c_gate.hxx>
#include <loc/l_gate.hxx>



namespace ary
{


namespace n22
{

using ::ary::Command;
using ::ary::X_Ary;

//*****************     Repository          ************//

namespace
{
    static Dyn<RepositoryCenter> pTheInstance_(0);
}

Repository &
Repository::Create_( const String &     i_sName )
{
    if ( pTheInstance_ )
        throw X_Ary(X_Ary::x_MultipleRepository);

    pTheInstance_ = new RepositoryCenter( i_sName );
    return *pTheInstance_;
}

Repository &
Repository::The_()
{
    if ( pTheInstance_ )
        throw X_Ary(X_Ary::x_MissingRepository);

    return *pTheInstance_;
}

void
Repository::Destroy_()
{
    pTheInstance_ = 0;
}


//*****************     RepositoryCenter          ************//


RepositoryCenter::RepositoryCenter( const String & i_sName )
    :   sDisplayedName(i_sName),
        aLocation(),
#if 0       // Version 2.2
        pCppPartition(),
#endif // Version 2.2
        pIdlPartition()
{
}

RepositoryCenter::~RepositoryCenter()
{
}

void
RepositoryCenter::RunCommand_ProduceAllSecondaries()
{
    // KORR_FUTURE
}

void
RepositoryCenter::RunCommand_Statistic( ::ary::action::Statistic & io_rCommand )
{
    // KORR_FUTURE
}

void
RepositoryCenter::do_Perform( Command & io_rCommand )
{
    io_rCommand.Run(*this);
}

const String &
RepositoryCenter::inq_Name() const
{
    return sDisplayedName;
}

const ::ary::idl::Gate &
RepositoryCenter::inq_Gate_Idl() const
{
    return const_cast< RepositoryCenter& >(*this).access_Gate_Idl();
}


::ary::idl::Gate &
RepositoryCenter::access_Gate_Idl()
{
    if (NOT pIdlPartition)
        pIdlPartition = new idl::RepositoryPartition(*this);

    return pIdlPartition->TheGate();
}


#if 0       // Version 2.2
/*
cpp::Gate &
RepositoryCenter::access_Gate_Cpp()
{
    csv_assert( pCppPartition );
    return pCppPartition->TheGate();
}
const cpp::Gate &
RepositoryCenter::inq_Gate_Cpp() const
{
    csv_assert( pCppPartition );
    return pCppPartition->TheGate();
}
*/
#endif    // Version 2.2


}   // namespace n22



/*  ClassType-Ids
    -------------


    cpp                 1000
    idl                 2000
    corba               3000
    java                4000
    information         5000
    logic location      6000
    phys location       7000
    sec. prod.          8000


    cpp
    ---
    Namespace           1000
    Class               1001
    Enum                1002
    Typedef             1003
    Function            1004
    Variable            1005
    EnumValue           1006
    NamespaceAlias      1007

    BuiltInType         1200
    CeType_Final        1201
    CeType_Extern       1202
    PtrType             1211
    RefType             1212
    ConstType           1221
    VolatileType        1222
    ArrayType           1230
    TemplateInstance    1235
    FunctionPtr         1240
    DataMemberPtr       1250
    OperationMemberPtr  1260

    TplParam_Type       1301
    TplParam_Value      1302

    OpSignature         1400

    Define              1601
    Macro               1602


    idl
    ---

    Module              2000
    Interface           2001
    Function            2002
    Service             2003
    Property            2004
    Enum                2005
    EnumValue           2006
    Typedef             2007
    Struct              2008
    StructElement       2009
    Exception           2010
    ConstantGroup       2011
    Constant            2012
    Singleton           2013
    Attribute           2014

    BuiltInType         2200
    CeType              2201
    Sequence            2202
    ExplicitType        2203
    ExplicitNameRoom    2204

    java
    ----
    Package             4000
    Interface           4001
    Class               4002




    info
    ----
    CodeInformation
        (IDL)          11002
*/











                        //      S P L I T           //




namespace
{
    static Dyn<RepositoryCenter> pTheInstance_(0);
}

struct RepositoryCenter::CheshireCat
{
    //  DATA
    udmstri             sName;
    Dyn<store::Storage> pStorage;
    Dyn<Storage_Ifc>    pStorage_Ifc;
    Dyn<IdGenerator>    pIdGenerator;

    Dyn<cpp::Gate>      pGate_Cpp;
    Dyn<loc::Gate>      pGate_Locations;

                        CheshireCat(
                            const udmstri &     i_sName,
                            DYN IdGenerator &   let_drIds );
                        ~CheshireCat();
};


Repository &
Repository::Create_( const udmstri &     i_sName,
                     DYN IdGenerator *   let_dpIds )
{
    csv_assert( NOT pTheInstance_ );

    DYN IdGenerator * dpIds =
            let_dpIds != 0
                ?   let_dpIds
                :   new Std_IdGenerator;
    pTheInstance_ = new RepositoryCenter( i_sName, *dpIds );
    return *pTheInstance_;
}

Repository &
Repository::The_()
{
    csv_assert( pTheInstance_ );
    return *pTheInstance_;
}

void
Repository::Destroy_()
{
    pTheInstance_ = 0;
}

RepositoryCenter::RepositoryCenter( const udmstri &     i_sName,
                                    DYN IdGenerator &   let_drIds )
    :   pi( new CheshireCat(i_sName, let_drIds) )
{
}

RepositoryCenter::~RepositoryCenter()
{
}

const cpp::DisplayGate &
RepositoryCenter::inq_DisplayGate_Cpp() const
{
    return *pi->pGate_Cpp;
}

const udmstri &
RepositoryCenter::inq_Name() const
{
    return pi->sName;
}

cpp::RwGate &
RepositoryCenter::access_RwGate_Cpp()
{
    return *pi->pGate_Cpp;
}


RepositoryCenter::
CheshireCat::CheshireCat( const udmstri &     i_sName,
                          DYN IdGenerator &   let_drIds )
    :   sName(i_sName),
        pStorage(0),
        pStorage_Ifc(0),
        pIdGenerator( &let_drIds ),
        pGate_Cpp(0),
        pGate_Locations(0)
{
    pStorage                = new store::Storage;
    pStorage_Ifc            = new Storage_Ifc( *pStorage );
    pGate_Locations         = new loc::Gate(
                                        pStorage_Ifc->Ifc_Locations(),
                                        *pIdGenerator );
    pGate_Cpp               = new cpp::Gate(
                                        *pStorage_Ifc,
                                        *pIdGenerator,
                                        *pGate_Locations );
}

RepositoryCenter::
CheshireCat::~CheshireCat()
{
}


}   // namespace ary