CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
rep_type.h
Go to the documentation of this file.
1 #ifndef DDI_rep_type_h
2 #define DDI_rep_type_h
3 
4 namespace DDI {
5 
6  template <class N, class I>
7  struct rep_traits
8  {
9  typedef N name_type;
10  typedef typename I::value_type value_type;
11  typedef typename I::pointer pointer;
12  typedef typename I::reference reference;
13  };
14 
15  template <class N, class I>
16  struct rep_traits<N,I*>
17  {
18  typedef N name_type;
19  typedef I value_type;
20  typedef I* pointer;
21  typedef I& reference;
22  };
23 
24  template <class N, class I>
25  struct rep_type
26  {
27  rep_type() : second(0), init_(false) {}
28  rep_type(const N & n, I i) : first(n), second(i), init_(false)
29  { if (i) init_=true; }
30  virtual ~rep_type() {} // talk to Chris about this: delete second; }
33  bool init_;
34  const typename rep_traits<N,I>::name_type & name() const { return first; }
35  const typename rep_traits<N,I>::reference rep() const { return *second; }
36  typename rep_traits<N,I>::reference rep() { return *second; }
37  I swap(I i)
38  {
39  I tmp(second);
40  second = i;
41  init_ = false;
42  if (i) init_ = true;
43  return tmp;
44  }
45  operator bool() const { return init_; }
46  };
47 }
48 #endif
I::reference reference
Definition: rep_type.h:12
const rep_traits< N, I >::reference rep() const
Definition: rep_type.h:35
int i
Definition: DBlmapReader.cc:9
bool init_
Definition: rep_type.h:33
rep_traits< N, I >::reference rep()
Definition: rep_type.h:36
I::value_type value_type
Definition: rep_type.h:10
virtual ~rep_type()
Definition: rep_type.h:30
const rep_traits< N, I >::name_type & name() const
Definition: rep_type.h:34
const std::complex< double > I
Definition: I.h:8
rep_type(const N &n, I i)
Definition: rep_type.h:28
I swap(I i)
Definition: rep_type.h:37
Container::value_type value_type
#define N
Definition: blowfish.cc:9
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
I::pointer pointer
Definition: rep_type.h:11