Loki  0.1.7
Loki Namespace Reference

Classes

class  AllocatorSingleton
 
struct  AllowConversion
 
class  AllowReset
 
class  AlwaysCreate
 Always allows creation. More...
 
class  AmountLimitedCreation
 Limit by number of objects. More...
 
class  ArrayStorage
 
class  AssertAnyMutexError
 
class  AssertBadDesignMutexError
 
struct  AssertCheck
 
struct  AssertCheckStrict
 
class  BaseVisitor
 
class  BinderFirst
 
class  CachedFactory
 Factory with caching support. More...
 
class  CantResetWithStrong
 
class  Chainer
 
class  CheckForEquality
 
class  CheckForNoChange
 
class  CheckForNoChangeOrThrow
 
class  CheckForNothing
 
class  CheckForNoThrow
 
class  CheckReturn
 
class  CheckStaticForNothing
 
class  CheckStaticForNoThrow
 
struct  Chunk
 
class  ClassLevelLockable
 
class  CloneFactory
 Creates a copy from a polymorphic object. More...
 
class  COMRefCounted
 
class  ConstPropPtr
 
class  ContractChecker
 
struct  CreateStatic
 
struct  CreateUsing
 
struct  CreateUsingMalloc
 
struct  CreateUsingNew
 
class  CyclicVisitor
 
struct  DeepCopy
 
class  DefaultFactoryError
 Default policy that throws an exception. More...
 
struct  DefaultLifetime
 
class  DefaultSPStorage
 
struct  DeletableSingleton
 
class  DeleteArray
 
class  DeleteNothing
 
class  DeleteSingle
 
class  DeleteUsingFree
 
class  DestructiveCopy
 
struct  DisallowConversion
 
class  DontPropagateConst
 
class  EvictAging
 LRU aware of the time span of use. More...
 
class  EvictLRU
 Evicts least accessed objects first. More...
 
class  EvictRandom
 Evicts a random object. More...
 
class  Factory
 
class  FixedAllocator
 
class  FollowIntoDeath
 
struct  Forbidden_conversion
 
struct  Function
 
class  FunctionStorage
 Implementation of the StoragePolicy used by SmartPtr. More...
 
class  Functor
 
class  HeapStorage
 
class  ImplOf
 
class  JustReturnMutexError
 
class  Key
 
class  LevelMutex
 
class  LevelMutexInfo
 
class  LockedStorage
 
class  LockingPtr
 
class  LokiAllocator
 
class  MultiMutexLocker
 
class  Mutex
 
class  MutexException
 
class  MutexLocker
 
class  MutexSleepWaits
 
class  NeverCreate
 Never allows creation. Testing purposes only. More...
 
class  NeverReset
 
struct  NoCheck
 
class  NoCopy
 
struct  NoDestroy
 
class  NoMutexWait
 
class  NoStatisticPolicy
 Do nothing. More...
 
struct  NullPointerException
 
class  ObjectLevelLockable
 
class  ObjScopeGuardImpl0
 
class  ObjScopeGuardImpl1
 
class  ObjScopeGuardImpl2
 
class  ObjScopeGuardImpl3
 
struct  PhoenixSingleton
 
class  Pimpl
 
class  PropagateConst
 
class  RateLimitedCreation
 Limit in rate. More...
 
class  RefCounted
 
class  RefLinked
 
class  RefToValue
 
class  RegisterOnCreateSet
 
struct  RejectNull
 
struct  RejectNullStatic
 
struct  RejectNullStrict
 
class  SafeBitConst
 
class  SafeBitField
 Forward declaration of the field type. More...
 
class  ScopeGuardImpl0
 
class  ScopeGuardImpl1
 
class  ScopeGuardImpl2
 
class  ScopeGuardImpl3
 
class  ScopeGuardImpl4
 
class  ScopeGuardImpl5
 
class  ScopeGuardImplBase
 
class  SimplePointer
 No encaspulation : returns the pointer. More...
 
class  SimpleStatisticPolicy
 Simple statistics. More...
 
class  SingleThreaded
 
class  Singleton
 
class  SingletonHolder
 
struct  SingletonWithLongevity
 
class  SleepLevelMutex
 
class  SmallObjAllocator
 
class  SmallObject
 
class  SmallObjectBase
 
class  SmallValueObject
 
class  SmartPointer
 Encapsulate the object in a SmartPtr with FunctionStorage policy. More...
 
class  SmartPtr
 
class  SpinLevelMutex
 
class  StaticChecker
 
class  StrongPtr
 
class  ThrowOnAnyMutexError
 
class  ThrowOnBadDesignMutexError
 
class  TwoRefCounts
 
class  TwoRefLinks
 
class  UnRegisterOnDeleteSet
 
class  Visitor
 

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> (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

◆ CountLocksInCurrentThread()

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:

◆ CountMutexesAtCurrentLevel()

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:

◆ CountMutexesInCurrentThread()

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:

◆ DoMutexesMatchContainer()

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:

◆ GetCurrentThreadsLevel()

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:

◆ GetLongevity()

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.

◆ operator!=()

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.

◆ operator==()

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.