version 1.1.1.1, 2001/01/14 19:52:41
|
version 1.15, 2003/08/06 14:04:22
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// 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. |
// | // |
// 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 |
// Author: Mike Brasher (mbrasher@bmc.com) |
//BEGIN_HISTORY |
|
// | // |
// Author: |
// Modified By: |
// | // |
// $Log$ |
//%///////////////////////////////////////////////////////////////////////////// |
// Revision 1.1.1.1 2001/01/14 19:52:41 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
| |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
|
|
#ifndef Pegasus_Memory_h | #ifndef Pegasus_Memory_h |
#define Pegasus_Memory_h | #define Pegasus_Memory_h |
| |
#include <cstring> |
#include <string> |
#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 |
|
|
items++->~T(); | items++->~T(); |
} | } |
| |
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(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 |
| |