Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::deque to ozz::deque in order to replace std default allocator
|
||||
// by ozz::StdAllocator.
|
||||
template <class _Ty, class _Allocator = ozz::StdAllocator<_Ty>>
|
||||
using deque = std::deque<_Ty, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_DEQUE_H_
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_LIST_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_LIST_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// Removes constant conditional expression warning.
|
||||
#pragma warning(disable : 4127)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::list to ozz::list in order to replace std default allocator by
|
||||
// ozz::StdAllocator.
|
||||
template <class _Ty, class _Allocator = ozz::StdAllocator<_Ty>>
|
||||
using list = std::list<_Ty, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_LIST_H_
|
||||
@@ -0,0 +1,70 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_MAP_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4702) // warning C4702: unreachable code
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::map to ozz::map in order to replace std default allocator by
|
||||
// ozz::StdAllocator.
|
||||
template <class _Key, class _Ty, class _Pred = std::less<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<std::pair<const _Key, _Ty>>>
|
||||
using map = std::map<_Key, _Ty, _Pred, _Allocator>;
|
||||
|
||||
// Implements a string comparator that can be used by std algorithm like maps.
|
||||
struct str_less {
|
||||
bool operator()(const char* const& _left, const char* const& _right) const {
|
||||
return strcmp(_left, _right) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Specializes std::map to use c-string as a key.
|
||||
template <class _Ty, class _Allocator =
|
||||
ozz::StdAllocator<std::pair<const char* const, _Ty>>>
|
||||
using cstring_map = std::map<const char*, _Ty, str_less, _Allocator>;
|
||||
|
||||
// Redirects std::multimap to ozz::MultiMap in order to replace std default
|
||||
// allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Ty, class _Pred = std::less<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<std::pair<const _Key, _Ty>>>
|
||||
using multimap = std::multimap<_Key, _Ty, _Pred, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_MAP_H_
|
||||
@@ -0,0 +1,47 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "deque.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::queue to ozz::queue in order to replace std default allocator
|
||||
// by ozz::StdAllocator.
|
||||
template <class _Ty, class _Container = deque<_Ty>>
|
||||
using queue = std::queue<_Ty, _Container>;
|
||||
|
||||
// Redirects std::priority_queue to ozz::priority_queue in order to replace std
|
||||
// default allocator by ozz::StdAllocator.
|
||||
template <class _Ty, class _Container = deque<_Ty>,
|
||||
class _Pred = std::less<typename _Container::value_type>>
|
||||
using priority_queue = std::priority_queue<_Ty, _Container, _Pred>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_QUEUE_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_SET_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_SET_H_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::set to ozz::set in order to replace std default allocator by
|
||||
// ozz::StdAllocator.
|
||||
template <class _Key, class _Pred = std::less<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<_Key>>
|
||||
using set = std::set<_Key, _Pred, _Allocator>;
|
||||
|
||||
// Redirects std::multiset to ozz::multiset in order to replace std default
|
||||
// allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Pred = std::less<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<_Key>>
|
||||
using multiset = std::multiset<_Key, _Pred, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_SET_H_
|
||||
@@ -0,0 +1,41 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_STACK_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_STACK_H_
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include "deque.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::stack to ozz::stack in order to replace std default allocator
|
||||
// by ozz::StdAllocator.
|
||||
template <class _Ty, class _Container = typename ozz::deque<_Ty>>
|
||||
using stack = std::stack<_Ty, _Container>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_STACK_H_
|
||||
@@ -0,0 +1,105 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_STD_ALLOCATOR_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_STD_ALLOCATOR_H_
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "ozz/base/memory/allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Define a STL allocator compliant allocator->
|
||||
template <typename _Ty>
|
||||
class StdAllocator {
|
||||
public:
|
||||
typedef _Ty value_type; // Element type.
|
||||
typedef value_type* pointer; // Pointer to element.
|
||||
typedef value_type& reference; // Reference to element.
|
||||
typedef const value_type* const_pointer; // Constant pointer to element.
|
||||
typedef const value_type& const_reference; // Constant reference to element.
|
||||
typedef size_t size_type; // Quantities of elements.
|
||||
typedef ptrdiff_t difference_type; // Difference between two pointers.
|
||||
|
||||
StdAllocator() noexcept {}
|
||||
StdAllocator(const StdAllocator&) noexcept {}
|
||||
|
||||
template <class _Other>
|
||||
StdAllocator<value_type>(const StdAllocator<_Other>&) noexcept {}
|
||||
|
||||
template <class _Other>
|
||||
struct rebind {
|
||||
typedef StdAllocator<_Other> other;
|
||||
};
|
||||
|
||||
pointer address(reference _ref) const noexcept { return &_ref; }
|
||||
const_pointer address(const_reference _ref) const noexcept { return &_ref; }
|
||||
|
||||
template <class _Other, class... _Args>
|
||||
void construct(_Other* _ptr, _Args&&... _args) {
|
||||
::new (static_cast<void*>(_ptr)) _Other(std::forward<_Args>(_args)...);
|
||||
}
|
||||
|
||||
template <class _Other>
|
||||
void destroy(_Other* _ptr) {
|
||||
(void)_ptr;
|
||||
_ptr->~_Other();
|
||||
}
|
||||
|
||||
// Allocates array of _Count elements.
|
||||
pointer allocate(size_t _count) noexcept {
|
||||
// Makes sure to a use c like allocator, to avoid duplicated constructor
|
||||
// calls.
|
||||
return reinterpret_cast<pointer>(memory::default_allocator()->Allocate(
|
||||
sizeof(value_type) * _count, alignof(value_type)));
|
||||
}
|
||||
|
||||
// Deallocates object at _Ptr, ignores size.
|
||||
void deallocate(pointer _ptr, size_type) noexcept {
|
||||
memory::default_allocator()->Deallocate(_ptr);
|
||||
}
|
||||
|
||||
size_type max_size() const noexcept {
|
||||
return (~size_type(0)) / sizeof(value_type);
|
||||
}
|
||||
};
|
||||
|
||||
// Tests for allocator equality (always true).
|
||||
template <class _Ty, class _Other>
|
||||
inline bool operator==(const StdAllocator<_Ty>&,
|
||||
const StdAllocator<_Other>&) noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tests for allocator inequality (always false).
|
||||
template <class _Ty, class _Other>
|
||||
inline bool operator!=(const StdAllocator<_Ty>&,
|
||||
const StdAllocator<_Other>&) noexcept {
|
||||
return false;
|
||||
}
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_STD_ALLOCATOR_H_
|
||||
@@ -0,0 +1,41 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_STRING_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_STRING_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::basic_string to ozz::string in order to replace std default
|
||||
// allocator by ozz::StdAllocator.
|
||||
using string =
|
||||
std::basic_string<char, std::char_traits<char>, ozz::StdAllocator<char>>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_STRING_H_
|
||||
@@ -0,0 +1,49 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_
|
||||
|
||||
#include "ozz/base/containers/string.h"
|
||||
#include "ozz/base/io/archive_traits.h"
|
||||
#include "ozz/base/platform.h"
|
||||
|
||||
namespace ozz {
|
||||
namespace io {
|
||||
|
||||
OZZ_IO_TYPE_NOT_VERSIONABLE(ozz::string)
|
||||
|
||||
template <>
|
||||
struct Extern<ozz::string> {
|
||||
static void Save(OArchive& _archive, const ozz::string* _values,
|
||||
size_t _count);
|
||||
static void Load(IArchive& _archive, ozz::string* _values, size_t _count,
|
||||
uint32_t _version);
|
||||
};
|
||||
} // namespace io
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_STRING_ARCHIVE_H_
|
||||
@@ -0,0 +1,62 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_UNORDERED_MAP_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4702) // warning C4702: unreachable code
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
|
||||
// Redirects std::unordered_map to ozz::unordered_map in order to replace std
|
||||
// default allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Ty, class _Hash = std::hash<_Key>,
|
||||
class _KeyEqual = std::equal_to<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<std::pair<const _Key, _Ty>>>
|
||||
using unordered_map =
|
||||
std::unordered_map<_Key, _Ty, _Hash, _KeyEqual, _Allocator>;
|
||||
|
||||
// Redirects std::unordered_multimap to ozz::UnorderedMultiMap in order to
|
||||
// replace std default allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Ty, class _Hash = std::hash<_Key>,
|
||||
class _KeyEqual = std::equal_to<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<std::pair<const _Key, _Ty>>>
|
||||
using unordered_multimap =
|
||||
std::unordered_multimap<_Key, _Ty, _Hash, _KeyEqual, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_UNORDERED_MAP_H_
|
||||
@@ -0,0 +1,52 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::unordered_set to ozz::UnorderedSet in order to replace std
|
||||
// default allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Hash = std::hash<_Key>,
|
||||
class _KeyEqual = std::equal_to<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<_Key> >
|
||||
using unordered_set =
|
||||
std::unordered_set<_Key, _Hash, _KeyEqual, _Allocator>;
|
||||
|
||||
// Redirects std::unordered_multiset to ozz::UnorderedMultiSet in order to
|
||||
// replace std default allocator by ozz::StdAllocator.
|
||||
template <class _Key, class _Hash = std::hash<_Key>,
|
||||
class _KeyEqual = std::equal_to<_Key>,
|
||||
class _Allocator = ozz::StdAllocator<_Key> >
|
||||
using unordered_multiset =
|
||||
std::unordered_multiset<_Key, _Hash, _KeyEqual, _Allocator>;
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_UNORDERED_SET_H_
|
||||
@@ -0,0 +1,74 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_VECTOR_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_VECTOR_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ozz/base/containers/std_allocator.h"
|
||||
|
||||
namespace ozz {
|
||||
// Redirects std::vector to ozz::vector in order to replace std default
|
||||
// allocator by ozz::StdAllocator.
|
||||
template <class _Ty, class _Allocator = ozz::StdAllocator<_Ty>>
|
||||
using vector = std::vector<_Ty, _Allocator>;
|
||||
|
||||
// Extends std::vector with two functions that gives access to the begin and the
|
||||
// end of its array of elements.
|
||||
|
||||
// Returns the mutable begin of the array of elements, or nullptr if
|
||||
// vector's empty.
|
||||
template <class _Ty, class _Allocator>
|
||||
inline _Ty* array_begin(std::vector<_Ty, _Allocator>& _vector) {
|
||||
return _vector.data();
|
||||
}
|
||||
|
||||
// Returns the non-mutable begin of the array of elements, or nullptr if
|
||||
// vector's empty.
|
||||
template <class _Ty, class _Allocator>
|
||||
inline const _Ty* array_begin(const std::vector<_Ty, _Allocator>& _vector) {
|
||||
return _vector.data();
|
||||
}
|
||||
|
||||
// Returns the mutable end of the array of elements, or nullptr if
|
||||
// vector's empty. Array end is one element past the last element of the
|
||||
// array, it cannot be dereferenced.
|
||||
template <class _Ty, class _Allocator>
|
||||
inline _Ty* array_end(std::vector<_Ty, _Allocator>& _vector) {
|
||||
return _vector.data() + _vector.size();
|
||||
}
|
||||
|
||||
// Returns the non-mutable end of the array of elements, or nullptr if
|
||||
// vector's empty. Array end is one element past the last element of the
|
||||
// array, it cannot be dereferenced.
|
||||
template <class _Ty, class _Allocator>
|
||||
inline const _Ty* array_end(const std::vector<_Ty, _Allocator>& _vector) {
|
||||
return _vector.data() + _vector.size();
|
||||
}
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_VECTOR_H_
|
||||
@@ -0,0 +1,72 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
// //
|
||||
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
|
||||
// and distributed under the MIT License (MIT). //
|
||||
// //
|
||||
// Copyright (c) Guillaume Blanc //
|
||||
// //
|
||||
// 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. //
|
||||
// //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef OZZ_OZZ_BASE_CONTAINERS_VECTOR_ARCHIVE_H_
|
||||
#define OZZ_OZZ_BASE_CONTAINERS_VECTOR_ARCHIVE_H_
|
||||
|
||||
#include "ozz/base/containers/vector.h"
|
||||
#include "ozz/base/io/archive.h"
|
||||
#include "ozz/base/platform.h"
|
||||
|
||||
namespace ozz {
|
||||
namespace io {
|
||||
|
||||
OZZ_IO_TYPE_NOT_VERSIONABLE_T2(class _Ty, class _Allocator,
|
||||
std::vector<_Ty, _Allocator>)
|
||||
|
||||
template <class _Ty, class _Allocator>
|
||||
struct Extern<std::vector<_Ty, _Allocator>> {
|
||||
inline static void Save(OArchive& _archive,
|
||||
const std::vector<_Ty, _Allocator>* _values,
|
||||
size_t _count) {
|
||||
for (size_t i = 0; i < _count; i++) {
|
||||
const std::vector<_Ty, _Allocator>& vector = _values[i];
|
||||
const uint32_t size = static_cast<uint32_t>(vector.size());
|
||||
_archive << size;
|
||||
if (size > 0) {
|
||||
_archive << ozz::io::MakeArray(&vector[0], size);
|
||||
}
|
||||
}
|
||||
}
|
||||
inline static void Load(IArchive& _archive,
|
||||
std::vector<_Ty, _Allocator>* _values, size_t _count,
|
||||
uint32_t _version) {
|
||||
(void)_version;
|
||||
for (size_t i = 0; i < _count; i++) {
|
||||
std::vector<_Ty, _Allocator>& vector = _values[i];
|
||||
uint32_t size;
|
||||
_archive >> size;
|
||||
vector.resize(size);
|
||||
if (size > 0) {
|
||||
_archive >> ozz::io::MakeArray(&vector[0], size);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace io
|
||||
} // namespace ozz
|
||||
#endif // OZZ_OZZ_BASE_CONTAINERS_VECTOR_ARCHIVE_H_
|
||||
Reference in New Issue
Block a user