Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / ACE / apps / soreduce / Library.h
blob0c6f0ab0e3b57b41924fea92b6bc6dc1860030cf
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:
84 Library (const ACE_TCHAR *name = 0 );
85 /// Constructor is responsible for loading all of the modules related to the
86 /// library
87 ~Library ();
89 // Resolve interates over the supplied list of undefined signatures to locate
90 // modules that contain definitions. Any symbol defined in a module marked as
91 // exported is simply removed from the undef list. Any symbol defined in a
92 // module not yet exported removed from the undef list, the module is marked
93 // as exported, and its unresolved symbols are added to the undef list.
94 void resolve (Sig_List &undefs);
96 // Outputs a list of files suitable for inclusion in an mpc file to produce
97 // a subsetted library. If the argument is non-zero, reference countes for
98 // each module are also listed.
99 void write_export_list ( int );
101 // set the path to find the .so files
102 void set_path (const ACE_TCHAR *p );
104 // Load the actual .so files from the path.
105 void load_modules();
107 // returns the library name
108 const ACE_CString &name () const;
110 // returns non-zero if the module count is > 0.
111 int has_modules () const;
113 private:
114 ACE_CString name_;
115 ACE_CString path_;
117 int num_modules_;
118 int num_exports_;
119 int num_extrefs_;
121 Obj_Module **modules_;
122 Sig_List exported_;
123 MPC_Generator *mpcfile_;
126 #endif /* _LIBRARY_H_ */