33#include <tools/tokenize>
40G4PlotterManager::G4PlotterManager():fMessenger(0) {
41 fMessenger =
new Messenger(*
this);
44G4PlotterManager::~G4PlotterManager() {
49 tools_vforit(NamedPlotter,fPlotters,it) {
50 if((*it).first==a_name) {
54 fPlotters.push_back(NamedPlotter(a_name,
G4Plotter()));
55 return fPlotters.back().second;
59 tools_vforcit(NamedPlotter,fPlotters,it) {
68void G4PlotterManager::ListStyles()
const {
76 if((*it).first==a_name)
return &((*it).second);
81void G4PlotterManager::SelectStyle(
const G4String& a_name) {
82 if(!FindStyle(a_name)) {
85 fCurrentStyle = a_name;
88void G4PlotterManager::RemoveStyle(
const G4String& a_name) {
90 if((*it).first==a_name) {
92 if(fCurrentStyle==a_name) fCurrentStyle.clear();
98void G4PlotterManager::PrintStyle(
const G4String& a_name)
const {
100 if((*it).first==a_name) {
102 tools_vforcit(
StyleItem,(*it).second,its) {
103 G4cout <<
" " << (*its).first <<
" " << (*its).second <<
G4endl;
109void G4PlotterManager::AddStyleParameter(
const G4String& a_parameter,
const G4String& a_value) {
110 Style* _style = FindStyle(fCurrentStyle);
112 G4cout <<
"G4PlotterManager::AddStyleParameter: style " << fCurrentStyle <<
" not found." <<
G4endl;
116 if((*it).first==a_parameter) {
117 (*it).second = a_value;
121 _style->push_back(
StyleItem(a_parameter,a_value));
125 std::vector<std::string> args;
126 tools::double_quotes_tokenize(a_value,args);
128 if(a_cmd==select_style) {
129 fPlotterManager.SelectStyle(args[0]);
130 }
else if(a_cmd==add_style_parameter) {
131 fPlotterManager.AddStyleParameter(args[0],args[1]);
132 }
else if(a_cmd==remove_style) {
133 fPlotterManager.RemoveStyle(args[0]);
134 }
else if(a_cmd==list_styles) {
138 fPlotterManager.ListStyles();
139 }
else if(a_cmd==print_style) {
140 fPlotterManager.PrintStyle(args[0]);
G4GLOB_DLL std::ostream G4cout
G4Plotter & GetPlotter(const G4String &a_name)
std::pair< G4String, Style > NamedStyle
std::vector< StyleItem > Style
std::pair< G4String, G4String > StyleItem
static G4PlotterManager & GetInstance()
std::size_t GetParameterEntries() const