Loading...
Searching...
No Matches
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
31namespace ns3
32{
33
43class SatEnvVariables : public Object
44{
45 public:
50 static TypeId GetTypeId(void);
51
56
65 virtual void NotifyConstructionCompleted() override;
66
71
72 static Ptr<SatEnvVariables> GetInstance();
73
78 std::string GetCurrentWorkingDirectory();
79
84 std::string GetPathToExecutable();
85
90 void SetCurrentWorkingDirectory(std::string currentWorkingDirectory);
91
96 void SetPathToExecutable(std::string pathToExecutable);
97
102 void CreateDirectory(std::string path);
103
108 std::string GetDataPath()
109 {
110 return m_dataPath;
111 }
112
117 std::string GetOutputPath();
118
123 void SetOutputPath(std::string outputPath);
124
129 std::string LocateDataDirectory();
130
136 std::string LocateDirectory(std::string initialPath);
137
143 std::string LocateFile(std::string initialPath);
144
149 bool IsValidDirectory(std::string path);
150
155 bool IsValidFile(std::string pathToFile);
156
161 std::string GetCurrentDateAndTime();
162
170 void SetOutputVariables(std::string campaignName,
171 std::string simTag,
172 bool enableOutputOverwrite);
173
179 void DoInitialize();
180
186 void DoDispose();
187
188 private:
196 std::string InitializeOutputFolders(std::string campaignName,
197 std::string simTag,
198 bool enableOutputOverwrite);
199
205
210 void DumpRevisionDiff(std::string dataPath);
211
217 void ExecuteCommandAndReadOutput(std::string command,
218 Ptr<SatOutputFileStreamStringContainer> outputContainer);
219
226 std::string AddToPath(std::string path, std::string stringToAdd);
227
236 std::string FormOutputPath(std::string simRootPath,
237 std::string campaignName,
238 std::string simTag,
239 std::string safetyTag);
240
245
250
255
260
265
269 std::string m_dataPath;
270
274 std::string m_outputPath;
275
279 std::string m_campaignName;
280
284 std::string m_simRootPath;
285
289 std::string m_simTag;
290
295
300
305
310
315
320
324 static Ptr<SatEnvVariables> m_instance;
325};
326
327} // namespace ns3
328
329#endif /* SATELLITE_ENV_VARIABLES_H */
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)
static Ptr< SatEnvVariables > GetInstance()
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
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.
static Ptr< SatEnvVariables > m_instance
Instance of SatEnvVariables used for singleton template.
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.
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.