OpenDDS  Snapshot(2023/04/28-20:55)
be_init.cpp
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #include "be_extern.h"
9 #include "be_util.h"
10 #include "../Version.h"
11 
12 #include <global_extern.h>
13 #include <drv_extern.h>
14 
15 #include <ace/OS_NS_stdlib.h>
16 
17 #include <iostream>
18 #include <iomanip>
19 
20 void
22 {
23  ACE_DEBUG((LM_DEBUG, ACE_TEXT("OpenDDS version ") ACE_TEXT(OPENDDS_VERSION)
24  ACE_TEXT("\n")));
25 }
26 
27 int
28 BE_init(int&, ACE_TCHAR*[])
29 {
31  idl_global->default_idl_version_ = IDL_VERSION_4;
32  idl_global->anon_type_diagnostic(IDL_GlobalData::ANON_TYPE_SILENT);
33  return 0;
34 }
35 
36 void
37 BE_post_init(char*[], long)
38 {
39  if (idl_global->idl_version_ < IDL_VERSION_4) {
40  idl_global->ignore_files_ = true; // Exit without parsing files
41  be_global->error("OpenDDS requires IDL version to be 4 or greater");
42  return;
43  }
44 
45  std::ostringstream version;
46  version << "-D__OPENDDS_IDL=0x"
47  << std::setw(2) << std::setfill('0') << OPENDDS_MAJOR_VERSION
48  << std::setw(2) << std::setfill('0') << OPENDDS_MINOR_VERSION
49  << std::setw(2) << std::setfill('0') << OPENDDS_MICRO_VERSION;
50  DRV_cpp_putarg(version.str().c_str());
51 
52 #ifdef ACE_HAS_CDR_FIXED
53  DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_FIXED");
54 #endif
55 
56  std::string include_dds = be_util::dds_root();
57  if (include_dds.find(' ') != std::string::npos && include_dds[0] != '"') {
58  include_dds.insert(include_dds.begin(), '"');
59  include_dds.insert(include_dds.end(), '"');
60  }
61  be_global->add_inc_path(include_dds.c_str());
62  ACE_CString included;
63  DRV_add_include_path(included, include_dds.c_str(), 0, true);
64 
65  DRV_cpp_putarg("-D__OPENDDS_IDL_HAS_ANNOTATIONS");
66  be_global->builtin_annotations_.register_all();
67  // This annotation isn't used, but must match the one in idl2jni to avoid
68  // warnings or errors.
69  idl_global->eval("module OpenDDS {@annotation hidden_op_in_java {string impl;};};\n");
70 }
#define ACE_DEBUG(X)
#define OPENDDS_VERSION
Definition: Version.h:16
#define OPENDDS_MICRO_VERSION
Definition: Version.h:13
void BE_version()
Definition: be_init.cpp:21
const char * c_str(void) const
void register_all()
Definition: annotations.cpp:14
LM_DEBUG
int BE_init(int &, ACE_TCHAR *[])
Definition: be_init.cpp:28
char ACE_TCHAR
#define OPENDDS_MINOR_VERSION
Definition: Version.h:12
const char * dds_root()
Get DDS_ROOT. It is a fatal error if it wasn&#39;t set.
#define OPENDDS_MAJOR_VERSION
Definition: Version.h:11
ACE_TEXT("TCP_Factory")
BE_GlobalData * be_global
Definition: be_global.cpp:44
void BE_post_init(char *[], long)
Definition: be_init.cpp:37
#define ACE_NEW_RETURN(POINTER, CONSTRUCTOR, RET_VAL)