VPTissue Reference Manual
TimeStepPostfixFormat.h
Go to the documentation of this file.
1 #ifndef SIMPT_SHELL_TOME_STEP_POSTFIX_FORMAT_H_INCLUDED
2 #define SIMPT_SHELL_TOME_STEP_POSTFIX_FORMAT_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "IConverterFormat.h"
23 #include "util/misc/StringUtils.h"
24 
25 namespace SimPT_Shell {
26 
31 {
32 public:
33  virtual bool AppendTimeStepSuffix() const { return true; };
34 
35  virtual void PreConvert(const std::string& target_path,
36  std::shared_ptr<SimShell::Ws::MergedPreferences> p)
37  {
38  m_target_path = target_path;
39  m_prefs = p;
40  }
41 
42  virtual void PostConvert()
43  {
44  m_target_path.clear();
45  m_prefs.reset();
46  }
47 
48 protected:
49  std::string GeneratePath(const SimPT_Sim::SimState& sim) const
50  {
51  return m_target_path
52  + '_'
53  + SimPT_Sim::Util::ToString(sim.GetTimeStep(), 6, '0')
54  + '.' + GetExtension();
55  }
56 
57 protected:
58  std::string m_target_path;
59  std::shared_ptr<SimShell::Ws::MergedPreferences> m_prefs;
60 };
61 
62 } // namespace
63 
64 #endif // end_of_include_guard
Namespace for SimPT shell package.
Definition: Client.cpp:50
Interface for IConverterFormat.
Interface for file convenvereter formats.
static std::string ToString(const T &value)
Builds a string representation of a value of type T.
Definition: StringUtils.h:70
Contains the state of the whole Simulator at a given simulation step.
Definition: SimState.h:33
String manipulation utilities.
Manages time labels int file names.
int GetTimeStep() const
Returns the index of the current time step.
Definition: SimState.cpp:35