FairRoot/PandaRoot
Classes | Public Types | Public Member Functions | List of all members
nsL1::SimdAlloc< T > Class Template Reference

#include <std_alloc.h>

Classes

struct  rebind
 

Public Types

typedef T value_type
 
typedef Tpointer
 
typedef const Tconst_pointer
 
typedef Treference
 
typedef const Tconst_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

pointer address (reference value) const
 
const_pointer address (const_reference value) const
 
 SimdAlloc () throw ()
 
 SimdAlloc (const SimdAlloc &) throw ()
 
template<class U >
 SimdAlloc (const SimdAlloc< U > &) throw ()
 
 ~SimdAlloc () throw ()
 
size_type max_size () const throw ()
 
pointer allocate (size_type num, const void *=0)
 
void construct (pointer p, const T &value)
 
void destroy (pointer p)
 
void deallocate (pointer p, size_type num)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size, void *ptr)
 
void * operator new (size_t size)
 
void * operator new[] (size_t size)
 
void operator delete (void *ptr, size_t)
 
void operator delete[] (void *ptr, size_t)
 

Detailed Description

template<class T>
class nsL1::SimdAlloc< T >

Definition at line 16 of file std_alloc.h.

Member Typedef Documentation

template<class T>
typedef const T* nsL1::SimdAlloc< T >::const_pointer

Definition at line 21 of file std_alloc.h.

template<class T>
typedef const T& nsL1::SimdAlloc< T >::const_reference

Definition at line 23 of file std_alloc.h.

template<class T>
typedef std::ptrdiff_t nsL1::SimdAlloc< T >::difference_type

Definition at line 25 of file std_alloc.h.

template<class T>
typedef T* nsL1::SimdAlloc< T >::pointer

Definition at line 20 of file std_alloc.h.

template<class T>
typedef T& nsL1::SimdAlloc< T >::reference

Definition at line 22 of file std_alloc.h.

template<class T>
typedef std::size_t nsL1::SimdAlloc< T >::size_type

Definition at line 24 of file std_alloc.h.

template<class T>
typedef T nsL1::SimdAlloc< T >::value_type

Definition at line 19 of file std_alloc.h.

Constructor & Destructor Documentation

template<class T>
nsL1::SimdAlloc< T >::SimdAlloc ( )
throw (
)
inline

Definition at line 44 of file std_alloc.h.

44  {
45  }
template<class T>
nsL1::SimdAlloc< T >::SimdAlloc ( const SimdAlloc< T > &  )
throw (
)
inline

Definition at line 46 of file std_alloc.h.

46  {
47  }
template<class T>
template<class U >
nsL1::SimdAlloc< T >::SimdAlloc ( const SimdAlloc< U > &  )
throw (
)
inline

Definition at line 49 of file std_alloc.h.

49  {
50  }
template<class T>
nsL1::SimdAlloc< T >::~SimdAlloc ( )
throw (
)
inline

Definition at line 51 of file std_alloc.h.

51  {
52  }

Member Function Documentation

template<class T>
pointer nsL1::SimdAlloc< T >::address ( reference  value) const
inline

Definition at line 34 of file std_alloc.h.

34  {
35  return &value;
36  }
template<class T>
const_pointer nsL1::SimdAlloc< T >::address ( const_reference  value) const
inline

Definition at line 37 of file std_alloc.h.

37  {
38  return &value;
39  }
template<class T>
pointer nsL1::SimdAlloc< T >::allocate ( size_type  num,
const void *  = 0 
)
inline

Definition at line 60 of file std_alloc.h.

References T.

60  {
61 // print message and allocate memory with global new
62 #ifdef DEBUG_nsL1
63  std::cerr << "Allocator: allocate " << num << " element(s)"
64  << " of size " << sizeof(T) << std::endl;
65 #endif // DEBUG_nsL1
66  pointer ret = reinterpret_cast<pointer>( /*T::*/operator new(num*sizeof(T)) );
67 #ifdef DEBUG_nsL1
68  std::cerr << " allocated at: " << (void*)ret << std::endl;
69 #endif // DEBUG_nsL1
70  return ret;
71  }
int num[96]
Definition: ranlxd.cxx:381
TTree * T
Definition: anaLmdReco.C:32
template<class T>
void nsL1::SimdAlloc< T >::construct ( pointer  p,
const T value 
)
inline

Definition at line 74 of file std_alloc.h.

References p, and T.

74  {
75  // initialize memory with placement new
76 #ifdef DEBUG_nsL1
77  std::cerr << "Allocator: construct " << p /*<< " " << value*/ << std::endl;
78 #endif // DEBUG_nsL1
79  new(p) T(value);
80 // p = reinterpret_cast<pointer>( operator new(sizeof(T), p) );
81 // *p = value;
82 #ifdef DEBUG_nsL1
83  std::cerr << "done." << std::endl;
84 #endif // DEBUG_nsL1
85  }
Double_t p
Definition: anasim.C:58
TTree * T
Definition: anaLmdReco.C:32
template<class T>
void nsL1::SimdAlloc< T >::deallocate ( pointer  p,
size_type  num 
)
inline

Definition at line 100 of file std_alloc.h.

References p, and T.

100  {
101  // print message and deallocate memory with global delete
102 #ifdef DEBUG_nsL1
103  std::cerr << "Allocator: deallocate " << num << " element(s)"
104  << " of size " << sizeof(T)
105  << " at: " << static_cast<void*>(p) << std::endl;
106 #endif // DEBUG_nsL1
107  /*T::*/operator delete(static_cast<void*>(p), num*sizeof(T));
108 #ifdef DEBUG_nsL1
109  std::cerr << "done." << std::endl;
110 #endif // DEBUG_nsL1
111  }
Double_t p
Definition: anasim.C:58
int num[96]
Definition: ranlxd.cxx:381
TTree * T
Definition: anaLmdReco.C:32
template<class T>
void nsL1::SimdAlloc< T >::destroy ( pointer  p)
inline

Definition at line 88 of file std_alloc.h.

88  {
89  // destroy objects by calling their destructor
90 #ifdef DEBUG_nsL1
91  std::cerr << "Allocator: destroy " << p << std::endl;
92 #endif // DEBUG_nsL1
93  p->~T();
94 #ifdef DEBUG_nsL1
95  std::cerr << "done." << std::endl;
96 #endif // DEBUG_nsL1
97  }
Double_t p
Definition: anasim.C:58
template<class T>
size_type nsL1::SimdAlloc< T >::max_size ( ) const
throw (
)
inline

Definition at line 55 of file std_alloc.h.

References max(), and T.

55  {
56  return std::numeric_limits<std::size_t>::max() / sizeof(T);
57  }
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
TTree * T
Definition: anaLmdReco.C:32
template<class T>
void nsL1::SimdAlloc< T >::operator delete ( void *  ptr,
size_t   
)
inline

Definition at line 118 of file std_alloc.h.

118 { _mm_free(ptr); }
template<class T>
void nsL1::SimdAlloc< T >::operator delete[] ( void *  ptr,
size_t   
)
inline

Definition at line 119 of file std_alloc.h.

119 { _mm_free(ptr); }
template<class T>
void* nsL1::SimdAlloc< T >::operator new ( size_t  size,
void *  ptr 
)
inline

Definition at line 114 of file std_alloc.h.

114 { return ::operator new(size, ptr);}
template<class T>
void* nsL1::SimdAlloc< T >::operator new ( size_t  size)
inline

Definition at line 116 of file std_alloc.h.

116 { return _mm_malloc(size, 16); }
template<class T>
void* nsL1::SimdAlloc< T >::operator new[] ( size_t  size,
void *  ptr 
)
inline

Definition at line 115 of file std_alloc.h.

115 { return ::operator new(size, ptr);}
template<class T>
void* nsL1::SimdAlloc< T >::operator new[] ( size_t  size)
inline

Definition at line 117 of file std_alloc.h.

117 { return _mm_malloc(size, 16); }

The documentation for this class was generated from the following file: