satellite-env-variables.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Frans Laakso <frans.laakso@magister.fi>
19  */
20 #ifndef SATELLITE_ENV_VARIABLES_H
21 #define SATELLITE_ENV_VARIABLES_H
22 
24 
25 #include "ns3/log.h"
26 #include "ns3/object.h"
27 #include "ns3/simulator.h"
28 
29 namespace ns3
30 {
31 
41 class SatEnvVariables : public Object
42 {
43  public:
48  static TypeId GetTypeId(void);
49 
54  virtual TypeId GetInstanceTypeId(void) const;
55 
60 
65 
70  std::string GetCurrentWorkingDirectory();
71 
76  std::string GetPathToExecutable();
77 
82  void SetCurrentWorkingDirectory(std::string currentWorkingDirectory);
83 
88  void SetPathToExecutable(std::string pathToExecutable);
89 
94  void CreateDirectory(std::string path);
95 
100  std::string GetDataPath()
101  {
102  return m_dataPath;
103  }
104 
109  std::string GetOutputPath();
110 
115  void SetOutputPath(std::string outputPath);
116 
121  std::string LocateDataDirectory();
122 
128  std::string LocateDirectory(std::string initialPath);
129 
135  std::string LocateFile(std::string initialPath);
136 
141  bool IsValidDirectory(std::string path);
142 
147  bool IsValidFile(std::string pathToFile);
148 
153  std::string GetCurrentDateAndTime();
154 
162  void SetOutputVariables(std::string campaignName,
163  std::string simTag,
164  bool enableOutputOverwrite);
165 
171  void DoInitialize();
172 
178  void DoDispose();
179 
180  private:
188  std::string InitializeOutputFolders(std::string campaignName,
189  std::string simTag,
190  bool enableOutputOverwrite);
191 
197 
202  void DumpRevisionDiff(std::string dataPath);
203 
209  void ExecuteCommandAndReadOutput(std::string command,
210  Ptr<SatOutputFileStreamStringContainer> outputContainer);
211 
218  std::string AddToPath(std::string path, std::string stringToAdd);
219 
228  std::string FormOutputPath(std::string simRootPath,
229  std::string campaignName,
230  std::string simTag,
231  std::string safetyTag);
232 
237 
241  std::string m_pathToExecutable;
242 
247 
252 
256  uint32_t m_levelsToCheck;
257 
261  std::string m_dataPath;
262 
266  std::string m_outputPath;
267 
271  std::string m_campaignName;
272 
276  std::string m_simRootPath;
277 
281  std::string m_simTag;
282 
287 
292 
297 
302 
307 
312 };
313 
314 } // namespace ns3
315 
316 #endif /* SATELLITE_ENV_VARIABLES_H */
Class for environmental variables.
uint32_t m_levelsToCheck
How many directory levels to check for data path.
std::string InitializeOutputFolders(std::string campaignName, std::string simTag, bool enableOutputOverwrite)
Function for forming the output path and directory structure.
void DumpRevisionDiff(std::string dataPath)
void DoInitialize()
Initialize class NOTICE: this function is meant to me used only in test cases, where issues with sing...
bool m_isInitialized
Flag for disposing and initializing.
std::string LocateFile(std::string initialPath)
Function for locating a specific file within the NS-3 simulator folder.
std::string GetPathToExecutable()
Function for getting the path to executable.
bool m_enableOutputOverwrite
Enable simulation output overwrite.
bool IsValidFile(std::string pathToFile)
Function for checking if the file exists.
std::string GetOutputPath()
Function for getting the simulation folder.
void CreateDirectory(std::string path)
Function for creating a directory.
void DumpSimulationInformation()
Function for outputting the most essential simulation specific environmental information.
std::string FormOutputPath(std::string simRootPath, std::string campaignName, std::string simTag, std::string safetyTag)
Function for forming the output path.
void SetOutputVariables(std::string campaignName, std::string simTag, bool enableOutputOverwrite)
Function for setting the output variables.
void SetCurrentWorkingDirectory(std::string currentWorkingDirectory)
Function for setting the path to current working directory.
bool m_excludeDataFolderFromDiff
Is data folder excluded from the simulation information diff.
std::string AddToPath(std::string path, std::string stringToAdd)
Function for forming the next level of a path.
std::string m_simRootPath
Path to the simulation output root folder.
std::string m_currentWorkingDirectoryFromAttribute
Path to current working directory (attribute value)
std::string m_pathToExecutable
Path to executable.
std::string GetCurrentWorkingDirectory()
Function for getting the path to current working directory.
void SetPathToExecutable(std::string pathToExecutable)
Function for setting the path to executable.
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
std::string LocateDataDirectory()
Function for locating the data directory within the NS-3 simulator folder.
std::string m_dataPath
Default data path.
bool IsValidDirectory(std::string path)
Function for checking if the directory exists.
bool m_enableSimInfoOutput
Is simulation information output enabled.
bool m_enableSimInfoDiffOutput
Is simulation information diff output enabled.
std::string GetDataPath()
Function for locating the data folder.
std::string m_campaignName
Simulation campaign name.
void SetOutputPath(std::string outputPath)
Method for setting the simulation output path.
bool m_isOutputPathInitialized
Is output path initialized.
std::string m_pathToExecutableFromAttribute
Path to executable (attribute value)
std::string LocateDirectory(std::string initialPath)
Function for locating a specific directory within the NS-3 simulator folder.
std::string GetCurrentDateAndTime()
Returns current real world date and time.
void ExecuteCommandAndReadOutput(std::string command, Ptr< SatOutputFileStreamStringContainer > outputContainer)
Function for executing the command and inserting the output into a string container.
std::string m_simTag
Tag related to the current simulation.
void DoDispose()
Reset class NOTICE: this function is meant to me used only in test cases, where issues with singleton...
std::string m_outputPath
Result output path.
static TypeId GetTypeId(void)
NS-3 function for type id.
std::string m_currentWorkingDirectory
Path to current working directory.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.