Loki: Loki Namespace Reference

# Loki Namespace Reference

## Classes
class | LokiAllocator
class | SimplePointer
| No encaspulation : returns the pointer. More...
class | NeverCreate
| Never allows creation. Testing purposes only. More...
class | AlwaysCreate
| Always allows creation. More...
class | RateLimitedCreation
| Limit in rate. More...
class | AmountLimitedCreation
| Limit by number of objects. More...
class | EvictLRU
| Evicts least accessed objects first. More...
class | EvictAging
| LRU aware of the time span of use. More...
class | EvictRandom
| Evicts a random object. More...
class | NoStatisticPolicy
| Do nothing. More...
class | SimpleStatisticPolicy
| Simple statistics. More...
class | CachedFactory
| Factory with caching support. More...
class | CheckForNoThrow
class | CheckForNoChange
class | CheckForNoChangeOrThrow
class | CheckForEquality
class | CheckForNothing
class | ContractChecker
class | CheckStaticForNoThrow
class | CheckStaticForNothing
class | StaticChecker
class | CheckReturn
class | DontPropagateConst
class | PropagateConst
class | DefaultFactoryError
| Default policy that throws an exception. More...
class | Factory
class | CloneFactory
| Creates a copy from a polymorphic object. More...
class | Functor
class | BinderFirst
class | Chainer
class | Key
class | LevelMutexInfo
class | ThrowOnAnyMutexError
class | ThrowOnBadDesignMutexError
class | AssertAnyMutexError
class | AssertBadDesignMutexError
class | JustReturnMutexError
class | NoMutexWait
class | MutexSleepWaits
class | SpinLevelMutex
class | SleepLevelMutex
class | LevelMutex
class | MutexException
class | MutexLocker
class | MultiMutexLocker
class | LockingPtr
class | ConstPropPtr
class | Pimpl
class | RefToValue
class | RegisterOnCreateSet
class | UnRegisterOnDeleteSet
class | SafeBitConst
class | ScopeGuardImplBase
class | ScopeGuardImpl0
class | ScopeGuardImpl1
class | ScopeGuardImpl2
class | ScopeGuardImpl3
class | ScopeGuardImpl4
class | ScopeGuardImpl5
class | ObjScopeGuardImpl0
class | ObjScopeGuardImpl1
class | ObjScopeGuardImpl2
class | ObjScopeGuardImpl3
struct | CreateUsingNew
struct | CreateUsing
struct | CreateUsingMalloc
struct | CreateStatic
struct | DefaultLifetime
struct | PhoenixSingleton
struct | DeletableSingleton
struct | SingletonWithLongevity
struct | NoDestroy
class | FollowIntoDeath
class | SingletonHolder
class | Singleton
class | SmallObjAllocator
class | AllocatorSingleton
class | SmallObjectBase
class | SmallObject
class | SmallValueObject
class | HeapStorage
class | DefaultSPStorage
class | LockedStorage
class | ArrayStorage
class | RefCounted
class | COMRefCounted
struct | DeepCopy
class | RefLinked
class | DestructiveCopy
class | NoCopy
struct | AllowConversion
struct | DisallowConversion
struct | NoCheck
struct | AssertCheck
struct | AssertCheckStrict
struct | NullPointerException
struct | RejectNullStatic
struct | RejectNull
struct | RejectNullStrict
class | SmartPtr
class | FunctionStorage
| Implementation of the StoragePolicy used by SmartPtr. More...
class | SmartPointer
| Encapsulate the object in a SmartPtr with FunctionStorage policy. More...
class | DeleteUsingFree
class | DeleteNothing
class | DeleteSingle
class | DeleteArray
class | CantResetWithStrong
class | AllowReset
class | NeverReset
class | TwoRefCounts
class | TwoRefLinks
class | StrongPtr
class | Mutex
class | SingleThreaded
class | BaseVisitor
class | CyclicVisitor
struct | Chunk
class | FixedAllocator
## Functions
template<typename Type >
bool | operator== (const LokiAllocator< Type > &, const LokiAllocator< Type > &)
template<typename Type >
bool | operator!= (const LokiAllocator< Type > &, const LokiAllocator< Type > &)
template<class Fctor >
Private::BinderFirstTraits < Fctor >::BoundFunctorType | BindFirst (const Fctor &fun, typename Fctor::Parm1 bound)
template<class Fun1 , class Fun2 >
Fun2 | Chain (const Fun1 &fun1, const Fun2 &fun2)
unsigned int | GetCurrentThreadsLevel (void)
unsigned int | CountMutexesInCurrentThread (void)
unsigned int | CountLocksInCurrentThread (void)
unsigned int | CountMutexesAtCurrentLevel (void)
MutexErrors::Type | DoMutexesMatchContainer (const LevelMutexInfo::MutexContainer &mutexes)
template<class T >
RefToValue< T > | ByRef (T &t)
template<class t >
bool | RegisterFunction ()
template<class t >
bool | UnRegisterFunction ()
template<typename T , typename Destroyer >
void | SetLongevity (T *pDynObject, unsigned int longevity, Destroyer d)
template<template< class, class > class T, std::size_t C, std::size_t M, std::size_t O, template< class > class L, class X >
unsigned int | GetLongevity (AllocatorSingleton< T, C, M, O, L, X > *)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP1, typename U >
bool | operator== (const SmartPtr< T, OP, CP, KP, SP, CNP1 > &lhs, U *rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP1, typename U >
bool | operator== (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP1 > &rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator!= (const SmartPtr< T, OP, CP, KP, SP, CNP > &lhs, U *rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator!= (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP > &rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator< (const SmartPtr< T, OP, CP, KP, SP, CNP > &lhs, U *rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator< (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP > &rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator> (const SmartPtr< T, OP, CP, KP, SP, CNP > &lhs, U *rhs)
| /////////////////////////////////////////////////////////////////////////////
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator> (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP > &rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator<= (const SmartPtr< T, OP, CP, KP, SP, CNP > &lhs, U *rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator<= (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP > &rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator>= (const SmartPtr< T, OP, CP, KP, SP, CNP > &lhs, U *rhs)
template<typename T , template< class > class OP, class CP , template< class > class KP, template< class > class SP, template< class > class CNP, typename U >
bool | operator>= (U *lhs, const SmartPtr< T, OP, CP, KP, SP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator== (const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &lhs, U *rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator== (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator!= (const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &lhs, U *rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator!= (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator< (const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &lhs, U *rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator< (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator> (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator<= (const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &lhs, U *rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator<= (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator>= (const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &lhs, U *rhs)
template<typename U , typename T , bool S, class OP , class CP , template< class > class KP, template< class > class RP, template< class > class DP, template< class > class CNP>
bool | operator>= (U *lhs, const StrongPtr< T, S, OP, CP, KP, RP, DP, CNP > &rhs)
std::size_t | GetOffset (std::size_t numBytes, std::size_t alignment)
void * | DefaultAllocator (std::size_t numBytes, bool doThrow)
void | DefaultDeallocator (void *p)

## Detailed Description

All classes of Loki are in the Loki namespace

This file is intented to be used if you want a CachedFactory with a SmartPointer encapsulation policy. It as been defined in a separate file because of the many introduced dependencies (SmartPtr.h would depend on Functor.h and CachedFactory.h would depend on SmartPtr.h). By defining another header you pay for those extra dependencies only if you need it.

This file defines FunctionStorage a new SmartPointer storage policy and SmartPointer a new CachedFactory encapsulation policy.

## Function Documentation

unsigned int Loki::CountLocksInCurrentThread | ( | void |  | ) |

Returns count of how mutexes the current thread locked. The lock count exceeds the number of mutexes locked by current thread if any mutex got locked more than once. Requires O(m) actions where m is the number of mutexes in the thread. Never throws exceptions.

References Loki::LevelMutexInfo::GetCurrentMutex(), Loki::LevelMutexInfo::GetLockCount(), and Loki::LevelMutexInfo::GetPrevious().

Here is the call graph for this function:

unsigned int Loki::CountMutexesAtCurrentLevel | ( | void |  | ) |

Returns count of mutexes locked by current thread which have the same level as GetCurrentThreadsLevel. Requires O(m) actions where m is the number of mutexes in the thread at current level. Never throws exceptions.

References Loki::LevelMutexInfo::GetCurrentMutex(), Loki::LevelMutexInfo::GetLevel(), and Loki::LevelMutexInfo::GetPrevious().

Referenced by DoMutexesMatchContainer().

Here is the call graph for this function:

unsigned int Loki::CountMutexesInCurrentThread | ( | void |  | ) |

Returns count of how mutexes the current thread locked. Requires O(m) actions where m is the number of mutexes in the thread. Never throws exceptions.

References Loki::LevelMutexInfo::GetCurrentMutex(), and Loki::LevelMutexInfo::GetPrevious().

Here is the call graph for this function:

MutexErrors::Type Loki::DoMutexesMatchContainer | ( | const LevelMutexInfo::MutexContainer & | mutexes | ) |

Determines if container of mutexes matches the recently locked mutexes. If they do match, it returns success, otherwise an error condition.

References CountMutexesAtCurrentLevel(), GetCurrentThreadsLevel(), Loki::LevelMutexInfo::GetLevel(), Loki::LevelMutexInfo::IsRecentLock(), and Loki::LevelMutexInfo::UnlockedLevel.

Referenced by Loki::LevelMutexInfo::MultiLock(), and Loki::LevelMutexInfo::MultiUnlock().

Here is the call graph for this function:

unsigned int Loki::GetCurrentThreadsLevel | ( | void |  | ) |

Returns level of most recently locked mutex by this thread, or UnlockedLevel if no mutexes are locked. Runs in constant time, and never throws exceptions.

References Loki::LevelMutexInfo::GetCurrentMutex(), Loki::LevelMutexInfo::GetLevel(), and Loki::LevelMutexInfo::UnlockedLevel.

Referenced by DoMutexesMatchContainer(), and Loki::LevelMutexInfo::MultiLock().

Here is the call graph for this function:

template<template< class, class > class T, std::size_t C, std::size_t M, std::size_t O, template< class > class L, class X >

unsigned int Loki::GetLongevity | ( | AllocatorSingleton< T, C, M, O, L, X > * |  | ) | `[inline]`

This standalone function provides the longevity level for Small-Object Allocators which use the Loki::SingletonWithLongevity policy. The SingletonWithLongevity class can find this function through argument- dependent lookup.

Longevity Levels
  No Small-Object Allocator depends on any other Small-Object allocator, so this does not need to calculate dependency levels among allocators, and it returns just a constant. All allocators must live longer than the objects which use the allocators, it must return a longevity level higher than any such object.

template<typename Type >

bool Loki::operator!= | ( | const LokiAllocator< Type > & | ,
|  | const LokiAllocator< Type > & |  |
| ) |  |  | `[inline]`

All inequality operators return false since LokiAllocator is basically a monostate design pattern, so all instances of it are identical.

template<typename Type >

bool Loki::operator== | ( | const LokiAllocator< Type > & | ,
|  | const LokiAllocator< Type > & |  |
| ) |  |  | `[inline]`

All equality operators return true since LokiAllocator is basically a monostate design pattern, so all instances of it are identical.