Skip to content

Releases: bengreenier/CppFactory

v0.3.0

15 May 19:27
Compare
Choose a tag to compare

v0.3.0

Add Factory class for 👴 style factory things.

Changes

  • adds Factory
  • updates docs
  • updates tests

Usage

  1. Add CppFactory.hpp to your project (either an include directory, or directly in the project)
  2. Include CppFactory.hpp
  3. (optional, otherwise prefix classes) add using namespace CppFactory
  4. Use Object<Type>::Get() to allocate objects
  5. (optional) use Object<Type>::RegisterAllocator() to define a custom allocator for a type
  6. (optional) use GlobalObject<Type>::Get() to re-use the same object over and over
  7. (optional) use [Global]Object<Type>::Get<int>() to scope allocations by an arbitrary int (zones)

v0.2.0

03 Oct 16:07
Compare
Choose a tag to compare

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 use Object for locally scoped (untracked) and GlobalObject for cached (global).
  • Zones are no longer parameters, you should instead use template values (Object<TObject>::Get<10>() instead of Object<TObject>::Get(10))

Usage

  1. Add CppFactory.hpp to your project (either an include directory, or directly in the project)
  2. Include CppFactory.hpp
  3. (optional, otherwise prefix classes) add using namespace CppFactory
  4. Use Object<Type>::Get() to allocate objects
  5. (optional) use Object<Type>::RegisterAllocator() to define a custom allocator for a type
  6. (optional) use GlobalObject<Type>::Get() to re-use the same object over and over
  7. (optional) use [Global]Object<Type>::Get<int>() to scope allocations by an arbitrary int (zones)

v0.1.0

01 Oct 23:45
Compare
Choose a tag to compare

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

  1. Add CppFactory.hpp to your project (either an include directory, or directly in the project)
  2. Include CppFactory.hpp
  3. (optional, otherwise prefix classes) add using namespace CppFactory
  4. Use Object<Type>::Get() to allocate objects
  5. (optional) use Object<Type>::RegisterAllocator() to define a custom allocator for a type
  6. (optional) use Object<Type, ObjectLifecycle::Global>::Get() to re-use the same object over and over
  7. (optional) use Object<Type>::Get(int) to scope allocations by an arbitrary int