be_global.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_IDL_BE_GLOBAL_H
00009 #define OPENDDS_IDL_BE_GLOBAL_H
00010 
00011 #include "ace/SString.h"
00012 
00013 #include <string>
00014 #include <sstream>
00015 #include <set>
00016 
00017 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00018 # pragma once
00019 #endif /* ACE_LACKS_PRAGMA_ONCE */
00020 
00021 class AST_Generator;
00022 
00023 // Defines a class containing all back end global data.
00024 
00025 class BE_GlobalData {
00026 public:
00027   // = TITLE
00028   //    BE_GlobalData
00029   //
00030   // = DESCRIPTION
00031   //    Storage of global data specific to the compiler back end
00032   //
00033   BE_GlobalData();
00034   // Constructor.
00035 
00036   virtual ~BE_GlobalData();
00037   // Destructor.
00038 
00039   // Data accessors.
00040 
00041   const char* holding_scope_name() const;
00042 
00043   void destroy();
00044   // Cleanup function.
00045 
00046   const char* filename() const;
00047   void filename(const char* fname);
00048 
00049   //bool do_included_files() const;
00050 
00051   ACE_CString spawn_options();
00052   // Command line passed to ACE_Process::spawn. Different
00053   // implementations in IDL and IFR backends.
00054 
00055   void parse_args(long& i, char** av);
00056   // Parse args that affect the backend.
00057 
00058   void open_streams(const char* filename);
00059 
00060   std::ostringstream header_, impl_, idl_, ws_config_, itl_, facets_header_, facets_impl_,
00061     lang_header_;
00062   ACE_CString header_name_, impl_name_, idl_name_, ws_config_name_, itl_name_,
00063     facets_header_name_, facets_impl_name_, lang_header_name_,
00064     output_dir_, tao_inc_pre_;
00065 
00066   ///print message to all open streams
00067   void multicast(const char* message);
00068 
00069   enum stream_enum_t {
00070     STREAM_H, STREAM_CPP, STREAM_IDL, STREAM_WS, STREAM_ITL,
00071     STREAM_FACETS_H, STREAM_FACETS_CPP,
00072     STREAM_LANG_H
00073   };
00074 
00075   void reset_includes();
00076 
00077   void add_include(const char* file, stream_enum_t which = STREAM_H);
00078 
00079   /// Called to indicate that OpenDDS marshaling (serialization) code for the
00080   /// current file will depend on marshaling code generated for the indicated
00081   /// file.  For example, if the current file is A.idl and it contains a struct
00082   /// which has a field of type B, defined in B.idl, the full path to B.idl is
00083   /// passed to this function.
00084   void add_referenced(const char* file);
00085 
00086   void set_inc_paths(const char* cmdline);
00087   void add_inc_path(const char* path);
00088 
00089   std::string get_include_block(stream_enum_t which);
00090 
00091   ACE_CString export_macro() const;
00092   void export_macro(const ACE_CString& str);
00093 
00094   ACE_CString export_include() const;
00095   void export_include(const ACE_CString& str);
00096 
00097   ACE_CString pch_include() const;
00098   void pch_include(const ACE_CString& str);
00099 
00100   bool java() const;
00101   void java(bool b);
00102 
00103   bool v8() const;
00104   void v8(bool b);
00105 
00106   bool face_ts() const;
00107   void face_ts(bool b);
00108 
00109   ACE_CString java_arg() const;
00110   void java_arg(const ACE_CString& str);
00111 
00112   enum LanguageMapping {
00113     LANGMAP_NONE, ///< Don't generate, let tao_idl handle it
00114     LANGMAP_FACE_CXX, ///< Generate C++ language mapping from FACE spec
00115     LANGMAP_SP_CXX ///< Generate C++ language mapping for Safety Profile
00116   };
00117 
00118   LanguageMapping language_mapping() const;
00119   void language_mapping(LanguageMapping lm);
00120 
00121   ACE_CString sequence_suffix() const;
00122   void sequence_suffix(const ACE_CString& str);
00123 
00124   bool suppress_idl() const { return suppress_idl_; }
00125   bool suppress_typecode() const { return suppress_typecode_; }
00126 
00127   bool generate_wireshark() const { return generate_wireshark_; }
00128   bool generate_itl() const { return generate_itl_; }
00129 
00130   static bool writeFile(const char* fileName, const std::string &content);
00131 
00132 private:
00133   const char* filename_;
00134   // Name of the IDL file we are processing.
00135 
00136   bool java_, suppress_idl_, suppress_typecode_,
00137     generate_wireshark_, generate_itl_, v8_, face_ts_;
00138 
00139   ACE_CString export_macro_, export_include_, pch_include_, java_arg_, seq_;
00140 
00141   LanguageMapping language_mapping_;
00142 };
00143 
00144 class BE_Comment_Guard {
00145 public:
00146 
00147   BE_Comment_Guard(const char* type, const char* name);
00148   ~BE_Comment_Guard();
00149 
00150 private:
00151   const char *type_, *name_;
00152 };
00153 
00154 #endif /* OPENDDS_IDL_BE_GLOBAL_H */

Generated on Fri Feb 12 20:05:19 2016 for OpenDDS by  doxygen 1.4.7