version 1.1.1.1, 2001/01/14 19:52:41
|
version 1.24.16.1, 2007/09/11 16:32:42
|
|
|
//BEGIN_LICENSE |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
|
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
|
// |
|
// Permission is hereby granted, free of charge, to any person obtaining a copy |
|
// of this software and associated documentation files (the "Software"), to |
|
// deal in the Software without restriction, including without limitation the |
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
// sell copies of the Software, and to permit persons to whom the Software is |
|
// furnished to do so, subject to the following conditions: |
|
// |
|
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
|
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
|
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
//============================================================================== |
// copy of this software and associated documentation files (the "Software"), |
|
// to deal in the Software without restriction, including without limitation |
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
// and/or sell copies of the Software, and to permit persons to whom the |
|
// Software is furnished to do so, subject to the following conditions: |
|
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
//%///////////////////////////////////////////////////////////////////////////// |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
// DEALINGS IN THE SOFTWARE. |
|
// |
|
//END_LICENSE |
|
//BEGIN_HISTORY |
|
// |
|
// Author: |
|
// |
|
// $Log$ |
|
// Revision 1.1.1.1 2001/01/14 19:52:41 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
|
|
| |
#include <cstring> | #include <cstring> |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/Type.h> |
#include <Pegasus/Common/CIMType.h> |
#include <Pegasus/Common/Char16.h> | #include <Pegasus/Common/Char16.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
template<class T> | template<class T> |
inline void Destroy(T* items, Uint32 size) | inline void Destroy(T* items, Uint32 size) |
{ | { |
|
#ifdef PEGASUS_OS_HPUX |
|
// Empirical evidence shows that the memory allocator on HP-UX performs |
|
// better when deallocating more recently allocated memory first (LIFO). |
|
// Since most arrays are built up by appending elements to the end, it is |
|
// advantageous to destruct the elements in reverse order. |
|
items += size-1; |
|
while (size--) |
|
(items--)->~T(); |
|
#else |
while (size--) | while (size--) |
items++->~T(); | items++->~T(); |
|
#endif |
} | } |
| |
inline void Destroy(Boolean* items, Uint32 size) { } |
template<class T> |
inline void Destroy(Uint8* items, Uint32 size) { } |
inline void CopyToRaw(T* to, const T* from, Uint32 size) |
inline void Destroy(Sint8* items, Uint32 size) { } |
|
inline void Destroy(Uint16* items, Uint32 size) { } |
|
inline void Destroy(Sint16* items, Uint32 size) { } |
|
inline void Destroy(Uint32* items, Uint32 size) { } |
|
inline void Destroy(Sint32* items, Uint32 size) { } |
|
inline void Destroy(Uint64* items, Uint32 size) { } |
|
inline void Destroy(Sint64* items, Uint32 size) { } |
|
inline void Destroy(Real32* items, Uint32 size) { } |
|
inline void Destroy(Real64* items, Uint32 size) { } |
|
inline void Destroy(Char16* items, Uint32 size) { } |
|
|
|
template<class T, class U> |
|
inline void CopyToRaw(T* to, const U* from, Uint32 size) |
|
{ | { |
while (size--) | while (size--) |
new(to++) T(*from++); |
{ |
|
// The following fails on TRU64: |
|
// new(to++) T(*from++); |
|
// Probably a compiler error so I changed it to this: |
|
// Mike Brasher |
|
|
|
new(to) T(*from); |
|
to++; |
|
from++; |
|
} |
|
} |
|
|
|
inline void CopyToRaw(char* to, const char* from, Uint32 size) |
|
{ |
|
memcpy(to, from, sizeof(char) * size); |
} | } |
| |
inline void CopyToRaw(Boolean* to, const Boolean* from, Uint32 size) | inline void CopyToRaw(Boolean* to, const Boolean* from, Uint32 size) |
|
|
inline void InitializeRaw(T* items, Uint32 size) | inline void InitializeRaw(T* items, Uint32 size) |
{ | { |
while (size--) | while (size--) |
items++->~T(); |
{ |
|
new(items) T(); |
|
items++; |
|
} |
} | } |
| |
inline void InitializeRaw(Boolean* items, Uint32 size) { Zeros(items, size); } |
#define PEGASUS_MEMORY_FUNCTIONS(T) \ |
inline void InitializeRaw(Uint8* items, Uint32 size) { Zeros(items, size); } |
inline void Destroy(T*, Uint32) { } \ |
inline void InitializeRaw(Sint8* items, Uint32 size) { Zeros(items, size); } |
inline void InitializeRaw(T* items, Uint32 size) { Zeros(items, size); } |
inline void InitializeRaw(Uint16* items, Uint32 size) { Zeros(items, size); } |
|
inline void InitializeRaw(Sint16* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(char*) |
inline void InitializeRaw(Uint32* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(const char*) |
inline void InitializeRaw(Sint32* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Boolean) |
inline void InitializeRaw(Uint64* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Uint8) |
inline void InitializeRaw(Sint64* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Sint8) |
inline void InitializeRaw(Real32* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Uint16) |
inline void InitializeRaw(Real64* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Sint16) |
inline void InitializeRaw(Char16* items, Uint32 size) { Zeros(items, size); } |
PEGASUS_MEMORY_FUNCTIONS(Uint32) |
|
PEGASUS_MEMORY_FUNCTIONS(Sint32) |
|
PEGASUS_MEMORY_FUNCTIONS(Uint64) |
|
PEGASUS_MEMORY_FUNCTIONS(Sint64) |
|
PEGASUS_MEMORY_FUNCTIONS(Real32) |
|
PEGASUS_MEMORY_FUNCTIONS(Real64) |
|
PEGASUS_MEMORY_FUNCTIONS(Char16) |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |