Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / soreduce / Library.h
blobb5263c637c6ed71411b56c7378ef06c4d2126c1e
1 // -*- C++ -*-
2 #ifndef _LIBRARY_H_
3 #define _LIBRARY_H_
5 // -*- C++ -*-
6 // File: Library.h
8 // Author: Phil Mesnier
10 // A Library is a collection of Obj_Modules that define a single shared
11 // library. It is used to manipulate the list of unresolved references by
12 // removing those that are resolved and adding those brought in by new modules
13 // that are required to resolve references. The Library is responsible
14 // for outputting a specialized mpc file to build the reduce footprint library.
16 #include "Obj_Module.h"
18 // FUZZ: disable check_for_streams_include
19 #include "ace/streams.h"
21 // The MPC generator class serves as the base class used to output the
22 // custom mpc files used to build the subsetted libraries.
23 // The base class will make libACE_subset.so
25 class MPC_Generator
27 public:
28 MPC_Generator (const ACE_CString& libname);
29 virtual ~MPC_Generator();
31 void write_prolog (const ACE_CString& );
32 void write_file (const ACE_CString& );
33 void write_epilog ();
35 protected:
36 virtual void write_baseprojects();
37 virtual void write_projectinfo();
39 ofstream mpcfile_;
40 ACE_CString libname_;
41 ACE_CString mpcfilename_;
44 // Generate mpc files for libraries dependant on ACE, that are not TAO.
45 class MPC_ACE_Dep_Lib : public MPC_Generator
47 public:
48 MPC_ACE_Dep_Lib (const ACE_CString& libname);
50 protected:
51 virtual void write_baseprojects();
52 virtual void write_projectinfo();
55 // Generates mpc files for libTAO_subset.so
56 class MPC_TAO_Lib : public MPC_ACE_Dep_Lib
58 public:
59 MPC_TAO_Lib (const ACE_CString& libname);
61 protected:
62 virtual void write_baseprojects();
63 virtual void write_projectinfo();
66 // Generates makefiles for libs dependant on TAO. This has a problem when
67 // building libraries in the orbsvcs tree.
68 class MPC_TAO_Dep_Lib : public MPC_TAO_Lib
70 public:
71 MPC_TAO_Dep_Lib (const ACE_CString& );
73 protected:
74 virtual void write_baseprojects();
75 virtual void write_projectinfo();
78 //----------------------------------------------------------------------------
80 class Library
82 public:
83 Library (const ACE_TCHAR *name = 0 );
84 /// Constructor is responsible for loading all of the modules related to the
85 /// library
86 ~Library ();
88 // Resolve interates over the supplied list of undefined signatures to locate
89 // modules that contain definitions. Any symbol defined in a module marked as
90 // exported is simply removed from the undef list. Any symbol defined in a
91 // module not yet exported removed from the undef list, the module is marked
92 // as exported, and its unresolved symbols are added to the undef list.
93 void resolve (Sig_List &undefs);
95 // Outputs a list of files suitable for inclusion in an mpc file to produce
96 // a subsetted library. If the argument is non-zero, reference countes for
97 // each module are also listed.
98 void write_export_list ( int );
100 // set the path to find the .so files
101 void set_path (const ACE_TCHAR *p );
103 // Load the actual .so files from the path.
104 void load_modules();
106 // returns the library name
107 const ACE_CString &name () const;
109 // returns non-zero if the module count is > 0.
110 int has_modules () const;
112 private:
113 ACE_CString name_;
114 ACE_CString path_;
116 int num_modules_;
117 int num_exports_;
118 int num_extrefs_;
120 Obj_Module **modules_;
121 Sig_List exported_;
122 MPC_Generator *mpcfile_;
125 #endif /* _LIBRARY_H_ */