summaryrefslogtreecommitdiff
path: root/TAO/tao/Versioned_Namespace.h
blob: 142e88c9f86b10d0af8b8471b8249506bd623599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// -*- C++ -*-

//=============================================================================
/**
 * @file    Versioned_Namespace.h
 *
 * Versioned namespace support.
 *
 * Useful for preventing conflicts when using a third party library.
 *
 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
 */
//=============================================================================

#ifndef TAO_VERSIONED_NAMESPACE_H
#define TAO_VERSIONED_NAMESPACE_H

#if !defined (TAO_ORBCONF_H) && !defined (ACE_CONFIG_MACROS_H)
# error This header is only meant to be included after "tao/orbconf.h".
#endif  /* !TAO_ORBCONF_H */


#if !defined (TAO_HAS_VERSIONED_NAMESPACE) \
  && defined (ACE_HAS_VERSIONED_NAMESPACE) \
  && ACE_HAS_VERSIONED_NAMESPACE == 1
# define TAO_HAS_VERSIONED_NAMESPACE 1
#endif  /* !TAO_HAS_VERSIONED_NAMESPACE
           && ACE_HAS_VERSIONED_NAMESPACE == 1*/

#if defined (TAO_HAS_VERSIONED_NAMESPACE) && TAO_HAS_VERSIONED_NAMESPACE == 1

# ifndef TAO_VERSIONED_NAMESPACE_NAME
#  include "tao/Version.h"

// Preprocessor symbols will not be expanded if they are
// concatenated.  Force the preprocessor to expand them during the
// argument prescan by calling a macro that itself calls another that
// performs the actual concatenation.
#  define TAO_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,MICRO) TAO_ ## MAJOR ## _ ## MINOR ## _ ## MICRO
#  define TAO_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,MICRO) TAO_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,MICRO)
#  define TAO_VERSIONED_NAMESPACE_NAME TAO_MAKE_VERSIONED_NAMESPACE_NAME(TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_MICRO_VERSION)
# endif  /* !TAO_VERSIONED_NAMESPACE_NAME */

# define TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO_VERSIONED_NAMESPACE_NAME {
# define TAO_END_VERSIONED_NAMESPACE_DECL } \
  using namespace TAO_VERSIONED_NAMESPACE_NAME;

#else

# define TAO_VERSIONED_NAMESPACE_NAME
# define TAO_BEGIN_VERSIONED_NAMESPACE_DECL
# define TAO_END_VERSIONED_NAMESPACE_DECL

#endif  /* TAO_HAS_VERSIONED_NAMESPACE */

#endif  /* !TAO_VERSIONED_NAMESPACE_H */