00001 #ifndef SAFETY_PROFILE_STREAMS_H 00002 #define SAFETY_PROFILE_STREAMS_H 00003 00004 #include "dds/DCPS/PoolAllocator.h" 00005 #include "dcps_export.h" 00006 00007 #include "ace/OS_NS_stdio.h" 00008 #include "tao/Basic_Types.h" 00009 00010 #ifndef OPENDDS_SAFETY_PROFILE 00011 #include <fstream> 00012 #include <iostream> 00013 #include <iomanip> 00014 #include <sstream> 00015 #endif //OPENDDS_SAFETY_PROFILE 00016 00017 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00018 00019 namespace OpenDDS { 00020 namespace DCPS { 00021 00022 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(::CORBA::UShort to_convert); 00023 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(int to_convert); 00024 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(unsigned int to_convert, bool as_hex = false); 00025 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(long to_convert); 00026 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(long long to_convert); 00027 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(unsigned long long to_convert, bool as_hex = false); 00028 OpenDDS_Dcps_Export OPENDDS_STRING to_dds_string(unsigned long to_convert, bool as_hex = false); 00029 00030 template <typename T> 00031 inline OPENDDS_STRING 00032 to_dds_string(const T* to_convert) 00033 { 00034 const char* fmt = "%p"; 00035 const int buff_size = 20 + 1; // note +1 for null terminator 00036 char buf[buff_size]; 00037 ACE_OS::snprintf(&buf[0], buff_size, fmt, to_convert); 00038 return OPENDDS_STRING(buf); 00039 } 00040 00041 } // namespace DCPS 00042 } // namespace OpenDDS 00043 00044 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00045 00046 #endif //SAFETY_PROFILE_STREAMS_H