[Ace-users] [ace-users] ACE_Data_Block::base...Flags

JR Andreassen janrune at io.com
Mon Dec 10 10:14:31 CST 2007


Hi All...
 This is more of a phillosophical question,  but I attached the PRF at 
the end...

I inherrit from ACE_Data_Block in order to override the new/delete operators
to avoid Windows cross DLL alloc/dealloc issues.
So I do my own message data allocation.

One issue that cam up was that the call to ACE_Data_Block::base 
overwrites the flags.
Is this by design ??

I have some cases where I have to reallocate the message data and the 
flags got reset.
 Thanks
    JR

// **********************
// 
--------------------------------------------------------------------------------
    SDIACE_EXPORT void*    operator_new(size_t n);
    SDIACE_EXPORT void*    operator_new(size_t n, const char* debFile, 
int debLine);
    SDIACE_EXPORT void    operator_delete(void*  p, const char* debFile, 
int debLine);
    SDIACE_EXPORT void    operator_delete(void*  p);
#if defined (ACE_HAS_NEW_NOTHROW)
    SDIACE_EXPORT void*    operator_new(size_t n, const ACE_nothrow_t& 
nothrow);
    SDIACE_EXPORT void*    operator_new(size_t n, const ACE_nothrow_t& 
nothrow, const char* debFile, int debLine);
    SDIACE_EXPORT void    operator_delete(void*  p, const ACE_nothrow_t& 
nothrow, const char* debFile, int debLine);
    SDIACE_EXPORT void    operator_delete(void*  p, const ACE_nothrow_t& 
nothrow);
#endif
    // 
--------------------------------------------------------------------------------
#if defined (ACE_HAS_NEW_NOTHROW)
#define DECLARE_INLINE_NEW_DELETE_OPERATORS_SDI_ACE \
        void* operator new(size_t n, void* )\
        {    return SDI::ACE_Utils::operator_new(n, __FILE__, 
__LINE__);    };\
        void operator delete(void*  p)\
        {    SDI::ACE_Utils::operator_delete(p, __FILE__, __LINE__);    };\
        void operator delete(void*  p, void* p2)\
        {    SDI::ACE_Utils::operator_delete(p, __FILE__, __LINE__);    };\
        void* operator new(size_t n, const char* debFile = NULL, int 
debLine = 0)\
        {    return SDI::ACE_Utils::operator_new(n, debFile, 
debLine);    };\
        void operator delete(void*  p, const char* debFile, int debLine)\
        {    SDI::ACE_Utils::operator_delete(p, debFile, debLine);    };\
        void* operator new(size_t n, const ACE_nothrow_t& nothrow)\
        {    return SDI::ACE_Utils::operator_new(n, nothrow, NULL, 
0);    };\
        void* operator new(size_t n, const ACE_nothrow_t& nothrow, const 
char* debFile, int debLine)\
        {    return SDI::ACE_Utils::operator_new(n, nothrow, debFile, 
debLine);    };\
        void operator delete(void*  p, const ACE_nothrow_t& nothrow, 
const char* debFile, int debLine)\
        {    SDI::ACE_Utils::operator_delete(p, debFile, debLine);    };\
        void operator delete(void*  p, const ACE_nothrow_t& nothrow)\
        {    SDI::ACE_Utils::operator_delete(p, THIS_FILE, __LINE__);    };
#else
#define DECLARE_INLINE_NEW_DELETE_OPERATORS_SDI_ACE \
        void* operator new(size_t n, void* )\
        {    return SDI::ACE_Utils::operator_new(n, __FILE__, 
__LINE__);    };\
        void operator delete(void*  p)\
        {    SDI::ACE_Utils::operator_delete(p, __FILE__, __LINE__);    };\
        void operator delete(void*  p, void* p2)\
        {    SDI::ACE_Utils::operator_delete(p, __FILE__, __LINE__);    };\
        void* operator new(size_t n, const char* debFile = NULL, int 
debLine = 0)\
        {    return SDI::ACE_Utils::operator_new(n, debFile, 
debLine);    };\
        void operator delete(void*  p, const char* debFile, int debLine)\
        {    SDI::ACE_Utils::operator_delete(p, debFile, debLine);    };
#endif       
//----------------------------
class SDIACE_EXPORT Message_Data_Block
    : public ACE_Data_Block
{
...
public:
DECLARE_INLINE_NEW_DELETE_OPERATORS_SDI_ACE
...
}
--------------------------------------------------------------------------------------
    ACE VERSION: 5.6.1
    HOST MACHINE and OPERATING SYSTEM:    Win XP, sp1
    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:

    COMPILER NAME AND VERSION:     VC++ 8.0(MSVC 2005) & VC6

    CONTENTS OF $ACE_ROOT/ace/config.h
#if !defined (_WIN32_WCE)
#    define ACE_ENABLE_SWAP_ON_WRITE
//#    define ACE_DISABLE_SWAP_ON_READ
#    define ACE_DISABLE_WIN32_ERROR_WINDOWS
#    define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
#include "ace/config-win32.h"




More information about the Ace-users mailing list