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 #include <iostream>
25 
26 #include "dependy.hxx"
27 
28 
29 int
30 #ifdef WNT
31 _cdecl
32 #endif
main(int argc,char * argv[])33 main( int       argc,
34       char *    argv[] )
35 {
36     if (argc < 2 || *argv[1] == '?')
37     {
38         std::cout << "\nUse:\n"
39              << "srvdepy.exe  <xml-component-descriptions-root-directory>\n"
40              << std::endl;
41         return 0;
42     }
43 
44 
45     DependencyFinder aDependencies;
46 
47     aDependencies.GatherData(argv[1]);
48     char sInput[500] = "";
49     std::vector<Simstr>  aLibs;
50     std::vector<Simstr>  aServs;
51 
52 
53     std::cout
54          << "\nNow you can start to put in Service names.\n"
55          << "Please use correct case, but don't use namespaces.\n"
56          << "Just the Service's own name.\n\n"
57          << "To stop the program, put in a hashmark \"#\" + ENTER.\n"
58          << std::endl;
59 
60 
61 
62     do {
63 
64         sInput[0] = 0;
65         std::cin >> sInput;
66         Simstr sImplService(sInput);
67         if (*sInput != '#')
68         {
69             aLibs.erase( aLibs.begin(), aLibs.end() );
70             aServs.erase( aServs.begin(), aServs.end() );
71 
72             aDependencies.FindNeededServices( aLibs, aServs, sImplService );
73 
74             std::cout << "\n\n\nNeeded libraries: " << std::endl;
75             for ( unsigned i = 0; i < aLibs.size(); ++i )
76         	{
77                 std::cout << "    " << aLibs[i].str() << std::endl;
78         	}
79             std::cout << "\nNeeded services: " << std::endl;
80             for ( unsigned s= 0; s < aServs.size(); ++s )
81         	{
82                 std::cout << "    " << aServs[s].str() << std::endl;
83         	}
84             std::cout << "\n\n" << std::endl;
85         }
86     }   while (*sInput != '#');
87 
88     return 0;
89 }
90 
91 
92