Releases: bengreenier/CppFactory
Releases · bengreenier/CppFactory
v0.3.0
v0.3.0
Add Factory
class for 👴 style factory things.
Changes
- adds
Factory
- updates docs
- updates tests
Usage
- Add
CppFactory.hpp
to your project (either an include directory, or directly in the project) - Include
CppFactory.hpp
- (optional, otherwise prefix classes) add
using namespace CppFactory
- Use
Object<Type>::Get()
to allocate objects - (optional) use
Object<Type>::RegisterAllocator()
to define a custom allocator for a type - (optional) use
GlobalObject<Type>::Get()
to re-use the same object over and over - (optional) use
[Global]Object<Type>::Get<int>()
to scope allocations by an arbitraryint
(zones)
v0.2.0
v0.2.0
Small refactors, better object cache.
Changes
- adds
GlobalObject
, responsible for object caching - refactors zones from parameter to template
- updates docs
- updates tests
Breaking Changes
- There is no longer a template parameter for
ObjectLifecycle
, you instead should useObject
for locally scoped (untracked) andGlobalObject
for cached (global). - Zones are no longer parameters, you should instead use template values (
Object<TObject>::Get<10>()
instead ofObject<TObject>::Get(10)
)
Usage
- Add
CppFactory.hpp
to your project (either an include directory, or directly in the project) - Include
CppFactory.hpp
- (optional, otherwise prefix classes) add
using namespace CppFactory
- Use
Object<Type>::Get()
to allocate objects - (optional) use
Object<Type>::RegisterAllocator()
to define a custom allocator for a type - (optional) use
GlobalObject<Type>::Get()
to re-use the same object over and over - (optional) use
[Global]Object<Type>::Get<int>()
to scope allocations by an arbitraryint
(zones)
v0.1.0
v0.1.0
Initial release! 🚀
Changes
- Support basic (default ctor) object allocator
- Support custom (functional) object allocation
- Support custom (functional) object deallocation
- Hold object references for reuse (think DI)
- Allocate objects on the fly with simple syntax (
Object<Type>::Get()
) - Use c++11
shared_ptr
to keep object lifecycle easy to understand
Usage
- Add
CppFactory.hpp
to your project (either an include directory, or directly in the project) - Include
CppFactory.hpp
- (optional, otherwise prefix classes) add
using namespace CppFactory
- Use
Object<Type>::Get()
to allocate objects - (optional) use
Object<Type>::RegisterAllocator()
to define a custom allocator for a type - (optional) use
Object<Type, ObjectLifecycle::Global>::Get()
to re-use the same object over and over - (optional) use
Object<Type>::Get(int)
to scope allocations by an arbitraryint