C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
ElementLiouvilleanAveragedCommon.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
2 // -*- C++ -*-
4 #ifndef CPPQEDCORE_STRUCTURE_ELEMENTLIOUVILLEANAVERAGEDCOMMON_H_INCLUDED
5 #define CPPQEDCORE_STRUCTURE_ELEMENTLIOUVILLEANAVERAGEDCOMMON_H_INCLUDED
6 
7 #include "ElementLiouvilleanAveragedCommonFwd.h"
8 
9 #include "KeyPrinter.h"
10 
11 
12 namespace structure {
13 
14 
16 
19 template<typename BASE>
21 {
22 public:
23  typedef cpputils::KeyPrinter::KeyLabels KeyLabels ;
24  typedef cpputils::KeyPrinter::KeyLabelsInitializer KeyLabelsInitializer;
25 
26  const std::string& getTitle () const {return keyPrinter_.getTitle ();}
27  const KeyLabels & getLabels() const {return keyPrinter_.getLabels();}
28 
29 protected:
31  template<typename... KeyLabelsPack>
32  ElementLiouvilleanAveragedCommon(const std::string& keyTitle, KeyLabelsPack&&... keyLabelsPack) : keyPrinter_(keyTitle,keyLabelsPack...) {}
33 
35  ElementLiouvilleanAveragedCommon(const std::string& keyTitle, KeyLabelsInitializer il) : keyPrinter_(keyTitle,il) {}
36 
37 private:
38  virtual size_t nAvr_v() const final {return keyPrinter_.length();}
39 
40  virtual std::ostream& displayKey_v(std::ostream& os, size_t& i) const final {return keyPrinter_.displayKey(os,i);}
41 
42  const cpputils::KeyPrinter keyPrinter_;
43 
44 };
45 
46 } // structure
47 
48 
49 #endif // CPPQEDCORE_STRUCTURE_ELEMENTLIOUVILLEANAVERAGEDCOMMON_H_INCLUDED
50 
51 
std::list< std::string > KeyLabels
the list of labels
Definition: KeyPrinter.h:27
std::initializer_list< std::string > KeyLabelsInitializer
convenience typedef for initialization with an initializer_list
Definition: KeyPrinter.h:28
ElementLiouvilleanAveragedCommon(const std::string &keyTitle, KeyLabelsPack &&...keyLabelsPack)
redirect to cpputils::KeyPrinter
std::ostream & displayKey(std::ostream &, size_t &) const
displays the stored key in a nicely tabulated format
ElementLiouvilleanAveragedCommon(const std::string &keyTitle, KeyLabelsInitializer il)
redirect to cpputils::KeyPrinter
size_t length() const
number of elements in the key
Definition: KeyPrinter.h:37
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
const std::string & getTitle() const
redirect to cpputils::KeyPrinter
Implements LiouvilleanAveragedCommon::displayKey and LiouvilleanAveragedCommon::nAvr with the help of...
const KeyLabels & getLabels() const
redirect to cpputils::KeyPrinter
Defines class of the same name.
Stores and prints a “key” (a.k.a. legend) to data, that is, an explanation to each element of a cer...
Definition: KeyPrinter.h:24