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 #include <stdint.h>
30 
31 namespace ns3
32 {
33 
43 class SatEnvVariables : public Object
44 {
45  public:
50  static TypeId GetTypeId(void);
51 
56  virtual TypeId GetInstanceTypeId(void) const;
57 
62 
67 
72  std::string GetCurrentWorkingDirectory();
73 
78  std::string GetPathToExecutable();
79 
84  void SetCurrentWorkingDirectory(std::string currentWorkingDirectory);
85 
90  void SetPathToExecutable(std::string pathToExecutable);
91 
96  void CreateDirectory(std::string path);
97 
102  std::string GetDataPath()
103  {
104  return m_dataPath;
105  }
106 
111  std::string GetOutputPath();
112 
117  void SetOutputPath(std::string outputPath);
118 
123  std::string LocateDataDirectory();
124 
130  std::string LocateDirectory(std::string initialPath);
131 
137  std::string LocateFile(std::string initialPath);
138 
143  bool IsValidDirectory(std::string path);
144 
149  bool IsValidFile(std::string pathToFile);
150 
155  std::string GetCurrentDateAndTime();
156 
164  void SetOutputVariables(std::string campaignName,
165  std::string simTag,
166  bool enableOutputOverwrite);
167 
173  void DoInitialize();
174 
180  void DoDispose();
181 
182  private:
190  std::string InitializeOutputFolders(std::string campaignName,
191  std::string simTag,
192  bool enableOutputOverwrite);
193 
199 
204  void DumpRevisionDiff(std::string dataPath);
205 
211  void ExecuteCommandAndReadOutput(std::string command,
212  Ptr<SatOutputFileStreamStringContainer> outputContainer);
213 
220  std::string AddToPath(std::string path, std::string stringToAdd);
221 
230  std::string FormOutputPath(std::string simRootPath,
231  std::string campaignName,
232  std::string simTag,
233  std::string safetyTag);
234 
239 
243  std::string m_pathToExecutable;
244 
249 
254 
258  uint32_t m_levelsToCheck;
259 
263  std::string m_dataPath;
264 
268  std::string m_outputPath;
269 
273  std::string m_campaignName;
274 
278  std::string m_simRootPath;
279 
283  std::string m_simTag;
284 
289 
294 
299 
304 
309 
314 };
315 
316 } // namespace ns3
317 
318 #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.