Definitions.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_DEFINITION_H
00009 #define OPENDDS_DCPS_DEFINITION_H
00010
00011 #include "Cached_Allocator_With_Overflow_T.h"
00012 #include "ace/Message_Block.h"
00013 #include "ace/Global_Macros.h"
00014 #include "ace/Null_Mutex.h"
00015
00016 #include <functional>
00017 #include <utility>
00018
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 #pragma once
00021 #endif
00022
00023
00024
00025 #if defined (ACE_HAS_WCHAR) && \
00026 (!defined (_GLIBCPP_VERSION) || defined(_GLIBCPP_USE_WCHAR_T)) && \
00027 !defined (__ANDROID__)
00028 #define DDS_HAS_WCHAR
00029 #endif
00030
00031 #if defined (ACE_HAS_CPP11)
00032 #define OPENDDS_DELETED_COPY_MOVE_CTOR_ASSIGN(CLASS) \
00033 CLASS(const CLASS&) = delete; \
00034 CLASS(CLASS&&) = delete; \
00035 CLASS& operator=(const CLASS&) = delete; \
00036 CLASS& operator=(CLASS&&) = delete;
00037 #else
00038 #define OPENDDS_DELETED_COPY_MOVE_CTOR_ASSIGN(CLASS) \
00039 ACE_UNIMPLEMENTED_FUNC(CLASS(const CLASS&)) \
00040 ACE_UNIMPLEMENTED_FUNC(CLASS& operator=(const CLASS&))
00041 #endif
00042
00043 #if defined (ACE_DES_FREE_THIS)
00044 #define OPENDDS_DES_FREE_THIS ACE_DES_FREE_THIS
00045 #else
00046
00047
00048 # define OPENDDS_DES_FREE_THIS(DEALLOCATOR,CLASS) \
00049 do { \
00050 this->~CLASS (); \
00051 DEALLOCATOR (this); \
00052 } \
00053 while (0)
00054 #endif
00055
00056
00057
00058
00059
00060 #if defined(OPENDDS_NO_QUERY_CONDITION) && defined(OPENDDS_NO_CONTENT_FILTERED_TOPIC) && defined(OPENDDS_NO_MULTI_TOPIC)
00061 #define OPENDDS_NO_CONTENT_SUBSCRIPTION_PROFILE
00062 #endif
00063
00064 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00065
00066 namespace OpenDDS {
00067 namespace DCPS {
00068
00069 typedef Cached_Allocator_With_Overflow<ACE_Message_Block, ACE_Thread_Mutex> MessageBlockAllocator;
00070 typedef Cached_Allocator_With_Overflow<ACE_Data_Block, ACE_Thread_Mutex> DataBlockAllocator;
00071 struct DataSampleHeader;
00072 typedef Cached_Allocator_With_Overflow<DataSampleHeader, ACE_Null_Mutex> DataSampleHeaderAllocator;
00073
00074 #define DUP true
00075 #define NO_DUP false
00076
00077
00078 template <typename T_impl, typename T, typename T_ptr, typename T_var>
00079 struct Objref_Servant_Pair {
00080 Objref_Servant_Pair()
00081 : svt_(0)
00082 {}
00083
00084 Objref_Servant_Pair(T_impl* svt, T_ptr obj, bool dup)
00085 : svt_(svt)
00086 {
00087 if (dup) {
00088 obj_ = T::_duplicate(obj);
00089
00090 } else {
00091 obj_ = obj;
00092 }
00093 }
00094
00095 ~Objref_Servant_Pair()
00096 {}
00097
00098 bool operator==(const Objref_Servant_Pair & pair) const {
00099 return pair.svt_ == this->svt_;
00100 }
00101
00102 bool operator<(const Objref_Servant_Pair & pair) const {
00103 return this->svt_ < pair.svt_;
00104 }
00105
00106 T_impl* svt_;
00107 T_var obj_;
00108 };
00109
00110
00111
00112 template <class T, class V = typename T::_var_type>
00113 struct VarLess : public std::binary_function<V, V, bool> {
00114 bool operator()(const V& x, const V& y) const {
00115 return x.in() < y.in();
00116 }
00117 };
00118
00119 }
00120 }
00121
00122 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00123
00124 #endif